From patchwork Tue Jan 10 00:51:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 41240 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2472024wrt; Mon, 9 Jan 2023 17:00:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtK7NwAfrEDiQ8SPnTZohfjD2jyJ0rY7X80+lq/6xuYb5UdaZ2ts7X3ApHfB0OEVWxl7OPE X-Received: by 2002:a05:6a20:d398:b0:ac:1265:d5bb with SMTP id iq24-20020a056a20d39800b000ac1265d5bbmr84108870pzb.49.1673312434494; Mon, 09 Jan 2023 17:00:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673312434; cv=none; d=google.com; s=arc-20160816; b=A9DKuM/HRSWVc5hzbcpTrij8++9VwL0pmCtbeeAFahRHgsgmi0OwrO85Q6+T9RaeOo c160AShbSeWxcZKTosx3hJbX0JwFgaOg7LzfZD1zSbFvoECQOK+4kMVsytaCc4F0HNoh r4u1TvILLh9uYBPmuMTy8adTv5Q8mDYza5FpB9ZsXGJY3OzUTfpZtX9PpfD7Y72aYX9v G67Ff+nFZKH2m++cEFYv/5GchIiIXuSTyJ7A3uu66MObTMOgIkKCFFzlpHwdxmwhW8mf BF7mbNa5ZvQFpC3P6tSvEjTM4yXSwwHaTp6VVCd3AYMj2NLnmrZi5OekCtuagazOY7Aj 9qHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pttkzNmMTHgNhxy4QH4IETsQVMdemHYa+70YzJ/glOs=; b=MAOJr/WJs7OHn+V2qNTW0kdNohbkrzC3JNr4oqKNdXw0TdGtT/1dG4FI8GMZBi59gg /YOTe3OCZdeNz9x2alVeVqndciOjvdSVTCpWkaq89qjK3KyjpKN0rFfTfltbNw6/FT5F 6gaU40HUNk7WMnjR5wV3YvjW2JbdIuvvLyoRDq1o6uPLVRVXzQ/PSA4v4TGVUyNGoCxn Nrlv0C0J31CxynZABCWa0IK4yCXuaWaqjZ5DLyqdJW8KLy1QbJ5H45gPpiPLjmNmJ8Qx 8HAID4Vb2WnX+iBwnDmmd1osdfwjzNgZf6k0viC1K4L2bVP08cPdujap7YkxoiNjVh1D cecw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Y9RgmVvd; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a63fb4e000000b00476c770e17asi10081986pgj.764.2023.01.09.17.00.21; Mon, 09 Jan 2023 17:00:34 -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=@kernel.org header.s=k20201202 header.b=Y9RgmVvd; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235352AbjAJAvh (ORCPT + 99 others); Mon, 9 Jan 2023 19:51:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234501AbjAJAvf (ORCPT ); Mon, 9 Jan 2023 19:51:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E57C13CD2 for ; Mon, 9 Jan 2023 16:51:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43E83B810A9 for ; Tue, 10 Jan 2023 00:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7739BC433F1; Tue, 10 Jan 2023 00:51:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673311890; bh=ZkD0zLt3wxTu9MwbivHD8pT3t6f3+LNZvwgPZbqLBYM=; h=From:To:Cc:Subject:Date:From; b=Y9RgmVvdGN+ViiTiOtKeeaNygTZ+LsDQPcm0/ew54Q3xDbePInVwH59ia8m889q6n 9/UPQNU975cWluN5bdR9uNEWP7baKHQNRYeK8Kt7jlG3IjARfpyIjJ/FRooPCZIt02 D5gokeG4Ev8T0ci/eeY+c/TQwmjk+orVMU9RK/aCwxOjtseDdlxsFnwuy8ObDDLhnh KJXQQGLTSlJrp+Z4eYiOjcFoSNDAHEVC6tZx7Y4uTXkISY7G5S5JP6BQ4kkkzABZ2N 68mF0HJgCtL2g5gohnewrmfJyjJOkdZLmu1Bn3cwj9hjx+W2wK0EdvSTRH659OLx+j MYr582FjKWzbA== From: SeongJae Park To: akpm@linux-foundation.org Cc: willy@infradead.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH] mm/sl{a,u}b: fix wrong usages of folio_page() for getting head pages Date: Tue, 10 Jan 2023 00:51:24 +0000 Message-Id: <20230110005124.1609-1-sj@kernel.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754595259217357062?= X-GMAIL-MSGID: =?utf-8?q?1754595259217357062?= 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 Reviewed-by: David Hildenbrand Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- 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)