[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zp_8Eo4AuoZOfuZ8@tiehlicka>
Date: Tue, 23 Jul 2024 20:53:06 +0200
From: Michal Hocko <mhocko@...e.com>
To: Danilo Krummrich <dakr@...nel.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,
hch@...radead.org, kees@...nel.org, ojeda@...nel.org,
wedsonaf@...il.com, mpe@...erman.id.au, chandan.babu@...cle.com,
christian.koenig@....com, maz@...nel.org, oliver.upton@...ux.dev,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v2 2/2] mm: kvmalloc: align kvrealloc() with krealloc()
On Tue 23-07-24 15:33:32, Danilo Krummrich wrote:
> On Tue, Jul 23, 2024 at 02:12:23PM +0200, Michal Hocko wrote:
> > On Tue 23-07-24 13:55:48, Danilo Krummrich wrote:
[...]
> > void *kvrealloc_noprof(const void *p, size_t size, gfp_t flags)
> > {
> > void *newp;
> >
> > if (!size && p) {
> > kvfree(p);
> > return NULL;
> > }
> >
> > if (!is_vmalloc_addr(p))
> > newp = krealloc_noprof(p, size, kmalloc_gfp_adjust(flags, size));
> >
> > if (newp)
> > return newp;
> >
> > return vrealloc_noprof(p, size, flags);
> > }
> > EXPORT_SYMBOL(kvrealloc_noprof);
>
> This looks weird. The fact that you're passing p to vrealloc_noprof() if
> krealloc_noprof() fails, implies that vrealloc_noprof() must be able to deal
> with pointers to kmalloc'd memory.
You are right I have oversimplified this. I was hoping to follow
kvmalloc model with a clear fallback and that should be possible but it
would require more changes. Scratch that.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists