From patchwork Fri Nov 10 03:33:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13452060 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 A50F9C4167D for ; Fri, 10 Nov 2023 03:34:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 84C724401BC; Thu, 9 Nov 2023 22:33:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6B7894401C1; Thu, 9 Nov 2023 22:33:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 52FF14401BC; Thu, 9 Nov 2023 22:33:57 -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 35B524401BF for ; Thu, 9 Nov 2023 22:33:57 -0500 (EST) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0B5011201F8 for ; Fri, 10 Nov 2023 03:33:57 +0000 (UTC) X-FDA: 81440625714.18.923FA28 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id 8676FA0010 for ; Fri, 10 Nov 2023 03:33:54 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 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=1699587235; 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=4dxVUuHF6euSr2sshfFVKaKxOUe39k/DIgthsc5PjZY=; b=3/aqbQfy/a0CTCDxvsLLA9v2jRkQLB/pOwgusxOX7V7lIncypiy1EY37CGN2sBRn1T9jyH 7MJ9+N9srZnv6Vc/atUReD+VW8geeg10KPCvevwooSEq3itLp9cctoWPfun1aDVu7EQkkF aPI0N8RZi4C9SOtWRezu8X0Fp9vit0w= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699587235; a=rsa-sha256; cv=none; b=EmGinw7bwXBX9o+C+QfP4ws5FpMuweXG9LORck4e6J+IBL8iND1GtXitn28LMFssUir6Je wn1f40U/xzYi1Xb5Kv0Zu6Ru3GVB+XQVDKf/KsGrQu9ICGptD2/Pjlv5HiV3lbfS6toJwz 9ifdiM+jn1WIU76VmNVZRyHx9PKNU4Q= Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SRPYb14PNzfb7T; Fri, 10 Nov 2023 11:33:39 +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, 10 Nov 2023 11:33:49 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , Gregory Price , Kefeng Wang Subject: [PATCH v2 4/7] mm: huge_memory: use more folio api in __split_huge_page_tail() Date: Fri, 10 Nov 2023 11:33:21 +0800 Message-ID: <20231110033324.2455523-5-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> References: <20231110033324.2455523-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: 8676FA0010 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: bh6q47pp3j9z6jnzta6c5x8xtgedixuc X-HE-Tag: 1699587234-520612 X-HE-Meta: U2FsdGVkX18EphgJE0DyoFg0CtQbAkvxxBRwaCX60fBYtNvUtTgv8n5CuCdbPRY1gxI7+c2HDR822jqupfIzojEyPLd0UDM21MZ/vNIthQSz9nuGLICSO4vlwKIAW8iU1npOPHdgKgWia/cZiqSn+HCOxUntFwS6iqn03lX6xIiWr9q2pJYONlm7KwyumCDyIzA0iM7WEdjDcGTdRiThOV/HX8UVZbg1u8F8wVO/84xBXHSWOz/wBZyXfTOCfPf6d0QegIJezdOnuRCjRZYkmHUBe8MsyynK7InxfuannMeLzvU/b3wVwKZGJhgBOQg68ZB8qhPqcBy42W5hXPLmwQ2Eti5O3Bk6RI+rQpLlXsGJvee4YxmbWcknEZszdMJ0baZzrpL7MMtoW8l10NQffo/x9nxYSRQvtSIz5p5QMspsDZigGTOa+qShvUQ37YualHFiYn+jzwCMOjnZf71I6K+zSJHQuqv4NQoF843fJMEH2ImGU/elur9+e0PCfMGKqUzgK30/2hdJdkiOtPX59gEaBHFMfCwS4TwzCZjYcbxAMZ6dMQstBtDYI60x8aYivox+b5WEN1VLloEyUrX1Ro6haq1VzQbwGCbnx+X7adCygPoj5MFfXZF89Q0h25KL6eRX7VrY705xFieAiyWORFPNjckR76QFCamN9L6KyaXWK/qLoxTg/JD25+ehs8xwhh/xXWrDnivSGQJ3NVCIXMh2AGwUkN4hvisxhE/S0gcDaSdVjFi3o7/8Ucm4EBow2F62jfs7G2OGYZ03OoAFjhIFhxaChWjTuiZAH+Y4H5E2/oJ/wnN9q8v3wuTdmND1651PQxjgMq2D606ZuGE9z4qkPP2hDC62FNLa43dW5bUptPc2U/MADBEx6S64vxLfzQ0s4m0Iu+VZgud+446e1OMJ7hbNpjrYp9ZIetMFAHI+VpOWNPzPC0pnhtyGcMxwL3Js7x7cwS39aPBMRh4 WYaGNrbi 33KjcYxVsNpKJu3ZOLpBv8WHS5uHVV4BMnWva0oWCCPytW/0ZgaMLhUvg3StcExyy6VY2FvPqR4SfYb8Oyc5+I1s7ub4It3MgLPE89IhNaNoBis25g5HTtO6SYjk5Oth/b27NK8rakTEg9J3KbcVoWHfJr8oxCyZE2J3Jd7Vga1u9P2riWr6/XID/S4sqfc9h91Xy 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 Reviewed-by: Matthew Wilcox (Oracle) --- 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 3f74a063f7d1..2b03c55ea425 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2509,13 +2509,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));