Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp240606pxy; Wed, 21 Apr 2021 01:41:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTysAqRLEcJ22lr+XERVYv4xPi6kecc1SSsLTwvUyCbmjB/zt6CVmuF149P1gv5lhpXzWw X-Received: by 2002:a17:906:8a79:: with SMTP id hy25mr32041192ejc.461.1618994484570; Wed, 21 Apr 2021 01:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618994484; cv=none; d=google.com; s=arc-20160816; b=JLWPabQSMROiMsDiFu2DFNfMGMQ/X1u5qYmIl+o6VnYJkiVnPtkHo0cd9/xy8K5ZIB iYQSa4uRVCHmjzEk668wvpl4tR1q8agaoAYVtDrMYgB9hWjcAkyy4Y8rQ34TquZ79bFG VAePiD+dymipuMwn8Igu5l+w6XEq+ivTbKL85oF1kEmMrJp2i9pkyPpwhbb3eEdKjPNo 1RgphSW1hXA3l0h7dceOHAzHeiwg3+8Gccg4er7pZzbOY90DAMQi5F/1gcE5NBbUxDtF PjWoqOjjyjxTuhGNiIoZkUWhWihXj4NiuXidsvnXBxtnEFrGSGPbUOZlV1PhBRBot4bT WAdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=hCoDzYseTFDLWNBxpWoX1pkvUCw22Y2ia8r7+1ptdjI=; b=iAZDzlYXGZI2lsCuSlD6nOOqcyfd9BZl1+e6z3p461g4mUSVoid/Y3vWJaae3W2y0+ ocJ6YOBY/tZY+jesp2vmEG6fwUPhLzVBHid0oTdGpJ7Bp4IZpb99yXffMeGCU4/dPyDu agf2IvVZMaQDZJNm/qhJM+lZXHU5JLLdy0ivNgffSnYTmSnExDdaU16zrRE354YduLyQ JQLWoFGUoQv0GG/BcGp5p6jJBLyuxCxYbn/Z8u3huMODDpVE9VfhcSuiidKkKrlYhsSX jaR3H0nvOvnriHLDR+Ue3r7jbtFcxRRfjfgwS1TKP5kF0MWr32ciu38xwKnbms1pjsVE Tphw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q9si1519257edd.324.2021.04.21.01.41.01; Wed, 21 Apr 2021 01:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236780AbhDUHVR (ORCPT + 99 others); Wed, 21 Apr 2021 03:21:17 -0400 Received: from vmi485042.contaboserver.net ([161.97.139.209]:52460 "EHLO gentwo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236733AbhDUHVQ (ORCPT ); Wed, 21 Apr 2021 03:21:16 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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.