Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9134767rwl; Wed, 11 Jan 2023 01:46:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXup0jSzRPd4gPzfYt/BRiB3RoPlKdh+MKVF17wr7SVQQgNOHExrxWHKcMB5du4S8TuflRiD X-Received: by 2002:a05:6a20:a59b:b0:b6:707:6544 with SMTP id bc27-20020a056a20a59b00b000b607076544mr7300540pzb.26.1673430377074; Wed, 11 Jan 2023 01:46:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673430377; cv=none; d=google.com; s=arc-20160816; b=DOWqlWX8mYiKW5dZdha8fZEtIXQbjINUaI5wReFokF3EYbK2fKk9LCb4e3ev6368XN qlfNga1j0PSdY4ZPneAqX7tzjSDc8xSDm4aicj9uL3WWh7ls5Bhoxm/UD3Vl9IwyHVsa s14aNLwQ+3Jt+n8FGZ7eOjLrOEngVsWasQi1AoogqIcemfNwWM/DB3ZR5zdLiLrvNW9q db1QqZ/N9iIsUrcXsiLudX3dSJeXO5vFxzmDHqSoB5CkXXcPx+VGn1dK5BH1d3Y8v1vQ xZgSTSvRfrc7GwjQinzUWf913HR/ER2AWDrD26jU75rlyQQdJ6FcA+JpqebHGLEpzRd7 7srg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lgxbe9iy/UIiGBDGt6X9MleqRSYp4HVx7CIEeTI4ufU=; b=CfPPefBo0UehHgtBeSCJdqbve9v0xzPr6F2njMaseHKOUquUFJQcQ5yuw0M+2u/ljL W6Zailew3WQdPpD35Eu1oCfNX25D5HsmMTejrvqDRuL2H1e8T6AEcLN+PYkU4g0dY+Hb U3tTdfHiH6XbBssQFiYZCIhQ+HMu1R0TNmbdkmQYW4+XDZN9V8mWtXfJwQp/w4Eso9k5 QGrf0quR5PxmSmXWGb1WDLi9ZBw4D4R/vQE06nSS9FobBRCkAu9WjfCt1tCu81WSJ/gL nGA90DF6ucFdi5XAGWLHYjyl7HXQ62/cBBVFDB1ib5U18nQS3mWH8Q9FM3wgKwsq7BpK B+2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="UEEhg/SX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c9-20020a655a89000000b004794a80d855si14424054pgt.708.2023.01.11.01.46.10; Wed, 11 Jan 2023 01:46:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="UEEhg/SX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232064AbjAKJmE (ORCPT + 53 others); Wed, 11 Jan 2023 04:42:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238350AbjAKJlK (ORCPT ); Wed, 11 Jan 2023 04:41:10 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17D0413CC1 for ; Wed, 11 Jan 2023 01:36:51 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id i65so7499713pfc.0 for ; Wed, 11 Jan 2023 01:36:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lgxbe9iy/UIiGBDGt6X9MleqRSYp4HVx7CIEeTI4ufU=; b=UEEhg/SX/TFPKsEVPlR4oEk9BfADyFg+Ym5uadlWJdA88dymfbQzGUqUcv53K8Ot9S LEp/mjVABk63mEPJWe6twp4CnQX4OOte386K/jBXBW+qze5DQcEfgSzLZ/tD+MpZLCWd 3Z0x67zTLBAUoSf5VT7ZcrdGrSuoNtT7m2M5H47O6pS+g9AyI13IGMhhYojTWkCETSLZ n2Us3htJCeH0cZhlEqifBRXkRUF4V6Dts9iPqfT8nTpIlGE8UKUraXaoI+cGizRUzwJ1 dSOfxS50WvQ/pM8Q3FZDdJ1BEw5ew9Fn5+8sSsQBoj5pFNOHC1BQhvjCoxFKy6SS8dqg w5Bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lgxbe9iy/UIiGBDGt6X9MleqRSYp4HVx7CIEeTI4ufU=; b=CJQAPysvEgj3HYbt1lyzQ40PnrZThswxoK+s7dy69iy6SZjF36e3+xe/XhJADptO0V 3L4whuZPg5oEGYaP/+5Djn9HTs32GJUSyFKRGtbHBUpQh4GzOYvjWXJeJvkjCLI3j2nV exgfBSm7gubxxr/LYtjjAiBdH8Stqoh9wfRz6xIYvEBZk4CNopYD9o4Y0cQYgHzuKFU4 nZb/6AZIcm+8WhnNEN8bSvEYWY/O+xVQ+w5a50sMdS+7nOwLQglEhuGgb86RMlNehE7x sbdKDLHTMnU3pDXunqfSaFwmh+sY+INFUFah3EUUnlKwYpAncbASoCrHWMVLONlqAAEv JNQQ== X-Gm-Message-State: AFqh2krRa1PuS+NfLyyWlCSqXpvQKzvpffYRNwSfnzNXCDS0siiMFGiv LG5JsRgFaX46gUsr88YQaII= X-Received: by 2002:a05:6a00:72a:b0:57d:56f1:6ae7 with SMTP id 10-20020a056a00072a00b0057d56f16ae7mr60870508pfm.33.1673429810487; Wed, 11 Jan 2023 01:36:50 -0800 (PST) Received: from localhost ([2400:8902::f03c:93ff:fe27:642a]) by smtp.gmail.com with ESMTPSA id z24-20020aa79498000000b005821db4fd84sm9536546pfk.131.2023.01.11.01.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 01:36:48 -0800 (PST) Date: Wed, 11 Jan 2023 09:36:44 +0000 From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: SeongJae Park Cc: akpm@linux-foundation.org, willy@infradead.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/sl{a,u}b: fix wrong usages of folio_page() for getting head pages Message-ID: References: <20230110005124.1609-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230110005124.1609-1-sj@kernel.org> X-Spam-Status: No, score=2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SBL_CSS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 10, 2023 at 12:51:24AM +0000, SeongJae Park wrote: > The standard idiom for getting head page of a given folio is > '&folio->page', but some are wrongly using 'folio_page(folio, 0)' for > the purpose. Fix those to use the idiom. > > Suggested-by: Matthew Wilcox > Signed-off-by: SeongJae Park > --- > mm/slab.c | 4 ++-- > mm/slub.c | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/slab.c b/mm/slab.c > index b77be9c6d6b1..a5398676dc60 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -1389,7 +1389,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab) > > BUG_ON(!folio_test_slab(folio)); > __slab_clear_pfmemalloc(slab); > - page_mapcount_reset(folio_page(folio, 0)); > + page_mapcount_reset(&folio->page); > folio->mapping = NULL; > /* Make the mapping reset visible before clearing the flag */ > smp_wmb(); > @@ -1398,7 +1398,7 @@ static void kmem_freepages(struct kmem_cache *cachep, struct slab *slab) > if (current->reclaim_state) > current->reclaim_state->reclaimed_slab += 1 << order; > unaccount_slab(slab, order, cachep); > - __free_pages(folio_page(folio, 0), order); > + __free_pages(&folio->page, order); > } > > static void kmem_rcu_free(struct rcu_head *head) > diff --git a/mm/slub.c b/mm/slub.c > index 67020074ecb4..d5f20c062004 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -2066,7 +2066,7 @@ static void __free_slab(struct kmem_cache *s, struct slab *slab) > if (current->reclaim_state) > current->reclaim_state->reclaimed_slab += pages; > unaccount_slab(slab, order, s); > - __free_pages(folio_page(folio, 0), order); > + __free_pages(&folio->page, order); > } > > static void rcu_free_slab(struct rcu_head *h) > -- > 2.25.1 > > Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thanks!