Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1248843rwb; Fri, 18 Nov 2022 15:21:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf5wDaXsqNOlEmT+NS/o4J+2Gycd5FxXydCVY6HTg9iSNsnDFuu+9SIiZ1WgiDdH4dfnpdRf X-Received: by 2002:a17:90a:7804:b0:211:2d90:321 with SMTP id w4-20020a17090a780400b002112d900321mr16031081pjk.84.1668813676980; Fri, 18 Nov 2022 15:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668813676; cv=none; d=google.com; s=arc-20160816; b=gGevDhpW58sCjlybE0i8xGDgWWTwOhIq1nyQSGoy8ihh0/CDT9ngtEkvqALJnbG0qJ ezEiwno7OS7lNO20SUcxNXVj6kmmtBEkrRxL5tMtj2xWBoKUaYNG6+JkqW8dFZUmG/Qm EqdtUXUVfgasFYtNpP8SrPOjI4Lx58cwVRHKYtZCfK/LvBWzrvXyvQjjXYmjBCB+6VEP 51Ks7XBaG2CWEL5HmIQ9aK+/646fylOLugCLWKPBQl9QnQs8ZG44zz56THUI/8XQ9cQH 66NyjQryPy/qfYiPXy32w+3SjFqZBU56c2CUhe+mrIg5WS27MgsvBTlj1oZGd9m+sfsP fbag== 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=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=02Pl3sBaZpQ7a7cR6KT1KqfNsaCdbzIudFHZ9cQo9fHlANor1o4LGeVp2wNxgmi4UZ gunGhhNVKeeQgy8ZQ6Q6mrLyudJxhyGZUkdYleI7Ih7gZVozwRHVUOLyezTPr9M1m5RH BNawEx2ZKhV0jKH8olR84ornpylfKYXs0dVHEs2nrPcmquNY82PKqTfNTyO0Om4if5hG pCauIDCkVDN0/+cVEAUWvcdcUj5ORU0ImqfPMmurqe1vZqWsFJZSMK4ai4Gg/JuzfOx5 KfHt5fotABkFZRTn3YuGPm+vcdrrAHVKWeGy+MiAmyWVWfuhnzz0rr5L3Zskp9bFqL2a gPkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=oH2sYQQD; 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=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mr20-20020a17090b239400b001fac102fdeesi4262116pjb.95.2022.11.18.15.21.05; Fri, 18 Nov 2022 15:21:16 -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=@oracle.com header.s=corp-2022-7-12 header.b=oH2sYQQD; 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=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229663AbiKRW0V (ORCPT + 90 others); Fri, 18 Nov 2022 17:26:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229552AbiKRW0U (ORCPT ); Fri, 18 Nov 2022 17:26:20 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E44AD6161 for ; Fri, 18 Nov 2022 14:26:18 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AILNqRV028279; Fri, 18 Nov 2022 22:26:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2022-7-12; bh=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=oH2sYQQDBdRscfr3FFXq56pD4WThZI7Xj5d5VlS8Er4FNTBIMKWGQIP8kEdorQcK5ZQC xJCDGX/8+I/+w2WO2vAA89CjEXY5LJewMFcAQq+aG4jCutD8g3eJc6J1y54gL0/4Z2s1 EZh/YkmcAOPTBPJ4aDkD0G0zrP7UVneo9xjWaLr9BRRSIp9020ERlA0RwqOC+wOrk6R6 21soeePovO1xMSWyhpofJCIle3KAYbo3GYgKYmm2o+ECiqIDYmvlKE3Os+ZqvI517roi gYq9SJo2Gqi6/Xdsk2SzGOa7gAWpVTElY8PxvjbQFj610ZU/s2Svtj+vVO0nuu+b3SIS VA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kxh4588eh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Nov 2022 22:26:07 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2AIKooL8001656; Fri, 18 Nov 2022 22:20:12 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ku3kc1eyx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 18 Nov 2022 22:20:12 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 2AIMK7qT040370; Fri, 18 Nov 2022 22:20:12 GMT Received: from sid-dell.us.oracle.com (dhcp-10-159-141-24.vpn.oracle.com [10.159.141.24]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3ku3kc1esc-4; Fri, 18 Nov 2022 22:20:12 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, Sidhartha Kumar Subject: [PATCH mm-unstable v4 03/10] mm/hugetlb: convert dissolve_free_huge_page() to folios Date: Fri, 18 Nov 2022 14:19:55 -0800 Message-Id: <20221118222002.82588-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221118222002.82588-1-sidhartha.kumar@oracle.com> References: <20221118222002.82588-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-18_08,2022-11-18_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 mlxlogscore=999 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211180133 X-Proofpoint-ORIG-GUID: rOeE3h-xmqyDq8opu44Gw04Ee9V1_uXw X-Proofpoint-GUID: rOeE3h-xmqyDq8opu44Gw04Ee9V1_uXw X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE 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 Removes compound_head() call by using a folio rather than a head page. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f6f791675c38..d0acabbf3025 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2128,21 +2128,21 @@ static struct page *remove_pool_huge_page(struct hstate *h, int dissolve_free_huge_page(struct page *page) { int rc = -EBUSY; + struct folio *folio = page_folio(page); retry: /* Not to disrupt normal path by vainly holding hugetlb_lock */ - if (!PageHuge(page)) + if (!folio_test_hugetlb(folio)) return 0; spin_lock_irq(&hugetlb_lock); - if (!PageHuge(page)) { + if (!folio_test_hugetlb(folio)) { rc = 0; goto out; } - if (!page_count(page)) { - struct page *head = compound_head(page); - struct hstate *h = page_hstate(head); + if (!folio_ref_count(folio)) { + struct hstate *h = folio_hstate(folio); if (!available_huge_pages(h)) goto out; @@ -2150,7 +2150,7 @@ int dissolve_free_huge_page(struct page *page) * We should make sure that the page is already on the free list * when it is dissolved. */ - if (unlikely(!HPageFreed(head))) { + if (unlikely(!folio_test_hugetlb_freed(folio))) { spin_unlock_irq(&hugetlb_lock); cond_resched(); @@ -2165,7 +2165,7 @@ int dissolve_free_huge_page(struct page *page) goto retry; } - remove_hugetlb_page(h, head, false); + remove_hugetlb_page(h, &folio->page, false); h->max_huge_pages--; spin_unlock_irq(&hugetlb_lock); @@ -2177,12 +2177,12 @@ int dissolve_free_huge_page(struct page *page) * Attempt to allocate vmemmmap here so that we can take * appropriate action on failure. */ - rc = hugetlb_vmemmap_restore(h, head); + rc = hugetlb_vmemmap_restore(h, &folio->page); if (!rc) { - update_and_free_page(h, head, false); + update_and_free_page(h, &folio->page, false); } else { spin_lock_irq(&hugetlb_lock); - add_hugetlb_page(h, head, false); + add_hugetlb_page(h, &folio->page, false); h->max_huge_pages++; spin_unlock_irq(&hugetlb_lock); } -- 2.38.1