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>, Yury Norov <yury.norov@gmail.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Thorsten Blum <thorsten.blum@linux.dev>
Subject: [PATCH 2/3] mm: add bytes_to_page_end() helper
Date: Sun, 17 May 2026 14:34:30 +0200	[thread overview]
Message-ID: <20260517123428.1181981-5-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260517123428.1181981-4-thorsten.blum@linux.dev>

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

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 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 */


  reply	other threads:[~2026-05-17 12:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17 12:34 [PATCH 1/3] mm: move offset_in_page() to page_helpers.h Thorsten Blum
2026-05-17 12:34 ` Thorsten Blum [this message]
2026-05-17 15:28   ` [PATCH 2/3] mm: add bytes_to_page_end() helper 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

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=20260517123428.1181981-5-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    --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