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: 40216 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp945844wrt; Fri, 6 Jan 2023 09:46:39 -0800 (PST) X-Google-Smtp-Source: AMrXdXu6fLNpWtYJZ2WTD/bzfgYXnDtaCfvP5BKX9KtaHXQUloy2up5KafADGXOmMmRb6+p6sMbC X-Received: by 2002:a05:6402:33a:b0:46b:b750:3d2e with SMTP id q26-20020a056402033a00b0046bb7503d2emr47420611edw.26.1673027199191; Fri, 06 Jan 2023 09:46:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673027199; cv=none; d=google.com; s=arc-20160816; b=FxBfKIX6rJsbHSy+X2rnPpyVts5xP/n/9pP2a0qQNwNbXG/3/UPIKZ0u/VYVNPKi1r ysYAa6SQr+V0FODIkjfsH2sF5JyJd53J3yZSuq2v8IGyBHp3HRyhBnI3WQN0Bgn8ExLF yN/Oepyuw6MwKbW5YbLCz/6g7cKQRDzAbbB5/P89yzFxac8RAQ8n12wJiFYjglUwqdfK Gitn+y6douC53awFNVODFcG7FSp09UrF49AaTXNPb71gr4qG00CZb+TR0O22s4lroHr/ 6i5EWOW6mAqpVIz2nY6ZywYbAd0uN0uwof4jtNXUAyJOx3DLnYN9D8qeGjgjMlaYqyT0 rdLA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8M3pePemNop1p6sYijcJO/XCyrdzmIZrQcfJdfBbni0=; b=wQYLuZdqoylo+gsgMdLywU3hryVuwbOhBJXOLDNRACVQwWmPF2vNb3e46RU7CR5Dk6 QgT0pwqsm6qe1tB3E+AlOGNLAJtuGR7mfyzmWY1lsVG+TpwYTZ0la8j6HSBSTcgO2WJB I3S/hTncYPpCh2h682dk5MMQMkMP58aE4GHsaAiw6U0YqkCjLzeAD/IcyzEJoyAckxEU 2JvaABv3mfeg3lbiRjIVkrVV3eP2txTrXbbSOGqgcaSCK4A0ZSgPDFNXn5N2DTtj+t8N R2VPNJkyUV2Kejz0ebeqnKgNfCr5jrBrSxjoEKPGKOwBKaMr08SO4vSVqyyr962lb3VF 0VbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="I9KaEMH/"; 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 l23-20020a056402029700b00486e2db6579si1997847edv.418.2023.01.06.09.46.13; Fri, 06 Jan 2023 09:46:39 -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="I9KaEMH/"; 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 S235738AbjAFRky (ORCPT + 99 others); Fri, 6 Jan 2023 12:40:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235727AbjAFRkt (ORCPT ); Fri, 6 Jan 2023 12:40:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B193F7DE18 for ; Fri, 6 Jan 2023 09:40:43 -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 6C6B9B810A7 for ; Fri, 6 Jan 2023 17:40:42 +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-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?1754296168543135254?= X-GMAIL-MSGID: =?utf-8?q?1754296168543135254?= 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: 40215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp945817wrt; Fri, 6 Jan 2023 09:46:36 -0800 (PST) X-Google-Smtp-Source: AMrXdXutXuRczgUksfVepelUgBmhMw9Izg/Hv++TiQ6PgZHAANbm7DrZUCNdG5Wd/FwGIAYeTxsT X-Received: by 2002:a17:906:2bcb:b0:84d:1500:abde with SMTP id n11-20020a1709062bcb00b0084d1500abdemr4730483ejg.73.1673027196555; Fri, 06 Jan 2023 09:46:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673027196; cv=none; d=google.com; s=arc-20160816; b=hGKMMT/Ryi/DO26rYMU+RLqs6hLmG2rtrUHQ7+WdhQXeMxkHk3nAuVdmRGwrKWcwkr Bbr2+A+HP66F92YopWvIyYWRg8PnyjH/3tv1xgEGj7o+OsNWrxkQeHb9JH3sjHdK+p9n JQMqkY1xAast3UCYeVmFjAFyjt1S5+sjP+afz3wSI91das6fOqYo79LLSsFYlS+M3tTz 4QDH7BuHuCm9Rcmkv3muKIWBFr5L97ts5/otBv0U3bB4D6IhbS4phWEsmUqoDgi3QVYF bzktzvaKis2uE4fUyM22zISW1WW4eTpXMKpf7ifVdkxQRMI+kOJM2/YNshFXGTU6MO3E FDog== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QteadmknC0nIRPLxsl8M6MmcVskVG7qETM0Rvot7ZAY=; b=muMQ5VKVaTDwWl62UohbzRkbGx88GJHabUoggVXfj7QkONAW4i/pqcVH0wD2CLHDF8 LSKQ7102b8BEJ2TgEEigC3DU+FfIkyT/YyhVk7LPAl8cTugf2qSNSC2Dj9XrcWHnbKCF MW4Wcs4N3XkYvdGbeLm50EnN8F3xdlvivxQZLwuGv0uwfPdl83D5aYvJ87+y0tl7xl7u 4pYQ5ZlcU4R/7Crtv7F7E08XdwGJ4bAHSGKm9ASJKL4vBc9tKg11F25WJ/HE4SlPGWzV SUpPqZNOlhmcy221EKTyeJShfoUdKG/8bkGg5gx9/Rh97tgWoRD1zBY9eYbLjYATh54G 1G4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hlP6RQhZ; 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 gt20-20020a1709072d9400b0078d4c9d77adsi2446141ejc.94.2023.01.06.09.46.10; Fri, 06 Jan 2023 09:46:36 -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=hlP6RQhZ; 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 S235814AbjAFRk5 (ORCPT + 99 others); Fri, 6 Jan 2023 12:40:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235748AbjAFRku (ORCPT ); Fri, 6 Jan 2023 12:40:50 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FD4C7DE35 for ; Fri, 6 Jan 2023 09:40:45 -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 sin.source.kernel.org (Postfix) with ESMTPS id 440E2CE1D8D for ; Fri, 6 Jan 2023 17:40:44 +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-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?1754296165864504247?= X-GMAIL-MSGID: =?utf-8?q?1754296165864504247?= 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: 40214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp944976wrt; Fri, 6 Jan 2023 09:44:47 -0800 (PST) X-Google-Smtp-Source: AMrXdXtak/ADLjHdM+ScwGFyzI4G0NMRrX51FNyWn2NRRyRR+k4wKNDPkmZq+D9oEXZC6Im2cB7h X-Received: by 2002:a05:6402:1caa:b0:475:9918:37c7 with SMTP id cz10-20020a0564021caa00b00475991837c7mr44805141edb.32.1673027086879; Fri, 06 Jan 2023 09:44:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673027086; cv=none; d=google.com; s=arc-20160816; b=aBpg4uo7/enOMXFRuuWSMUvYTaKzpm/HCbq3xV+G4PmgBNZATHF5HIyHMQOK/PKtPu 8e106yMGxeLQmrnTQO0oQZx3pmDYua4Mxp/jOSIiDaKj2Lx7zpsqWJ7XxhSCo3nFFrr6 1I0+mm5Sz/J/JWxjc3ptFzbVHeNrSRudtWt85Xso/j3CP5eH532O+36AlLpfAxF/CJ00 jLPZI3lzNa9N+myAX1L53OcXB/w7omqvPDXnqTNksnppgRk+x7+NAgXDJw7cR8iCpKhm 7jc7GAiffGOI7IJdqXvkU2BlHYn0tquWymtJ2qev/WrDgQZmldRfYty/7VgAwAfXSNsD ayiw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Vckh/baVijnw/DvNkiAv9tifnlBZNg8TETdc+1Cau7E=; b=UfPo00WB3sfd75GJI1+5hE3n2wvdQXr0/DLxMvbgIJiojqZDmz8y5bCwBwu2d2+pYI RaibUrMtc7Mc76Uck/Wr1LkYtwSq0F3jeWGRJehgxxu8SymFgudfOrQ6nYGUkF7Crsy9 a/xKAlqUhyfsXE3or1IdTlFEylATOSCsmuK/h1umUxlLg62ceB9pCWPpPEkiDiTuDaW1 CK+KxWb7Hetck7qc0AXGC0+HxEgfo8Df5HZ7l47/qFca6QZoEVtwgG7d6dOlF1+CwrJ9 uQz1weeB1kxXwsx0fljQm5AbdnxKEbqzN8+eTtap0InEE42gSfYRYXZnfMU48pFYPPxU fpkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z6cyH5ZR; 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 y4-20020a056402440400b0048eabb86492si2740782eda.42.2023.01.06.09.44.23; Fri, 06 Jan 2023 09:44:46 -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=Z6cyH5ZR; 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 S235870AbjAFRlG (ORCPT + 99 others); Fri, 6 Jan 2023 12:41:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235742AbjAFRkt (ORCPT ); Fri, 6 Jan 2023 12:40:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4907DE2F; Fri, 6 Jan 2023 09:40:45 -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 dfw.source.kernel.org (Postfix) with ESMTPS id CA83F616F5; Fri, 6 Jan 2023 17:40:44 +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-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?1754296050862366950?= X-GMAIL-MSGID: =?utf-8?q?1754296050862366950?= 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;