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: 161183 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp855226vqu; Fri, 3 Nov 2023 00:29:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEFJXLVSj2h/dJuRxa2ittKWNWN2aMGQOpyyiGiX2U6IVi5bU9dwKWoWZWAJPXtghgIBkHI X-Received: by 2002:a05:6358:6f82:b0:168:e637:a819 with SMTP id s2-20020a0563586f8200b00168e637a819mr25656709rwn.12.1698996561921; Fri, 03 Nov 2023 00:29:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698996561; cv=none; d=google.com; s=arc-20160816; b=DgkDPa9CFe9/HMKrWSxNLzw7bMA+o6haWqac5JgUMA+wDXNluyyyDHLN+AadPaR6Re szBo8yr5itUX1u23ED0uuU2CENJrRSvj76/R3Lt28+bPNr/m7s4oRCfHy89iHnIwa3kg OPh7dQBTwcz7z+qo/ki9BkPHwK1z0WzdouOTBVcFYp2Qm3vsrez0Pd7z1pgCVnISekvi ErpfViVszFyUDOWwlauhWthg1AZZTkCDn6RuE8ZKTF5Nk1l0UcwOqk9jxO3skyyAhFHe ax8Yoks9pZdBLZoUw8HMSAaRr9MSgGcEj4rNu43ARwn8x/Lj5nQE+ODOZnosumiSFJo4 kvOw== 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; bh=65ZXimHJWlN/QEzmtlIfgy4P6IXnfEiyWMRz9ZITEK0=; fh=Q7tPJ/E8MvXjzgZkYtX4LsRnr2SdvitVhN9e/tMZDyY=; b=Q+u23G+1zYGJwGoDUTHl3kzgoO6uz0uIWFop4WzbhX1Z6uIVDtcHpoDbS3Lf0Hm/HR LrZRPJiCtlarV3kJ5G15O009Jen+VrNuw0zIzTat4fW2nXHGPiHkJ/M76ZN0Ejz9/jQa 47yMdjreZeWpBK2gwvIsZqpGNB0LqPRj77kodeSRIOKM1L+xiMJY1Y8yj0Pve0uC6Vfw eWKiUASnIBCNOv0gQ/DUNziMUwD3+X2a6MMlTrVgtGZIvK7tczdK5pxwYHV/CVWgmav6 dSOZiV8KchT9MzfiKU2l5rkrc8CurxIKr0jM1+Lp2nJ+rk3dqfOGVBZYwoA5Obwd5z/7 PmGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id k76-20020a636f4f000000b005b8ccf97dcesi1019406pgc.297.2023.11.03.00.29.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 00:29:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 720FF831EDB4; Fri, 3 Nov 2023 00:29:20 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345277AbjKCH3R (ORCPT + 36 others); Fri, 3 Nov 2023 03:29:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232993AbjKCH3P (ORCPT ); Fri, 3 Nov 2023 03:29:15 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32DB91BF; Fri, 3 Nov 2023 00:29:11 -0700 (PDT) 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 00:29:20 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781527018876099385 X-GMAIL-MSGID: 1781527018876099385 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));