[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZpkARwEkp70YMVzf@pollux>
Date: Thu, 18 Jul 2024 13:45:11 +0200
From: Danilo Krummrich <dakr@...nel.org>
To: Christoph Hellwig <hch@...radead.org>
Cc: cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
iamjoonsoo.kim@....com, akpm@...ux-foundation.org, vbabka@...e.cz,
roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, urezki@...il.com,
kees@...nel.org, ojeda@...nel.org, wedsonaf@...il.com,
mhocko@...nel.org, mpe@...erman.id.au, chandan.babu@...cle.com,
christian.koenig@....com, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH 2/2] mm: kvmalloc: align kvrealloc() with krealloc()
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.
Powered by blists - more mailing lists