Re: [PATCH 2/2] mm: kvmalloc: align kvrealloc() with krealloc()

Danilo Krummrich
2024-07-18T11:45:18Z

On Wed, Jul 17, 2024 at 08:19:26PM -0700, Christoph Hellwig wrote:
> > +extern void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags) __realloc_size(2);
>
> Please drop the extern while you're at it and move the __realloc_size
> attribute to a separate line.

Will do.

>
> > +static gfp_t to_kmalloc_flags(gfp_t flags, size_t size)
> > +{
> > + if (size > PAGE_SIZE) {
> > + flags |= __GFP_NOWARN;
> > +
> > + if (!(flags & __GFP_RETRY_MAYFAIL))
> > + flags |= __GFP_NORETRY;
> > +
> > + /* nofail semantic is implemented by the vmalloc fallback */
> > + flags &= ~__GFP_NOFAIL;
> > + }
> > +
> > + return flags;
>
> The name for this function sounds a bit odd. Maybe kmalloc_gfp_adjust
> instead? Also the comment explaining these flags tweaks should move
> from the caller to this function.

kmalloc_gfp_adjust() sounds good to me. I will rename it and move the comment
up.