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: 13094553 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E09B2C54EBD for ; Tue, 10 Jan 2023 00:51:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D61D900005; Mon, 9 Jan 2023 19:51:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 785868E0001; Mon, 9 Jan 2023 19:51:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67575900005; Mon, 9 Jan 2023 19:51:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 574038E0001 for ; Mon, 9 Jan 2023 19:51:33 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 24D30141AF4 for ; Tue, 10 Jan 2023 00:51:33 +0000 (UTC) X-FDA: 80337061266.21.031C25B Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf07.hostedemail.com (Postfix) with ESMTP id AC25B4000C for ; Tue, 10 Jan 2023 00:51:31 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y9RgmVvd; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673311891; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=pttkzNmMTHgNhxy4QH4IETsQVMdemHYa+70YzJ/glOs=; b=7WXjnRK7fVJh47SN68xJ5TAtkz9D7/73yvAtYGxxdqEFKNNv0o4pUK6FOAGwOwWydjyeyu MF1dn7K5+4CPpdLdpfwhgp2CXQL7Olih6zKkGa0Ut8kNrmaYCmiE9xlmTO5dcTfu/lcLev 0Hltz9WpdaTpTSohnNwJhHH32jUSEKE= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Y9RgmVvd; spf=pass (imf07.hostedemail.com: domain of sj@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=sj@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673311891; a=rsa-sha256; cv=none; b=JqAqAa8rt85YLJmxcgxOvzfeWydGy66TiYYuJVGMAydiJW8mA/ujwwAnnUbH6S6mpXri6T CSEjqfE465HMViihrq9iJNUKgwcQA2T6Vb4J/Mb0C2IQu4+8kd3G+MP1D+RRLPEAYvwp8i DFDZxmGJHV03rMYqYKwl5ZLVcJr/2ME= 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 dfw.source.kernel.org (Postfix) with ESMTPS id B328E60C6B; Tue, 10 Jan 2023 00:51:30 +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-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: AC25B4000C X-Stat-Signature: tez58sgawe6opua71gg95u45ixnwx3iu X-Rspam-User: X-HE-Tag: 1673311891-307666 X-HE-Meta: U2FsdGVkX1/eb8nTZBMDJ58xL3VdR37z+LkdBtRat5IbI9Y8JeTtc0POFYzhyRU0iO2TabJD6dRWJnJTDGwVR1J+v+N64g6BO5nHzQ/QL3hAXR064jORQyLtWP4HcCNATLX/CvI3c73G6zrdu3IZGJkm4Y/48xbBCKunCKSSj8SH6fskeaHUFCf8u87/ivbjtq4rT3zZ+HrAOhsgN0EOVNYXdl8eNMu4LPRvDF0j6zvxWBDXTfCtlsWR0QdWDsg2GHMZBGO9vSaS2vJyzh/BmIg+A8/Tx7opopSND73M9kdZQPKfUyhSNOIijN5936c//oI2e+FuoXYiwitS8RmbRpkaqNzBt/z39fVsfVdk+Wl6LifRjxZ9wI5HUdOrs4EI8cl/i0560rrmrJPrpWMnrjQodA3/aDdiGqj2UJUMAIPfK2sk0fFfJn29dqrXKK5K4SV53cghyZLVKubzVgH/sMx79JmsNcJdVLzls4FvLWG+oktirlkfRbyZFzvhJl8zbWAGnWsngm1NoLjHUcvDi5cpIiNSf8vlpfwsP7bd7pooZR6l2inahkJqL9d6xvhkDsoxZqEtdOrH6L2AKf1JJJmuXooeBxzvXNM8j//hbOk9zIBu+O6qn/OnmWBwVanCfeC3OJTO3wWB7Rtg0Y1FPof4uHX9O95gpKaga/4d/nDdVnpJzsWugtRwybgME60VHN1f1yG9M6QXkeKm0HGXd92N7QEUEVjBQ7ZNy58enmH/oiCy1cbmoK0UVRcWH8dXIM0Cv+bZzXRorhw8ejWt1RK8ElyRJVqgKeuxr0kr5aX4gXqjFGlF7c9foPhI2TB5T9kNH4YNRl4VM/y5/WeXhaDFIOj9Uu1eFbLPXzvEMyLlN34IuYBIr4VyR+mBaUjv/RuojxqWE8facQosNGTjo6wRWvDJ7AzgyVKO25N9/1lQHvXyBIRMy9xdjKu3IfRFZ5sGmVSy9jf1nt9vF/U DkEeQfeA JfE56QaK5am2YoUinDIXxPE9TsGyQMxvk4D6HGtjpDHr0FMaSkXka0eiB1UJmGLf8osedd0ggVdrE9iOdDpMc0ykJ3EfvDDspMiPqgyKYv2vQYkyAf6NcdpqUeg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)