I have heard that on one occasion the Blessed One was staying near Sāvatthī at Jeta's Grove, Anāthapiṇḍika's monastery. Now at that time Ven. Mahā Kaccāyana was sitting not far from the Blessed One, his legs crossed, his body held erect, having mindfulness immersed in the body well-established to the fore within. The Blessed One saw Ven. Mahā Kaccāyana sitting not far away, his legs crossed, his body held erect, having mindfulness immersed in the body well-established to the fore within.
Then, on realizing the significance of that, the Blessed One on that occasion exclaimed:
This passage can also be translated as:
In AN 10.29, the Buddha recommends this view as conducive to developing dispassion for becoming. However, in MN 106 he warns that it can lead to the refined equanimity of the dimension of neither perception nor non-perception, which can become an object of clinging. Only if that subtle clinging is detected can all clinging be abandoned.
The Canon's most extended discussion of this theme of meditation is in SN 22.55. See Appendix Two [of the print edition of this book].
For more on this topic, see The Paradox of Becoming, chapter 5.