From: Christoph Lameter <cl@gentwo.de>
To: Matthew Wilcox <willy@infradead.org>
Cc: Yejune Deng <yejune.deng@gmail.com>,
penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/slab.c: use 'ac' from the caller
Date: Wed, 21 Apr 2021 09:20:41 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.22.394.2104210912150.52601@gentwo.de> (raw)
In-Reply-To: <20210421031019.GF3596236@casper.infradead.org>
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.
prev parent reply other threads:[~2021-04-21 7:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-21 2:25 Yejune Deng
2021-04-21 3:10 ` Matthew Wilcox
2021-04-21 7:20 ` Christoph Lameter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.22.394.2104210912150.52601@gentwo.de \
--to=cl@gentwo.de \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=penberg@kernel.org \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--cc=yejune.deng@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox