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

From: Lorenzo Stoakes

Date: Mon May 18 2026 - 06:28:08 EST


Why is this a separate commit? It's tiny, I don't think it needs to be separated
at all.

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.

This is a totally useless commit message. Again you're not indicating why it's
needed. Please look around mm to get a sense of how commit messages should look.

Also it's so common that you have exactly zero callers updated here or
elsewhere?

I see uses which are all pretty specific. I wonder if it's really useful to make
this its own thing?

And it's untyped and etc. etc. yeah, it's a no really to this.

>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

Was there a previous discussion that led to this series? You should really give
some background somewhere (like a cover letter, and if previous revisions were
sent, a history of them below the ---)

> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>

Again I'm really unconvinced you need to do any of this.

> ---
> 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)

I mean another thing about this (and yes this was existing but since you're
proposing making this rather special it's worth raising) is that it's enormously
un-typesafe and 'p' is vague, what if somebody put a (struct page *) here?

It'd be better if it was a static inline function, maybe there's places which
use this already that require it to be a macro but perhaps not.

> +#define bytes_to_page_end(p) (PAGE_SIZE - offset_in_page(p))

Here, since, you're adding it, there's no excuse at all for it being a
macro. And you're implementing something just as horribly vague as the other
form, it's not obvious 'p' is meant to be a pointer. Page begins with p too :)

Anyway I'm not really convinced this is useful.

>
> #endif /* _LINUX_PAGE_HELPERS_H */

Thanks, Lorenzo