Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@kernel.org>,
	Lorenzo Stoakes <ljs@kernel.org>,
	"Liam R. Howlett" <liam@infradead.org>,
	Vlastimil Babka <vbabka@kernel.org>,
	Mike Rapoport <rppt@kernel.org>,
	Suren Baghdasaryan <surenb@google.com>,
	Michal Hocko <mhocko@suse.com>, Andy Lutomirski <luto@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>,
	Yury Norov <yury.norov@gmail.com>,
	David Laight <david.laight.linux@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Thorsten Blum <thorsten.blum@linux.dev>
Subject: [PATCH v2 1/2] vdso: move offset_in_page() from linux/mm.h to vdso/page.h
Date: Thu, 21 May 2026 11:06:57 +0200	[thread overview]
Message-ID: <20260521090655.160282-5-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260521090655.160282-4-thorsten.blum@linux.dev>

Move offset_in_page() out of linux/mm.h so users that only need page
offset calculations can include the lightweight vdso/page.h header
instead of pulling in the large linux/mm.h.

Include vdso/page.h from linux/mm.h so existing users of
offset_in_page() continue to build.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 include/linux/mm.h  | 2 +-
 include/vdso/page.h | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 9cedc5e75aa9..d5c7f1ca80ef 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -37,6 +37,7 @@
 #include <linux/bitmap.h>
 #include <linux/bitops.h>
 #include <linux/iommu-debug-pagealloc.h>
+#include <vdso/page.h>
 
 struct mempolicy;
 struct anon_vma;
@@ -3023,7 +3024,6 @@ static inline void clear_page_pfmemalloc(struct page *page)
  */
 extern void pagefault_out_of_memory(void);
 
-#define offset_in_page(p)	((unsigned long)(p) & ~PAGE_MASK)
 #define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1))
 
 /*
diff --git a/include/vdso/page.h b/include/vdso/page.h
index bc47186c07fc..948b13091084 100644
--- a/include/vdso/page.h
+++ b/include/vdso/page.h
@@ -28,4 +28,6 @@
 #define PAGE_MASK	(~(PAGE_SIZE - 1))
 #endif
 
+#define offset_in_page(p)	((unsigned long)(p) & ~PAGE_MASK)
+
 #endif	/* __VDSO_PAGE_H */


  reply	other threads:[~2026-05-21  9:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-21  9:06 [PATCH v2 0/2] mm/vdso: make offset_in_page() usable without linux/mm.h Thorsten Blum
2026-05-21  9:06 ` Thorsten Blum [this message]
2026-05-21  9:30   ` [PATCH v2 1/2] vdso: move offset_in_page() from linux/mm.h to vdso/page.h David Laight
2026-05-21 11:45     ` Thomas Gleixner
2026-05-21 11:15   ` Lorenzo Stoakes
2026-05-21 14:56     ` Lorenzo Stoakes
2026-05-21 18:34       ` Andy Shevchenko
2026-05-22 10:52         ` Lorenzo Stoakes
2026-05-22 12:18       ` Thorsten Blum
2026-05-21 14:03   ` Yury Norov
2026-05-21  9:06 ` [PATCH v2 2/2] string: use offset_in_page() in sized_strscpy() Thorsten Blum
2026-05-21 11:31   ` Lorenzo Stoakes
2026-05-21 13:47     ` Thorsten Blum
2026-05-21 14:53       ` Lorenzo Stoakes
2026-05-21 11:33 ` [PATCH v2 0/2] mm/vdso: make offset_in_page() usable without linux/mm.h Lorenzo Stoakes
2026-05-21 13:59 ` Yury Norov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260521090655.160282-5-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andy@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=david@kernel.org \
    --cc=kees@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=luto@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=tglx@kernel.org \
    --cc=vbabka@kernel.org \
    --cc=vincenzo.frascino@arm.com \
    --cc=yury.norov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox