From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87FE7C43461 for ; Wed, 21 Apr 2021 07:20:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D94EF61004 for ; Wed, 21 Apr 2021 07:20:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D94EF61004 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=gentwo.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 559696B006C; Wed, 21 Apr 2021 03:20:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 509DE6B006E; Wed, 21 Apr 2021 03:20:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D1E56B0070; Wed, 21 Apr 2021 03:20:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0094.hostedemail.com [216.40.44.94]) by kanga.kvack.org (Postfix) with ESMTP id 2053F6B006C for ; Wed, 21 Apr 2021 03:20:44 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D53C7181AEF30 for ; Wed, 21 Apr 2021 07:20:43 +0000 (UTC) X-FDA: 78055526766.34.E02561D Received: from gentwo.de (vmi485042.contaboserver.net [161.97.139.209]) by imf30.hostedemail.com (Postfix) with ESMTP id 47AA6E00011D for ; Wed, 21 Apr 2021 07:20:28 +0000 (UTC) Received: by gentwo.de (Postfix, from userid 1001) id 2C307B007AA; Wed, 21 Apr 2021 09:20:41 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by gentwo.de (Postfix) with ESMTP id 29B13B0035D; Wed, 21 Apr 2021 09:20:41 +0200 (CEST) Date: Wed, 21 Apr 2021 09:20:41 +0200 (CEST) From: Christoph Lameter To: Matthew Wilcox cc: Yejune Deng , 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 In-Reply-To: <20210421031019.GF3596236@casper.infradead.org> Message-ID: References: <20210421022518.67451-1-yejune.deng@gmail.com> <20210421031019.GF3596236@casper.infradead.org> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 47AA6E00011D X-Stat-Signature: mc4xhtd5qyq4a6x4dcbrepyhy3osbrfu Received-SPF: none (gentwo.de>: No applicable sender policy available) receiver=imf30; identity=mailfrom; envelope-from=""; helo=gentwo.de; client-ip=161.97.139.209 X-HE-DKIM-Result: none/none X-HE-Tag: 1618989628-658622 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000002, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.