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: 163765 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b129:0:b0:403:3b70:6f57 with SMTP id q9csp864743vqs; Thu, 9 Nov 2023 19:34:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IGGPn+1pTPHR/kxiwlEjtDXbjgKgER7ydFnkekipfhh6/D4a6/5rwPqaY0eZEFfgXuK/FQb X-Received: by 2002:a17:902:d492:b0:1cc:4d99:36f2 with SMTP id c18-20020a170902d49200b001cc4d9936f2mr7015993plg.56.1699587254325; Thu, 09 Nov 2023 19:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699587254; cv=none; d=google.com; s=arc-20160816; b=ZODS/8nlUuTojuDZmK1nyRobljn8CWnN0OyInt3+Zq8hYS2xCW62bMujeqw4jaKLRc j8F/iX/zhWmdYNZAc4vmLxLuKaOpiV1U4qDQ4AoxK5inm2X4/68yBFARDVWIar6zTsYr CjHCNl3ta5d5vWSCXmy+0c3VOslaZzAGO1Id7BSMyO8YHDo9zNXRVj3AS/pSyGlrbZxH bxEZa7NVzR6qqqlOauGVP0a9zaVyOOU5W+bOOcRdQfeQDxaxCR15BFm3REZ3ndH7mWMV DxLeyL5OGckexyPI4unv0G2UfmnyzBbZBkX8Co08VigCoVX9+BU2wcjAO2gDjrQN04bb 5cCg== 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=4dxVUuHF6euSr2sshfFVKaKxOUe39k/DIgthsc5PjZY=; fh=Ig0AqGQMuH358nWWGrnHSF2kv4xbMV1Ws+OHgkmQS6g=; b=jix2IG41OOmfFtyQoTEgpFm4qRcDmdNg6golmtZFVyK/hiTSeuJCis8aJ29P8nQL14 2yFphnEXY+KHFg6d40/Hzo4sWR+3nWELbLlPTa988tdeHJluOX396dp0y6OhOY8HwTPL wPbffZ7EYdY0v1beiaGqWfeHkrfA3fj9ZU9ZwsX/ruL0ZNVbFrmQB1MFdk1qauikG3Er H2SyMqVEDWTxbZafkYafuIIoxzPRQTvaxJxRhP7nMhEKohS/f0qcUpX/b7GRceh14Ad3 MbQ+zcNNfsytzweBaL4ZzUssM8F3liFxdG71MTmI0jRKqw5DryrokYaP8iSzbzer2H8G J4hg== 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 f5-20020a170902ce8500b001b8921fbd87si7174131plg.490.2023.11.09.19.34.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Nov 2023 19:34:14 -0800 (PST) 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 A953A83B4594; Thu, 9 Nov 2023 19:34:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345850AbjKJDeE (ORCPT + 30 others); Thu, 9 Nov 2023 22:34:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345803AbjKJDdy (ORCPT ); Thu, 9 Nov 2023 22:33:54 -0500 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0D9744BD for ; Thu, 9 Nov 2023 19:33:51 -0800 (PST) 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 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]); Thu, 09 Nov 2023 19:34:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782146405065558851 X-GMAIL-MSGID: 1782146405065558851 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));