Re: [PATCH 2/3] mm: add bytes_to_page_end() helper
From: Lorenzo Stoakes
Date: Mon May 18 2026 - 06:28:33 EST
On Mon, May 18, 2026 at 10:09:33AM +0100, David Laight wrote:
> On Sun, 17 May 2026 11:28:05 -0400
> Yury Norov <ynorov@xxxxxxxxxx> wrote:
>
> > On Sun, May 17, 2026 at 02:34:30PM +0200, Thorsten Blum wrote:
> > > 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 */
> >
> > I've got a series for this
> >
> > https://lore.kernel.org/all/20260303182845.250bb2de@xxxxxxxxxx/
> >
> > The feedback is surprisingly negative. Please add people from that
> > thread. Maybe you'll be more successful convincing them.
>
> I don't think you need a another new header.
> There is already vdso/page.h which is where PAGE_MASK comes from.
Yeah please don't, that's already a weird situation I don't really love the idea
of extending that.
mm_types.h seems the more appropriate place.
>
> -- David
>
> >
> > Thanks,
> > Yury
> >
>
Thanks, Lorenzo