From patchwork Fri Jan 6 17:40:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13091657 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 240B0C54E76 for ; Fri, 6 Jan 2023 17:40:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B6511900002; Fri, 6 Jan 2023 12:40:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B130D8E0001; Fri, 6 Jan 2023 12:40:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DB8D900002; Fri, 6 Jan 2023 12:40:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 8BC938E0001 for ; Fri, 6 Jan 2023 12:40:44 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 699511C6069 for ; Fri, 6 Jan 2023 17:40:44 +0000 (UTC) X-FDA: 80325089208.21.41B0F56 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf27.hostedemail.com (Postfix) with ESMTP id D6C6040014 for ; Fri, 6 Jan 2023 17:40:42 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="I9KaEMH/"; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1673026843; 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:in-reply-to:references:references:dkim-signature; bh=8M3pePemNop1p6sYijcJO/XCyrdzmIZrQcfJdfBbni0=; b=QwXZih9qna3PqOBVpuH7WnFkqqEcwec7JU0EME0siCvs5cc2+qopjcuXEc377MU2G4fv9w rKJy9F/upnnwoaPIvakYgZffRoNaYD17kipd7fow0UjurmLiz0YWRLGxjSnzx2uotH83C2 wpvp6/L/2yfGRAKtunc9OG7VE7zGhSY= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="I9KaEMH/"; spf=pass (imf27.hostedemail.com: domain of sj@kernel.org designates 145.40.68.75 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=1673026843; a=rsa-sha256; cv=none; b=jPYjAjfE+NEKPjOKY+7dXxi0LLFuhOgKfXIy1e8Qjizsgw1XQXnJoIShFOotz9dCCR12l6 EE0ikrmhDpQGgTbWJg7oVvUDbbem4Yg2pvCz2rwD1wiu+oTSZS3iW8+6T1sb91KbNoZ1Tq XhWO51JdgHjGSx+6kq2C+O7IIvGporU= 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 6E32DB81E2D; Fri, 6 Jan 2023 17:40:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1883C433EF; Fri, 6 Jan 2023 17:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673026841; bh=lehRB+fMwqiaN+fsr24vSBnpbQfHVQHTL6mnxILFBts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I9KaEMH/AY3GqDnRRYPEJoBMGtwMgv+AjV6t5PTvgm/xPvax0GyXmcoFTaHIKYUjf E6+10Gx0Zsd3ZLs+NLFgwS6jfv3WprcOXJAUpeKODNOiYxXGlzbJ+5gtviSQ/zQ8o6 ut4slaiJsNbgznopHReIdiJCcNZwMTHrzgCk0fASbBaE85Is4fM5Jmhoz5/lK8fj1L TwD7ZQf+YCAL1yAuzJf4hVtWNxw6IZwiskQti0MUj3BdeQ9DYPAIe1NcZ8Kk8bWjH/ Uo5K3kBHkNHUZ4bFa8hnobyxxNGOl+jzr23GcfFp4lVDXzWA7KrH4BYXkilwLnG4C5 /AJpyeph2OkoA== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] include/linux/page-flags: add folio_headpage() Date: Fri, 6 Jan 2023 17:40:26 +0000 Message-Id: <20230106174028.151384-2-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230106174028.151384-1-sj@kernel.org> References: <20230106174028.151384-1-sj@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 1hq7zfb4ena14zqsuzty15dgosfi5gjd X-Rspam-User: X-Rspamd-Queue-Id: D6C6040014 X-Rspamd-Server: rspam06 X-HE-Tag: 1673026842-69514 X-HE-Meta: U2FsdGVkX18xemTlXMbkuOQjSDGyeJsBX59QL51Znoo5VgShVtfcukXu7r1kMakXSrNlS9SnxEXUXsEN8EQbQpghwlu7GcXTtY4pUoFu9kNBhM4p0+svX7YX4mBBqljigp8NjB0jA+BeG2+a6AXYhdf2KkveWOFE42qnU6PnOAnt9FnzV4aWv+WGCEHzFH217T+CQtjVhN7ppgeeQurmf7tjhzmxpdFrHV73IdlaNe5NMROkOAM65DpFDNe/q2A+fCaGrPiQE44TPeAfKhLlGwGtI9QYZKRIH0yBlYfUpNRAcJt/o2rV4RMKKfkkftYcYMEgMZ0kNRYKcOA1PZ58Bxqdau6D+OQZbUKjomTGAM1odmKCESt4v51Mhb4c6/cNgw59rW5R5N8EbebWE63m3nZqY8pR9lUEkRUgtvIY962Wwhqq9RNITdkfjXFMGSx4fW4NpIzr27bKEL3QVpd7LCW74uQ2bVBPji0GPNfCfIPfRQQvUjZUnBs+ClEPLra1JdYQcwXMoUNWjXfiST74ZU/op3HQwZWUJyWV170+o1NaawsBzZhfNSWgKlLuBLjWMjAqOpAm0m1VWYql5J9/HSdwfc/+ztFofbw/RfHnUkKReqQah2gpFO6VyQ0nyNRRCiBgsRDmYVqiBfySRNyYol3WDvfCx28YVNHjypmu55EwxK4oVey23dA9AIYu4cNnWGnBv8c+d8HTO01YOCTEaS9mIYCStK0vwiKorrNiti+a5c5MZLduhLCvO1HlOQkOB1FDrBPk5iK/OfTedH2x8oYv+yR0U4bLxyBs9apv+bIVAZFwZ20KoyLrBL93qqTO+l6ettMaXzmccQPDarthBq4jBt9k2ZZjkxx7dF7ap9MlYwCC7T1Fad6qF6BBNo1D4mjiAx1n4CVVMf655KKnpLaNQh4HU2yGwqWU6ofzUg1++q8G6nj67iG1smC8fHwhkf4P6aBzO4Qc4Z1Eaiz xp3xaTj2 ZAh5NuoQ4q8xhfAz660Fey47ZZNxX0hEOHswSFogkGeL/XHODBk+8sBxIIgfJGTw+5gIQaZBt9cdYfQB4gIGa/C5YKFWYqDEMpTQLsyFY50hLYWR+ahczcskYeA== 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'. It is efficient and safe even if the folio is NULL, because the offset of page field in folio is zero. However, it makes the code not that easy to understand at the first glance, especially the NULL safety. Also, sometimes people forget the idiom and use 'folio_page(folio, 0)' instead. To make it easier to read and remember, add a new macro function called 'folio_headpage()' with the NULL case explanation. Signed-off-by: SeongJae Park --- include/linux/page-flags.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 69e93a0c1277..5a22bd823a5d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -285,6 +285,14 @@ static inline unsigned long _compound_head(const struct page *page) */ #define folio_page(folio, n) nth_page(&(folio)->page, n) +/** + * folio_headpage - Return the head page from a folio. + * @folio: The pointer to the folio. + * + * Return: The head page of the folio, or NULL if the folio is NULL. + */ +#define folio_headpage(folio) (&(folio)->page) + static __always_inline int PageTail(struct page *page) { return READ_ONCE(page->compound_head) & 1 || page_is_fake_head(page); From patchwork Fri Jan 6 17:40:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13091658 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 6D613C3DA7A for ; Fri, 6 Jan 2023 17:40:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E22CE8E0001; Fri, 6 Jan 2023 12:40:45 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DD2F2900003; Fri, 6 Jan 2023 12:40:45 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C9A9E8E0005; Fri, 6 Jan 2023 12:40:45 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id B97758E0001 for ; Fri, 6 Jan 2023 12:40:45 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 98B6C140DE4 for ; Fri, 6 Jan 2023 17:40:45 +0000 (UTC) X-FDA: 80325089250.16.C5E2A65 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf12.hostedemail.com (Postfix) with ESMTP id 214AA40010 for ; Fri, 6 Jan 2023 17:40:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hlP6RQhZ; spf=pass (imf12.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=1673026844; a=rsa-sha256; cv=none; b=JV90yOZ1gVlVO8Jzb8+2n3hLMFOYGZVYa6KQBz3N22Ons3Qe/bO4nbDG7SPSSvNBJZB9RB FU436SawQkA83yvGvPtl5vySxh29HYDlJ7iGslJvgbtSejoq5rMESu3Ywd7DwW+z+dPaSM iXik4I/tLqy/fZwuRzgD5Q4l5V68Mek= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=hlP6RQhZ; spf=pass (imf12.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=1673026844; 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:in-reply-to:references:references:dkim-signature; bh=QteadmknC0nIRPLxsl8M6MmcVskVG7qETM0Rvot7ZAY=; b=W8bmthRhwvYfgLsRQbwE+JEebWRHIIzyn3j9qHmYdNelQd+gFDNSUPron+NxLNMohHLVNi LEGjOXxjTvAAoC7Zf1DunpJQrdFPGTE3j/N4qj9bvkrcHfsjoc4AFkpXbeD90R5mmajT/B 7ni93S3GlYfC5zsxnI3mEKfdGDQcc7U= 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 264AA61EC7; Fri, 6 Jan 2023 17:40:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27124C433F0; Fri, 6 Jan 2023 17:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673026842; bh=cHvb4Vehgiz+i9jP3UmTQ1hcTa3cMG0+RNH66KZZupg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hlP6RQhZERq4T5nw+s83wXPjEzQ1POOMyZB06pm0+LABO/jSGs600mUTQCYSN4fFz Dko/3tAdYvbpVuT5SpObb3AnmEdrUu0BUUDNhQC11D6+E1t2AJ7d4kj7PtwwbTWFW/ lwDnadWc6GT+89qA4JPg3Nm1BBOuY0MBIi1kdz1+LMODHH7pcDIZndVDLIVXMGB2cR qMRUsLddFzA8wCI1cxGJ7OPW0tdUXmV/n8OOIv4O6Y+vzlklCKglnb7CoyGHl5pTpy 0YFgFw3Qzb8YrEzAdzKQx15I0BVqJil4JIlLZpqs/YE4616rzUmhr2qF4jBO0ti+0p a5k51guE738/g== From: SeongJae Park To: Andrew Morton Cc: SeongJae Park , willy@infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm: use folio_headpage() instead of folio_page() Date: Fri, 6 Jan 2023 17:40:27 +0000 Message-Id: <20230106174028.151384-3-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230106174028.151384-1-sj@kernel.org> References: <20230106174028.151384-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 214AA40010 X-Rspamd-Server: rspam01 X-Stat-Signature: 51sqozjp86z7s8ojarmj8cf7txc1yzr6 X-HE-Tag: 1673026843-316204 X-HE-Meta: U2FsdGVkX18BMYtLzF6VfTg7FCnO1WFb4e53VSuNrCEcCew2J7K1AFwATDFL5BUqtcO+LbQJJsSNvYbCxMONGWylw8vuBGbkFA3TntM7taLl/87kF7VbkU5X15TBd27qYZ6JW1lwUnzlSAr2tA50HYEiznWVNt+qRVGdDKUEYDT8X21G7YcFGSTA3uSxFu1KIFyly/lmqf+VrOqQS5+5jZAzspR3yqU74HNf683vJdKkeVSu4NHlp02JyqZg5chzXG7CqVh7OZclb7CcZ/Plw6lDGRW3Q4jV3YtS6ghPEhaDeHNoiYtAEwZETrV+PgRik8Ft1cZsADWBYjy1tSSJxDkjVFwQRU6IQCtpH6KPp2TpG+3aVqS11FASrTciu3PpLT+0QMWJNez2f9UinxRdW1SqNGEM/U5QjEwBODmIybUtSbEYFawj+lDXQNdZZl7sZMnK1I38pdNoMSCaJ6amaK2WeALCXFlY4frlHD+MdrIJf94CmS/xd4CcidT84atYVGqVHVlCAbAn9Q6/HhQhnZyQ61FwCU1gF9M5a2U/CSNWL7zOHtu+OUAckm9FJNyMf1Kzuc5S7nMTsgRyXeC8WbToXh8dfUH+Q6F827OSb1cMYjJkdVBHcUdBlsr3k+xwAL4T5kMSd9blxP7vwnZsGwYRmMAL1b/6mCBs3Gcjj5l3bM5psi6G3uRXOwDC1JWE0aeORPCraSc10u6leJgb+qg561z/sc+NO9t+6XR7AOgKb/ToMVU64raUHAd4QG0cg0uxslOqDQIh3NjUYajNeyI+UVLILo3TyFv3l6ul9WIOEv2kr/VJyPulMnoBtqrEoiW931iF8ANHSSgsg3HJT/i+UMeo46C0SKsSZmAtsQr5/mpdOvSJi3YJsti95coHWPl0bqIyVsW8Ze08lsGQv/OWGU568MaOowaVAO6Yb10ml2T2U6glgHF4HHBP09IL2GjdIAvx7Ctdd2vsswr MXMS2g1r j50O7/B150nkI5OFBGHdd1Qchlul4ZiDYaz+u51To3uZyyGzDntL4CSkYYTux5CJUm+b8GvBr3yQk9b9Tbk7RPfaqJwhx+4FaUAEEoAh6X7N14uWjR+DyDTyx+Q== 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: Several code in mm is using 'folio_page(folio, 0)' for getting the head pages of folios. It's not the standard idiom and inefficient. Replace the calls to 'folio_headpage()'. Signed-off-by: SeongJae Park --- mm/shmem.c | 4 ++-- mm/slab.c | 6 +++--- mm/slab_common.c | 4 ++-- mm/slub.c | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index bc5c156ef470..8ae73973a7fc 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -3211,7 +3211,7 @@ static const char *shmem_get_link(struct dentry *dentry, folio = filemap_get_folio(inode->i_mapping, 0); if (!folio) return ERR_PTR(-ECHILD); - if (PageHWPoison(folio_page(folio, 0)) || + if (PageHWPoison(folio_headpage(folio)) || !folio_test_uptodate(folio)) { folio_put(folio); return ERR_PTR(-ECHILD); @@ -3222,7 +3222,7 @@ static const char *shmem_get_link(struct dentry *dentry, return ERR_PTR(error); if (!folio) return ERR_PTR(-ECHILD); - if (PageHWPoison(folio_page(folio, 0))) { + if (PageHWPoison(folio_headpage(folio))) { folio_unlock(folio); folio_put(folio); return ERR_PTR(-ECHILD); diff --git a/mm/slab.c b/mm/slab.c index 7a269db050ee..a6f8f95678c9 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -1373,7 +1373,7 @@ static struct slab *kmem_getpages(struct kmem_cache *cachep, gfp_t flags, /* Make the flag visible before any changes to folio->mapping */ smp_wmb(); /* Record if ALLOC_NO_WATERMARKS was set when allocating the slab */ - if (sk_memalloc_socks() && page_is_pfmemalloc(folio_page(folio, 0))) + if (sk_memalloc_socks() && page_is_pfmemalloc(folio_headpage(folio))) slab_set_pfmemalloc(slab); return slab; @@ -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_headpage(folio)); 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_headpage(folio), order); } static void kmem_rcu_free(struct rcu_head *head) diff --git a/mm/slab_common.c b/mm/slab_common.c index bf4e777cfe90..34a0b9988d12 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -939,9 +939,9 @@ void free_large_kmalloc(struct folio *folio, void *object) kasan_kfree_large(object); kmsan_kfree_large(object); - mod_lruvec_page_state(folio_page(folio, 0), NR_SLAB_UNRECLAIMABLE_B, + mod_lruvec_page_state(folio_headpage(folio), NR_SLAB_UNRECLAIMABLE_B, -(PAGE_SIZE << order)); - __free_pages(folio_page(folio, 0), order); + __free_pages(folio_headpage(folio), order); } static void *__kmalloc_large_node(size_t size, gfp_t flags, int node); diff --git a/mm/slub.c b/mm/slub.c index 13459c69095a..1f0cbb4c2288 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -1859,7 +1859,7 @@ static inline struct slab *alloc_slab_page(gfp_t flags, int node, __folio_set_slab(folio); /* Make the flag visible before any changes to folio->mapping */ smp_wmb(); - if (page_is_pfmemalloc(folio_page(folio, 0))) + if (page_is_pfmemalloc(folio_headpage(folio))) slab_set_pfmemalloc(slab); return slab; @@ -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_headpage(folio), order); } static void rcu_free_slab(struct rcu_head *h) From patchwork Fri Jan 6 17:40:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SeongJae Park X-Patchwork-Id: 13091659 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 CF95DC54E76 for ; Fri, 6 Jan 2023 17:40:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 743EC900004; Fri, 6 Jan 2023 12:40:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F474900003; Fri, 6 Jan 2023 12:40:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5BC2F900004; Fri, 6 Jan 2023 12:40:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 4D291900003 for ; Fri, 6 Jan 2023 12:40:52 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 28A48AB553 for ; Fri, 6 Jan 2023 17:40:52 +0000 (UTC) X-FDA: 80325089544.12.69C7091 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by imf22.hostedemail.com (Postfix) with ESMTP id 3CD39C0010 for ; Fri, 6 Jan 2023 17:40:49 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z6cyH5ZR; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673026850; 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:in-reply-to:references:references:dkim-signature; bh=Vckh/baVijnw/DvNkiAv9tifnlBZNg8TETdc+1Cau7E=; b=2yyXRgA7w4DTIM8epvFVbhobiLWXi9wWXPt4tQzqJe/8GckgiMEFh5g7RV42A/M66TuS0m TYfZ9DU989Enm31vdg5QJ8S1XspVPmh7ULHEJlCcgqKTAOZTxbknQXFTO92nQMOAW0j9qF 6wG9ZX1Ec6FRiF43oTz9IeqklzVUkNo= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Z6cyH5ZR; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf22.hostedemail.com: domain of sj@kernel.org designates 145.40.73.55 as permitted sender) smtp.mailfrom=sj@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673026850; a=rsa-sha256; cv=none; b=5fcgfS0L1AQgVijF3N7YBnhNM4CgVXPqRPihHBAriTtbCQ6+NpIXrnhBLSbZYQDFpnXdd5 6luqOcFySyZnSRCqpmfC+HtM4twY5P2JBrbR6uHnu+fJAILYaE3Szfbez9xUuyymTPmehC krgoOcBK46FJhaQdSGPaxs9UGdQGiU8= 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 sin.source.kernel.org (Postfix) with ESMTPS id 011C7CE1DB2; Fri, 6 Jan 2023 17:40:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F76BC433F1; Fri, 6 Jan 2023 17:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673026844; bh=YZZNY9dRwSGWCR6rI1dKx/9bpURDl+Gj2lOCqnQv91U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z6cyH5ZRauWxvfPORXoj+wOKxhm88QKwFJtkWNBMkZG3gI46FE91EyPqpwZKjrILS RgdcJG33HPg9cJHPy5eKKnjHWSKUFivP4YcQ4jZh5OFHyNvVMBPDYXP+JeOBde+1m2 Fhm7tKt4vQzjz1SEA8qQC32e+xF1RT1RngZPn80xzlR9cVkGZfdBKGoetCf2G6DF2i LXTwHWSLFbVDXuWTGf9J0WhubYpgHsqgVMo/4LH4Y+sGSrMCLFnwVW+dP2y6pS+joo EUjIaeme/J9pRRgLp3DDGE/0ygpmlNaOd6dGmBO34HShJ9efDfVSf2OiapQSu3LKmX jKdEAcoM+lVqA== From: SeongJae Park To: Andrew Morton Cc: willy@infradead.org, Xiubo Li , Ilya Dryomov , Jeff Layton , ceph-devel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, SeongJae Park Subject: [PATCH 3/3] fs/ceph/addr: use folio_headpage() instead of folio_page() Date: Fri, 6 Jan 2023 17:40:28 +0000 Message-Id: <20230106174028.151384-4-sj@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230106174028.151384-1-sj@kernel.org> References: <20230106174028.151384-1-sj@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3CD39C0010 X-Stat-Signature: mjxpqkcnp4i48azsh6yxybrjesuz9smz X-HE-Tag: 1673026849-784633 X-HE-Meta: U2FsdGVkX1/RWF899+0dn/E1uBcp2pYuWj8z2WiMQz7stPSuKs6jYWxDw9+ptZg/wlMBbULjr0EOKFhAq70OBUDwnRZnb5v4QytxiJOuRMo1Ppc2z0w6gS7f3D9+2UO0BeR2rCXb04/fwkIs4Pniu2URql3LujVRe2HpUkJESie404fcfUWyhZZhA/WGVniA/72bVxHuCcKjBEoVvUGPmEDz/P8jlUNlsBjB8o/amc05XJtLyQ36P1iZoBdJjqHkWbc3ONWml0FLYQzHZ2FW1U1tq6+qzHi+TmGzgFd61B3xwb32gjG0iMushGfKCwKFPwhD6/2RfSniQELCzzRQFHkwOLF+49EbV5eLhd7iFxks8qMATsP3Bn8UIsz+CcW3U3pikyfEvGho3tg0E8LZt19jMFrUZ58oV9w48Mw8a4/VOSsosu5A2/Zyis/YMuZFXOXnj1Q4TtGzrKdL9BMR00urj2629zIhf2/tm41qBqxToHG48PaYijtHL22IR5zcDmR2vcKP3Nj7fNChHiJFEmaXVaeyo8dU/RlYSuzGoFC8h3Wp5Ie5WMarGMckTsVYYEfnzW1kPWQpexlKJ3+Wclv2UxyWHz1AKlkFPE4/Pa60Mgw3tgeHg4u0UZ33TekEeulZ5DOR5WFIgMEc+q1kqew0tXrdFL55j1lFXv8s1wqrTck53g0SoaGWjljGfk5nZrdFW/30ZFNjWX5Upe4wfYTpnpuBSI8yc2lYoDEDSrnbP6YVvLSRCtgdesCgUBR0JO/y6wZAyTjiTNuy7KVBzsag7we5VW6mKhrRHbHpt021XxbzUHGwi/KWC6xJtQVlT0zzTb89gXUJcacZYk7E0lvrMwTxdA18+Tq2lWLADQTuJrucBxJWGA+/PnxlrSTnVrvJY46I3n/vJubzXO8eHx3uzTkY1bCn40WR5lz6CegBER/fWgJC1rbS0sfKQf72jASPVvLEnVvZ4poJsHb QoA2cpF9 RCbrf2CGhNd9t4XY2ZjzAkevX+eGFAW45CJoEvYst0qjhMOXrRmo25Pm9uPMfQDwFxrKj0/64rpQ6AtbPQwv/6k+bO9JdTq63Ln/4Ckzu4rPg9Sx5S+OViKgHRA== 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: Using 'folio_page(folio, 0)' for getting the head page of a folios is not the standard idiom and inefficient. Replace the call in fs/ceph/ to 'folio_headpage()'. Signed-off-by: SeongJae Park --- fs/ceph/addr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 8c74871e37c9..b76e94152b21 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1290,7 +1290,7 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned struct ceph_inode_info *ci = ceph_inode(inode); struct ceph_snap_context *snapc; - snapc = ceph_find_incompatible(folio_page(*foliop, 0)); + snapc = ceph_find_incompatible(folio_headpage(*foliop)); if (snapc) { int r;