From patchwork Fri Nov 3 07:29:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13444389 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 1243AC41535 for ; Fri, 3 Nov 2023 07:29:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1D91A280013; Fri, 3 Nov 2023 03:29:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B056280012; Fri, 3 Nov 2023 03:29:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA98A280013; Fri, 3 Nov 2023 03:29:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id CF35C280012 for ; Fri, 3 Nov 2023 03:29:17 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id AD7B91CB2A3 for ; Fri, 3 Nov 2023 07:29:17 +0000 (UTC) X-FDA: 81415817154.19.0987E61 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf22.hostedemail.com (Postfix) with ESMTP id 7FB61C0015 for ; Fri, 3 Nov 2023 07:29:14 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698996555; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=65ZXimHJWlN/QEzmtlIfgy4P6IXnfEiyWMRz9ZITEK0=; b=ca+NaU8aVEWMToWwibusB+HHWFhmtKvydg4jzPEyq6ohAcPjLIndWnyJ+kd79vL8nc9TXE NRmHPLNR4UwGVpZ+NC0FLAR26qTE0FT2wuD9IMgSTT4crLwp7SBjGKSxf2zzTdJOA6BPcq tbnqtGigNCldYwZ2HksoFl4o8+Y2wZc= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf22.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698996555; a=rsa-sha256; cv=none; b=qL3BwRDsbbqj1zCv7znBXpYXs7zw/kGOgpHxSTtk1cMoIgFGAKUGuEq394JGfcgqREwi9U 4yunUexwgSCesOe1Qq2AAES57si0qRbT2kBmBhWgWbd/Q7Y+sEcpCnmrwtc90xWIXlwY2W EN4Yl72Io/yZt/NdEsq2xg2HhH8n0i8= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SMC314Pj1z1P7ly; Fri, 3 Nov 2023 15:26:05 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 3 Nov 2023 15:29:08 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , Matthew Wilcox , David Hildenbrand , Kefeng Wang Subject: [PATCH 1/5] mm: huge_memory: use more folio api in __split_huge_page_tail() Date: Fri, 3 Nov 2023 15:29:02 +0800 Message-ID: <20231103072906.2000381-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231103072906.2000381-1-wangkefeng.wang@huawei.com> References: <20231103072906.2000381-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 7FB61C0015 X-Stat-Signature: psrfcfzkeh9pp634iceuop3c7owtq3c9 X-Rspam-User: X-HE-Tag: 1698996554-568720 X-HE-Meta: U2FsdGVkX196V/JJuV8WFrHF5FncGKD0hx0r99kpGBps07cQyeMR3IrCGx40ZTatJNiBrlsVbLVjovQUfzMzaYWfIxS7pvexMnzrjXupI54xBy+kA5oeQQOlxIjRk8fuSA674rvLyasf6x6QB/3me0PNa1843k7/Ja/z6iDgQTGZRFk4WxI6tzHxGG5rPLRYqemfbhLWohu9Z7ic74QRODP6S5q2WnUWWNB6glV8mINQgQieQmkDuyLTKgxw5A/+n69AXi9OkkbfH587MDtwB8+C4iuevF+1hJci+aGnD/TgjQyVI08MLQn9rUoNsOuGc0onZtVgH510k2utB7OL0hV8WWCRSZ6FV/bwXuf9CN3RgJYOvGjC8uy7lh26V+FIg2Ib9oW3m1uFX9CRiKOBeOGaT3VwsIgeiUCtqwD03relde09VmRr13PacfGcZs/lWIqOt0FqgtCjJxxLTox3IzrMAXmxJo5xix4LWKkShasL2ztfiOwSetS7w9SxKgPzr8T8PG9OUAZ1NeMJt+5LjsxaoqQClGZ98WyhlVteuxDrYvDnmhhxmFQrL0jkwK0Iapt3qQ6R5usNdZ8AVCFRYMNAl4W367wTkn6R4nB6mvNa8iuU6TJSeZpqyZuURJwm0+OYO+vyuJ2qeu/u6sQw8b6BG7XjnkPXJ+LxK7fiLDJz5oeI3xCyEue9ot0l9ZJjo1Fh2nvD1MGiNi+Hn3MqdJO0dnSMC6bW0ShPy7qfJs7hFz+sFadr/glvKOov5tpHcf5Sl2tlrw4QhMR0WFCeQJyfau681HfeRB1zY4tdiDAOlE5+HbSum7/oPBZ4IQMlIbLWZWkhwlpvTlv0NSox4OLcHiVj43QpVopbCY7CYctFeROU9Ib7JCnNa+Epq1AMym8M8k8jUO7uda8vNMWcu5JgzooWZeawxtRoGm3uOALNNrBrtUfGSM6FUEa5gXAgen7T4AzO9cO3Ia4u25e 3HUryVz8 YmMh3osUZVsyDRlch63rdMJR6QiRG8PdTPNOOT1lvIeTnCVW5Li9ift/Qk3N+XU7o0PN8lhLhRWULwQaWVz5Z3DeVsncrskLsj/ne3QIfx7NHKdcTgCuMTrnMWxRvlpnwJIJT4fZ6WBNI5j1DFKLLwDNPz/PaHH0m/ci8PaHVVzThBKqhsfoCShq2oT3Ibb0J6tIJ 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: List-Subscribe: List-Unsubscribe: Use more folio APIs to save six compound_head() calls in __split_huge_page_tail(). Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index f31f02472396..34001ef9d029 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2507,13 +2507,13 @@ static void __split_huge_page_tail(struct folio *folio, int tail, clear_compound_head(page_tail); /* Finally unfreeze refcount. Additional reference from page cache. */ - page_ref_unfreeze(page_tail, 1 + (!PageAnon(head) || - PageSwapCache(head))); + page_ref_unfreeze(page_tail, 1 + (!folio_test_anon(folio) || + folio_test_swapcache(folio))); - if (page_is_young(head)) - set_page_young(page_tail); - if (page_is_idle(head)) - set_page_idle(page_tail); + if (folio_test_young(folio)) + folio_set_young(new_folio); + if (folio_test_idle(folio)) + folio_set_idle(new_folio); folio_xchg_last_cpupid(new_folio, folio_last_cpupid(folio));