[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2104210912150.52601@gentwo.de>
Date: Wed, 21 Apr 2021 09:20:41 +0200 (CEST)
From: Christoph Lameter <cl@...two.de>
To: Matthew Wilcox <willy@...radead.org>
cc: Yejune Deng <yejune.deng@...il.com>, penberg@...nel.org,
rientjes@...gle.com, iamjoonsoo.kim@....com,
akpm@...ux-foundation.org, vbabka@...e.cz, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/slab.c: use 'ac' from the caller
On Wed, 21 Apr 2021, Matthew Wilcox wrote:
> On Wed, Apr 21, 2021 at 10:25:17AM +0800, Yejune Deng wrote:
> > @@ -3045,12 +3044,7 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)
> > }
> >
> > STATS_INC_ALLOCMISS(cachep);
> > - objp = cache_alloc_refill(cachep, flags);
> > - /*
> > - * the 'ac' may be updated by cache_alloc_refill(),
> > - * and kmemleak_erase() requires its correct value.
> > - */
> > - ac = cpu_cache_get(cachep);
> > + objp = cache_alloc_refill(cachep, ac, flags);
>
> I think passing 'ac' in is fine (probably? I don't know this code
> deeply), but deleting this call to 'ac' is clearly wrong. The comment
> even tells you that! I just verified the code, and the comment is
> correct.
Yep the delete of the ac assignment is wrong.
But even without that issue: There is no point to passing ac to
cache_alloc_refill since cpu_cache_get is rather trivial and does not
even require memory access since "cachep" is usually in some register.
Powered by blists - more mailing lists