[PATCH 2/3] mm: add bytes_to_page_end() helper

From: Thorsten Blum

Date: Sun May 17 2026 - 08:35:10 EST


Add bytes_to_page_end() for the common PAGE_SIZE - offset_in_page()
calculation.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
include/linux/page_helpers.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/linux/page_helpers.h b/include/linux/page_helpers.h
index 102a4f3c3868..981731faa1fc 100644
--- a/include/linux/page_helpers.h
+++ b/include/linux/page_helpers.h
@@ -6,5 +6,6 @@
#include <asm/page.h>

#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK)
+#define bytes_to_page_end(p) (PAGE_SIZE - offset_in_page(p))

#endif /* _LINUX_PAGE_HELPERS_H */