Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mm: move offset_in_page() to page_helpers.h
@ 2026-05-17 12:34 Thorsten Blum
  2026-05-17 12:34 ` [PATCH 2/3] mm: add bytes_to_page_end() helper Thorsten Blum
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Thorsten Blum @ 2026-05-17 12:34 UTC (permalink / raw)
  To: Andrew Morton, David Hildenbrand, Lorenzo Stoakes,
	Liam R. Howlett, Vlastimil Babka, Mike Rapoport,
	Suren Baghdasaryan, Michal Hocko, Yury Norov, Rasmus Villemoes,
	Andy Shevchenko
  Cc: linux-kernel, linux-mm, Thorsten Blum

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

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 include/linux/mm.h           |  2 +-
 include/linux/page_helpers.h | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
 create mode 100644 include/linux/page_helpers.h

diff --git a/include/linux/mm.h b/include/linux/mm.h
index af23453e9dbd..bf49e52f749a 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -17,6 +17,7 @@
 #include <linux/mm_types.h>
 #include <linux/mmap_lock.h>
 #include <linux/range.h>
+#include <linux/page_helpers.h>
 #include <linux/pfn.h>
 #include <linux/percpu-refcount.h>
 #include <linux/bit_spinlock.h>
@@ -3033,7 +3034,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/linux/page_helpers.h b/include/linux/page_helpers.h
new file mode 100644
index 000000000000..102a4f3c3868
--- /dev/null
+++ b/include/linux/page_helpers.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _LINUX_PAGE_HELPERS_H
+#define _LINUX_PAGE_HELPERS_H
+
+#include <asm/page.h>
+
+#define offset_in_page(p)	((unsigned long)(p) & ~PAGE_MASK)
+
+#endif /* _LINUX_PAGE_HELPERS_H */


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-05-18 11:54 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-17 12:34 [PATCH 1/3] mm: move offset_in_page() to page_helpers.h Thorsten Blum
2026-05-17 12:34 ` [PATCH 2/3] mm: add bytes_to_page_end() helper Thorsten Blum
2026-05-17 15:28   ` Yury Norov
2026-05-18  6:48     ` Andy Shevchenko
2026-05-18 10:23       ` Lorenzo Stoakes
2026-05-18 11:33         ` William Kucharski
2026-05-18 11:53         ` William Kucharski
2026-05-18  9:09     ` David Laight
2026-05-18 10:24       ` Lorenzo Stoakes
2026-05-18  6:49   ` Andy Shevchenko
2026-05-18 10:24   ` Lorenzo Stoakes
2026-05-17 12:34 ` [PATCH 3/3] lib/bitmap: use " Thorsten Blum
2026-05-18 10:33   ` Lorenzo Stoakes
2026-05-18  6:51 ` [PATCH 1/3] mm: move offset_in_page() to page_helpers.h Andy Shevchenko
2026-05-18 10:02 ` Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox