From patchwork Fri Jan 13 22:30:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43642 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp11836wrn; Fri, 13 Jan 2023 14:34:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXv1bzqrJe50+wog3aoZtqoNhN5ZJltq9FiLVrXlcNQ84XtITftFFOYUwuAt9jSdEJo99tkg X-Received: by 2002:aa7:cada:0:b0:491:ad51:33f7 with SMTP id l26-20020aa7cada000000b00491ad5133f7mr1293599edt.22.1673649248406; Fri, 13 Jan 2023 14:34:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673649248; cv=pass; d=google.com; s=arc-20160816; b=vF15wRVX1VzexGcXzi3x8kwZNMPsoR9IODJ4Z5SOz0w5cHFj9yuZCHsbMONZkl5nQR gDWgwBQvWRd95TRQsd0k31IqFTTA5tWEkv87PDC6qyaXPZeG5c/yA/AGlOPqS3NkA06M psHL3WvltrPtfe1ETc7IdAStIaTOjGlUKh2dK9WQeI8OcMYO1SdhsRrH1+nKasMB67I6 p6X4AXwhv8ewQJE79dWqHBSUWqBOOZ5h1LONw1V4PqSFv0Cflj5Lq0MjBIiTwpe0pNiz /qYOZFb9Hjspi3+Kgw/6IxZQysj/PVX4qNvNZyMVa+suRRhVsJhGsv4SppO7L6uHiG8V O4KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=t+cvMLTPBSJVaKyqZq16czoCTbRPJGAIrZqEk13/WdQ=; b=UkwNwtyzYajx4IHAn1o0QnYweDFPAWoUcGc/vL5yHTs+FZQrkC8VzR8Y+XZiemE34i oBsE0bWty4WTyAySHMZ8pZn+Onmp5kiek6CXl9s+TtL1DTs1hkk1kf3sejG3yRNyvRHW EkryVyX1AMn9Ay0T7vdvbIolrFZT8zhttZ2CWyx6LQ8yhANu+f/RFS4TVlBzxIP60LfJ HmqFEkWmXRSop1BdGlyS3XEuaXW3t1LHKg3BJFZ6sWj5S0EOwluNdH0aTGwsG+BXKwRF cyM+ueDBzSJbQ5fKATl7jzkC6lVuZah22fbAly/+buHM0XsYE07HuGmQ9LNiYiaRmFkV N8Vw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=BkMwvgpk; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cMGE4ulw; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a056402278d00b0047010e04c4dsi26831706ede.481.2023.01.13.14.33.24; Fri, 13 Jan 2023 14:34:08 -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=BkMwvgpk; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cMGE4ulw; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S229979AbjAMWcH (ORCPT + 99 others); Fri, 13 Jan 2023 17:32:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229870AbjAMWbr (ORCPT ); Fri, 13 Jan 2023 17:31:47 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96F6876EE5 for ; Fri, 13 Jan 2023 14:31:45 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DLYhXA015860; Fri, 13 Jan 2023 22:31: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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=t+cvMLTPBSJVaKyqZq16czoCTbRPJGAIrZqEk13/WdQ=; b=BkMwvgpkHMHYZs60YEuxguveKpDekLEieUkqDY63SGcGS6MHu7cbaqMwkGNe7Gcy1989 VJukAQ/lIAb6GIEo6mXCWLbvrizCc8hlK7NUUH6vQCbixIdn/mPmhXN7T1bj91pw7Sy6 g87ZaoICW5FLYpeQqHNtzRLPrFeyDtHlOcUtpHEkYw8xDXXsK2q77A+MTvSUU55bpugp xyFUku/a/6ZGSmdLFeglBk1IZH9njIFIUswikzKOYyzZh9uA2tjh5L43azDo2p0IMDA1 EAovBQTGnMrnFmTGM4dx24LdNshJGmM4nnuJYdKM0+jWvZalB221bPIgiCjbH8bNZgun 1Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3av80ph3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:08 +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 30DLJ7X8031512; Fri, 13 Jan 2023 22:31:06 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n3f3y20wp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XUdOFVYAKez53r7jPZAOY/yzSkob3k6/ywTazpL5AkFsA/pBF1/Ceu4fWYt4frMMaexWrocc5KeBI0DJOI8TPRcDCHjMhJaNpalXBoAENxhflJDZ4qCPTqRCrz1wvNRZ4L9EC564sliEMex1xoWoJagijAONO1+mzsRep7NDgLjWeJmaAL9Q6seINLsoBhb7Nb7xAffIb+Wb3U19g3qgSkaJOaU9pcrvJKcfijDpCuwxrX7xTALuCtoQ0wC90dGL1Cgh+b68/0tNEEkQai+wrqZC0Qi6W3LWGl4cSBKJyj8J29D7XR50b3jzhgiFpo72a++nu0aR6beFykP6l7AP6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=t+cvMLTPBSJVaKyqZq16czoCTbRPJGAIrZqEk13/WdQ=; b=hWtI31Hp79cZW5pBm8EinHumPN3RAHhe8t3r2D00LiXlafjabCGemNn+jnt6+zYHucLX/2KeUo/7h3yDXWuK904EjHdvqjS8mdqtlcb62j1J1KrlCaezbO+WxXN9zbSQeZl6FB1QOobVlgDjcyI/9HV0FbI6zIiqVY5FzeXuy2m5gkax0guVWzoMw8BjGxwnJjw/HPkN62UxdGP1Ow9oBp1NQIk3TiWzmjo2EuaLbQGIUvKvGfiTKRS0W3FR8sHYKK9GO6NBjzc5V0kDdVTV9rUawBeY+sPrXFaJ6x0QBVbMvBB6dfMl1djPcIpd/fKGSENE1KmNoWVEXE+Bx4XKqw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=t+cvMLTPBSJVaKyqZq16czoCTbRPJGAIrZqEk13/WdQ=; b=cMGE4ulwxFlGnDlBLqZgf7xwdKw81CCe0eta3LHP/siB0FKuAmz2ujrui0bADS8+Jun4G1XRbgcq2CijLeCMm2l4+9E+fjPRxd4gBn4qfFHwAvLJgPmE5619DbTZiyWl+wvG+/bf6QrarHdF1k5nfSNkMxzd5MplAowxAYw8WXQ= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:04 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:04 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 1/8] mm/hugetlb: convert isolate_hugetlb to folios Date: Fri, 13 Jan 2023 16:30:50 -0600 Message-Id: <20230113223057.173292-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR02CA0001.namprd02.prod.outlook.com (2603:10b6:610:4e::11) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: db1858b1-774a-44a1-624a-08daf5b5dadd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2UbRuZBdy1xcpq8yRSO+qqYaVg7AX0hFLRmnhC7tQDKwpdpOtjKx72SfHlX7ACovXPv22khdvi4IRoYFzJnORytrFhauHJ7ZZzTrUSk9hBSaHhptwIU6Dvd9gGcZdrhOTOUAPnJd9NctsuZPrJuej3xOXb+jLla4xP1B37FfXu9tIChPFEkWfPATNYDyNCMqSI5OpEQIO/pb52waG4lxz1dqrQCYdFp/N3JxNqnaGP4HHNYR2aFhK8Dm4OkqIBARkQKuAhAyGGK6nC4hVu3iSepeAEunkX2mvVjitniaGogBk2pXtnrVchmDSL8Et8McpXbxCmk71/sCJ55EIztDbs+UR3bPNt5bu4YyQz9jKl8i2nYlBOyswqZs3A4ViHmYXc2WUDUQw9gLAvQoM1uk+bbTjl0UpJlVzzkHQrkPmkAGrxgb0aRiBCu27SntiOlK4jtk8HM45P+bSFH2H4C7T4wcxNE0eRo1THeEwutqeqxfsMgYRpwQXHfgsoEQgsK/9jiXYZx1OI85tNYyvRd2QJ2ftBh77fsKo9nlssHdL7cBUzidG5dmPnjCZEa35kFgHupmbCbNobGmdk3kqzMHeSoTAy+tnvm3sk42jyulfkcLTdFnLMA+ZR8z8vSVMf2DOW89/4LwJHXjt5uuS/KpdA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Xfn+H1Ao5WoNGwaQOUABfOEPzn8MZSAZrkuxlgJYtoZ3EWHKm8vDAakiq0jU72t4GjTJFXr2rHktnol5gmpQa8apSEILL2saaOHEKV1QYAgC3whkdNaBpPfmg7v9wU/mtsBbg/i5zTIC+SK37yf3B7kbfSu9cSDR5/FktFMIMM6Zu80lMKHKRAYuLe1g3Yyk/0puwumxpkPzSGJECGybbHUeYMPay8nH9puLQUTfvV/sV2Yd3yZH/mIIghLzBDr6XtcC5PHCnRohuEvN8u8Qy7WIj8jeTsUoxVLH1Mh3AuxvQAMXBJmCXmLYItV4lgYPV019AnK10176uRvHbmTvpNHjq6fqUEdAw3wF/+z2zVoV+l41wKHryMZ5GMIabFoFVeolIjr9uQYWUaETzanudBHjAHyFcURWMiLVWvDTrirDxIVTOE+vXIYajAlxWY+PB35b2uEl1hap6AcgjJ/pyrFeBAWXrc1ow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LfA8ez X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: db1858b1-774a-44a1-624a-08daf5b5dadd X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:04.0404 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: c57UxOF1Lft875HDJYChWlYmnRTfaqugZBt1iejspZv0QXXIPk2jDCs9f6RvcLyfyqq6IshZmjh2q/3xtCU4uf5KZYfTZqo1zuT348BYzAA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=823 phishscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: xSUdV6INIKqzmjeR1zNO8GvwqaYNOMw0 X-Proofpoint-GUID: xSUdV6INIKqzmjeR1zNO8GvwqaYNOMw0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754948434325665193?= X-GMAIL-MSGID: =?utf-8?q?1754948434325665193?= Convert isolate_hugetlb() to take in a folio and convert its callers to pass a folio. Use page_folio() to convert the callers to use a folio is safe as isolate_hugetlb() operates on a head page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 4 ++-- mm/gup.c | 2 +- mm/hugetlb.c | 16 ++++++++-------- mm/memory-failure.c | 2 +- mm/memory_hotplug.c | 2 +- mm/mempolicy.c | 2 +- mm/migrate.c | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 551834cd5299..482929b2d044 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -169,7 +169,7 @@ bool hugetlb_reserve_pages(struct inode *inode, long from, long to, vm_flags_t vm_flags); long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long freed); -int isolate_hugetlb(struct page *page, struct list_head *list); +int isolate_hugetlb(struct folio *folio, struct list_head *list); int get_hwpoison_huge_page(struct page *page, bool *hugetlb, bool unpoison); int get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); @@ -374,7 +374,7 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr, return NULL; } -static inline int isolate_hugetlb(struct page *page, struct list_head *list) +static inline int isolate_hugetlb(struct folio *folio, struct list_head *list) { return -EBUSY; } diff --git a/mm/gup.c b/mm/gup.c index 5182abaaecde..bdb00b9df89e 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1843,7 +1843,7 @@ static unsigned long collect_longterm_unpinnable_pages( continue; if (folio_test_hugetlb(folio)) { - isolate_hugetlb(&folio->page, movable_page_list); + isolate_hugetlb(folio, movable_page_list); continue; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 0c58f6519b9a..540f33d8cc51 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2781,7 +2781,7 @@ static int alloc_and_dissolve_hugetlb_folio(struct hstate *h, * Fail with -EBUSY if not possible. */ spin_unlock_irq(&hugetlb_lock); - ret = isolate_hugetlb(&old_folio->page, list); + ret = isolate_hugetlb(old_folio, list); spin_lock_irq(&hugetlb_lock); goto free_new; } else if (!folio_test_hugetlb_freed(old_folio)) { @@ -2856,7 +2856,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) if (hstate_is_gigantic(h)) return -ENOMEM; - if (folio_ref_count(folio) && !isolate_hugetlb(&folio->page, list)) + if (folio_ref_count(folio) && !isolate_hugetlb(folio, list)) ret = 0; else if (!folio_ref_count(folio)) ret = alloc_and_dissolve_hugetlb_folio(h, folio, list); @@ -7271,19 +7271,19 @@ __weak unsigned long hugetlb_mask_last_page(struct hstate *h) * These functions are overwritable if your architecture needs its own * behavior. */ -int isolate_hugetlb(struct page *page, struct list_head *list) +int isolate_hugetlb(struct folio *folio, struct list_head *list) { int ret = 0; spin_lock_irq(&hugetlb_lock); - if (!PageHeadHuge(page) || - !HPageMigratable(page) || - !get_page_unless_zero(page)) { + if (!folio_test_hugetlb(folio) || + !folio_test_hugetlb_migratable(folio) || + !folio_try_get(folio)) { ret = -EBUSY; goto unlock; } - ClearHPageMigratable(page); - list_move_tail(&page->lru, list); + folio_clear_hugetlb_migratable(folio); + list_move_tail(&folio->lru, list); unlock: spin_unlock_irq(&hugetlb_lock); return ret; diff --git a/mm/memory-failure.c b/mm/memory-failure.c index c77a9e37e27e..9a80d7830b40 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2437,7 +2437,7 @@ static bool isolate_page(struct page *page, struct list_head *pagelist) bool isolated = false; if (PageHuge(page)) { - isolated = !isolate_hugetlb(page, pagelist); + isolated = !isolate_hugetlb(page_folio(page), pagelist); } else { bool lru = !__PageMovable(page); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index fd40f7e9f176..a1e8c3e9ab08 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1641,7 +1641,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn) if (PageHuge(page)) { pfn = page_to_pfn(head) + compound_nr(head) - 1; - isolate_hugetlb(head, &source); + isolate_hugetlb(folio, &source); continue; } else if (PageTransHuge(page)) pfn = page_to_pfn(head) + thp_nr_pages(page) - 1; diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 61aa9aedb728..4e62b26539c9 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -601,7 +601,7 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask, /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ if (flags & (MPOL_MF_MOVE_ALL) || (flags & MPOL_MF_MOVE && page_mapcount(page) == 1)) { - if (isolate_hugetlb(page, qp->pagelist) && + if (isolate_hugetlb(page_folio(page), qp->pagelist) && (flags & MPOL_MF_STRICT)) /* * Failed to isolate page but allow migrating pages diff --git a/mm/migrate.c b/mm/migrate.c index 4aea647a0180..6932b3d5a9dd 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1732,7 +1732,7 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr, if (PageHuge(page)) { if (PageHead(page)) { - err = isolate_hugetlb(page, pagelist); + err = isolate_hugetlb(page_folio(page), pagelist); if (!err) err = 1; } From patchwork Fri Jan 13 22:30:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43639 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp11346wrn; Fri, 13 Jan 2023 14:32:45 -0800 (PST) X-Google-Smtp-Source: AMrXdXvxH/JsT9J/i/CIAnl3vH30JXOtfVTXJIAyZaLpbByGn6lXM2F7FFl3Q2LJTC53gDe/xe35 X-Received: by 2002:a17:907:d48e:b0:862:fc76:6f8e with SMTP id vj14-20020a170907d48e00b00862fc766f8emr10024781ejc.36.1673649164954; Fri, 13 Jan 2023 14:32:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673649164; cv=pass; d=google.com; s=arc-20160816; b=efRr+V4ETl2sYcbPBw5OdlXfh/EReU6Ia2ZcYeHjSJXg7GggAygGiYSclRqrHVxDTr KHCQifNjFod+C7JdZkeKktZCN6YOXxUKHCXH4U0ofYk2MCqDv+ez6FbmvnrChSFiCMXv 6g2cbwBhCNlbi58TjNq4rQb36oEqZs+Vw8AA8J2NkWXQ57/075QzI9SwQMfDLbwJpOyH E9u7gEXpwksAtlBaIlSth3eU+0fCz6UsTC2VRdK/ihxv0CCjSZQ37JOnyUbRuSBfv0l8 +H4uhMn0fFTUxZqhzxrHuxe+Q5nBKNCcoXOxM3InjlrujlxP4M4kGD5t80FEycAOLZq/ ZNDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ia/pKYvs485DK07VT5Hlv1uptsr6AIwYUeTt8NNpORU=; b=PMl3icFLGhEHKR4vKo3U7814WoEYjX28aD03mSQ4q7j9v+P4Ou39jWi3d0fRx/7Vfk k7OIh3Mi8WzWC88nnjFYJSqZCqRDZjUav1V5JnRc6P+e7BbDqbinDBTMN94yvLMGH64L 1SL1FgTJrMltsrhpycd62Kb512FrJyzRSqrhPpfWhVvGn/sW9QNOgaeECa9EMRN3eMBc 0xwhyFEm8e8Hli+IqeRet920MrSCPzn7KVkDw9KaxblAQIlHzJVhPQM3k8t1aRMoOJsg h30DG5h+59XxZQB2v8kFyLaUEbgNlihpBiyR516UIWFMFiDNSONUyXF4XWRaWEAV988W oAVQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Jw6GqB2h; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=S3Koee86; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p20-20020a1709060dd400b0082fba57f803si17017251eji.819.2023.01.13.14.32.13; Fri, 13 Jan 2023 14:32:44 -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=Jw6GqB2h; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=S3Koee86; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S229797AbjAMWbu (ORCPT + 99 others); Fri, 13 Jan 2023 17:31:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229809AbjAMWbo (ORCPT ); Fri, 13 Jan 2023 17:31:44 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F24BD6C06F for ; Fri, 13 Jan 2023 14:31:43 -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 30DMV9ff008583; Fri, 13 Jan 2023 22:31:09 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=ia/pKYvs485DK07VT5Hlv1uptsr6AIwYUeTt8NNpORU=; b=Jw6GqB2hgGTR6Rcc6nIA1Ojc0/hqI1N+I9O7+b5MdZ2Ef8QvGz/LbkLRA4pflql+PWAK fZ849rIRfV7zdTAcYql/7Y7dbsgc/3sApWAELV7dRBjKxh6qxI2FtMq24vcimr10MjQM fYrjxXKulIIFPk36LXmKi15Gua2kKMge2pv1kReJOicYEi4bqKx8mlh1VL01JLGrE+H4 vh9Bs/Wb6m8jLI9vXL0BcZQmkSb/GZJw5Dek84v+eocwphfJicgzzZwobiBSl4w3l/8/ XxdWLFmlJhIr9RWtT1txF16X1WGvOk2GjKA6LS0n46YpomXhmUa4kz8+Yz7dhE6EPoAQ 7g== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3e0w09kb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:09 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DKwdj3006706; Fri, 13 Jan 2023 22:31:08 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n3etdjkpm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gfOqV9YRSE+4HTuD/oYDSoVVA9mWBLvgPy5equXLURJaxp6VncCkOXrzk/HCbeHwOn39kibSG/yv/cvSBeQWakNRQC97A3O862tvLjTZ0W05SCY20b0MY/2XpB+YPx3CeFpvnkCM/OY0oFORyzI1xluDrJmJhv7EhIoKrQ1/tQ9pjZ95Qu6d2DgITZXTCNJ70p+RV2tEwM4sydFjZ5u9bEJ45ExOz6Ok/df/ulPvVSrngLc9p11qr+QInWwKbn7kQvSExkc13qbj0clr29cQBhcpuYaWmCd1OWL60Ugi6F6EUPxzaKoZQNP+kyScM1KkNy9Z+6J2IOmqUAmxkEYTiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ia/pKYvs485DK07VT5Hlv1uptsr6AIwYUeTt8NNpORU=; b=Jq7C+tDpIcCRe1tnouLR5dc9YkLLS0/BQladBDCWnTgXhIAaA9Y193N8AT6xRTapVp8eOcAvdA96MVmSATf+tIRsoXDNggNqTvM7N511SwxKejWDrygogiKM3j0wVr9J+4HrGZCAQb6e2Im9kMz9b+EakDjBNU/WekNNfpilhfvaxY47vp/fsjcbQBpVXabVaPdmpZ07yx0AQH3/BB4G4N7/qOEDYx6GDY7jRYjnrp2PTNtzuLZWrc+qrahwf8+k3WbDUpQYkvfaNriA/8fVPT9vaySYk4/77lZUnVcxdagvXsminnht9U3or9l+LMpiZsHDm/Ml6v1xw+x1mKD6oQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ia/pKYvs485DK07VT5Hlv1uptsr6AIwYUeTt8NNpORU=; b=S3Koee86dj807nA2lgdskpnLZm7O27RKKF8JRlRWh5WDY4hyearAHyHy1YRLyKtzmPj3YncULqyL1GHNbLMRQMkavxhQH0oDd2VNNzKdAKtt2wNyoJyplZAdQXtbLH+p2MLJlkjx+eRVX5pmY4QRFoO0fEsdx/167HhKI1561Gk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:05 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:05 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 2/8] mm/hugetlb: convert __update_and_free_page() to folios Date: Fri, 13 Jan 2023 16:30:51 -0600 Message-Id: <20230113223057.173292-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR04CA0010.namprd04.prod.outlook.com (2603:10b6:610:52::20) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: aa827c21-9c6c-40ec-5b8b-08daf5b5dbe1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2HeMp3wHJmawI74fn8kEuHRKGG0V6gmeHJAyh2k8OcWMvZTMiAfLIFSSQuCxIWGjgMy3NdYNZUXs5FVa6bEHD134apkF4UzmozF627bKTzyt7af51zszm80W7jrAWCArBQYcTuC9drL2nB/L1Nc6TjGasi7yQhh2ccf/a9EPsRYLOjlkg9Koo3ZQ28uOgHFOQJg8D7oxDsLk68MFABqsV7PHSxEd0QQoXe32f/8XbmaYBsUzZiTBy7xbO7pZXCWi9R+ws3qYZ6WY0XVotaBgBPEnc/DPv5a+TvjLfsd3myJ0N5/5bWn6lfS1ITKEjajm7+oyNmLUVBySdRXm1rr+MymenFV4GnFrmTKxEfs9idkwBY/MBgINH1ze4kpJwdMc10xtg4rjt5MzjcorXXabIybMNIP08zdr8nrSSLXuYtSpBx5PBXBHPW9k4M4BNALhCshQMpxz1hf+6ESB0khTXXJytyhKTZRCJ7zxfep2k7WugOX+RgKVZ7xMaId3CFeXnEmMEHOvPb0yDcSZzctFrDCT9PKhfk1dUYnrNvwUpPTUrFfvbiUPEZ9VQ+uh9S4cvlMSEXY++PeWfiMsMJ14I35T534t7n1SjzwWwFVJ+XGx01kH4qEoTJJ7tbjae+5D4sNQ5hCTyWBWmtJ06MJe9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N58X2uiiWbldboHnvSFd8wWeL4HAHyCLj1jMcFBQYWotf/dv6B0xl0aLUv8mOQaoAEQT7RV8NxAIm1a6xWPz+Lp5QmDmyBpr85ySHo8NveRQcX0Ehp+dynKhdR8rG2fmimYjy2x1UDT9hA3ghCFdKGCcVBi6xOExe3r2rgHewZJxf1ZWcFCQO5Y8UdL+/bLOSsp3eaQaBY8pqHM+9DLwyL+fiB1XKjZI4DYA0XCKUHnDwcra4O8bb1RA0Vf1h1i2ORBmCk/yP7OygF7PaIb/oT9V4QtgaMNbe3hJfIYQ6wg95JUPg3Ut9dVRCidMiyMWjhOGofxI0TIWX+Tr5n5w0yh9UMQ2Hj0laB982scZ+MKPWb8BDhPaAKRCuFgLWDa5jd3bHQpciBEcP7PuwAzJaur2gbX9LNk5/GMWopsB55l4ezd+5+OprWThmqZHnDSFP1qsgSwKGQ79O87R2yO29+aZsfzqAjmlrLHW1Rvok131BKopW6QS8kv6PjftKglnwO729SpQ6zLnetY25/RpXa6Gam1OvM+ET0FkC8o+9f0CCQBYYSPcXqyoGIcoiyVGHULT7wrwVovoVRzrBL/iwVxIyvT48FxmUjAMqKcUca3MrepiCbH0SYe0YXT449kGDEsHOIc056kEm78YTu4ZMrzADkOHasHvnj0RcMp5Iw0FLeZciG4TvOaLM482oCFhD3xFm2X7Vy16GLZAxcfGmtwEz4bBwmPkUlemJ4lFOJfGLZ4iKuIhKmzU+f80sIqV7pk/vufwkzA0vZGkCrAF6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Qk0pnETy8dH6zF8sBro0ZH8382Am4Y62TiFOYWtZ9tjlvByEiW19y8ezF2Du5BX7ZcdAW9O2sLyohSRO4oSfMvuFrkPR9f+aDqNVM/tZdTeeyVLm/1Qt+M3o4DR5bz4ohSFbslzCQP09QRqWCGpdUqirXctT7ZwXLc1GFhlNopGGYIvRuPQhI6tov6DBrNU0lpg90aw2R+jBuXCWtxcxlnFQnJOrwUnMMxE9gY3T5OIg7+BYTSQNj8JZx1BK5Gd1HOyKxfRs1t9GQ/6xDo9kfo73tXlRgeHuhrrOJ9frpv13YssWssiKNwG1EODik7w3TbVN1qKsl7xUab9XZzk0sltdN2X7p7IpAhumWnvHQg31sAYdHF4/R0hQYOAKZstVUPsk52WSNZ//3vtzydemCM1+UcrC+SZj9cNOgRL3T4yEBtK361R+KV6R89/WF4tSZgGKNyeApKGglBqMGjIh4aj40WuTYYlx3kvjHULDNnjJMA4rk2vsi+39l5vqdTK5z1BUqsBro9oQQOvZVSGaz5P1nk0Ghlncvxxt67h1E3SA5s+rJzjx6do0acAgBWTPown32h/6G/uaP8yJxNIiO/wQ0lD9tXiUA7vud6J1YDbczkkXrz9gsN/jBTzcaktifQdouiMXHSEjbEfA0mJANcj3VcKhpk9MfxanUbP8vBi6kh4aL2YRGrSpDBmpyrehkwDme1QLno0kTYqvbsdjfN04r6dtyjQDOaVE1pPfpSsUQ7k5W3OpvdZtd6z7bfKhQ44yg607zjzrUBJ6l1rSRrX9wKlLnqY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa827c21-9c6c-40ec-5b8b-08daf5b5dbe1 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:05.8366 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4tmrZS6KneDh+V8DCD94HaxelKk6l01bJMEpXEm6nyhl2s+8VpvBldSV1yADOaTg6UIOpbW5bvm0Bh3/cG9EOrinodTrrnRSjFOG1xrcntU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: y-v1TNK3pjDmSLTPAnL_iSYu4xlVEXCh X-Proofpoint-GUID: y-v1TNK3pjDmSLTPAnL_iSYu4xlVEXCh X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754948347117093654?= X-GMAIL-MSGID: =?utf-8?q?1754948347117093654?= Change __update_and_free_page() to __update_and_free_hugetlb_folio() by changing its callers to pass in a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 540f33d8cc51..9155bb5ee570 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1556,10 +1556,10 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, enqueue_hugetlb_folio(h, folio); } -static void __update_and_free_page(struct hstate *h, struct page *page) +static void __update_and_free_hugetlb_folio(struct hstate *h, + struct folio *folio) { int i; - struct folio *folio = page_folio(page); struct page *subpage; if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) @@ -1572,7 +1572,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; - if (hugetlb_vmemmap_restore(h, page)) { + if (hugetlb_vmemmap_restore(h, &folio->page)) { spin_lock_irq(&hugetlb_lock); /* * If we cannot allocate vmemmap pages, just refuse to free the @@ -1608,7 +1608,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) destroy_compound_gigantic_folio(folio, huge_page_order(h)); free_gigantic_folio(folio, huge_page_order(h)); } else { - __free_pages(page, huge_page_order(h)); + __free_pages(&folio->page, huge_page_order(h)); } } @@ -1648,7 +1648,7 @@ static void free_hpage_workfn(struct work_struct *work) */ h = size_to_hstate(page_size(page)); - __update_and_free_page(h, page); + __update_and_free_hugetlb_folio(h, page_folio(page)); cond_resched(); } @@ -1665,7 +1665,7 @@ static void update_and_free_hugetlb_folio(struct hstate *h, struct folio *folio, bool atomic) { if (!folio_test_hugetlb_vmemmap_optimized(folio) || !atomic) { - __update_and_free_page(h, &folio->page); + __update_and_free_hugetlb_folio(h, folio); return; } From patchwork Fri Jan 13 22:30:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43640 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp11611wrn; Fri, 13 Jan 2023 14:33:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXugABBvjyw0Zjbf8KVJiUP6odm4/kqr5ta7893P1Bk0LjoNRIDaIoo+ivDKihm1UqJAr9QS X-Received: by 2002:a17:907:104e:b0:849:e96f:521b with SMTP id oy14-20020a170907104e00b00849e96f521bmr4864292ejb.32.1673649209141; Fri, 13 Jan 2023 14:33:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673649209; cv=pass; d=google.com; s=arc-20160816; b=e516juxkllxQ5ftbFgX1CCnDDcywmUXCKIkzVNUGeuc70Seg+UB9P+f1BKmEmpmpoJ NlqK8G63v7aPpWF3bNdry9pnS6C3qoYHAzpjDrweq5c8sbKZjm8QMirih0ugH6gISwzQ Ir8pLqKCowccafBWrJPcYtEhUhRdelqCpE6C1nwS5O2jJpbTwEB0nC7OAFmmiAC5RvjM d8riZ0W1onRMmdAmMuk0rLqoj9NauFjS1tiDIFGgLjqDrN/Hd2FsRn9JxNsvo94ATKTn oh7sAI6PUvAZQLXDFp9R68rklfB+dGDHiG9y8SipC8XtxXMbLpo/vqmFglCJU9oqS06F jwRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=HWdBF1Wlcs9D9iqHgpLX6ouOUWk7M0HHi9i4cwaLOUU=; b=mAkKACzoIGnkSSs1ARlgsJOlUZiyALHV+aEbGtc2wSgrP9FAlyuoK0Sw3IDHwGx9Lw DNdMR9/aO4s4RT+BNskc79ZwObT0C5bu+9u7DK0NZgSgJLaFAz5YlMRu2OnHD/Jcragj XhzY00c9dEF6FOv8sTghbsKdOdBN/3Hn+nZF34IfhCh49zH9BPDiMf+PuuDziw9oKSTS QfZM1ZLzVLZYHQRrKQ53bW/rlsL47+upp9+GW++PaE4W1A5vish+MiD/HfnDM6Q4GEDg dLublCGzgTafRlGS03S3RsoSkjk3bnnNTqd2ZCF41+2qWe0Pp+VOgE1z5Oly41lJTGIK RF9g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=UENJuRBP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NviBA3+R; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga10-20020a1709070c0a00b0084d7c9a5e5esi16378059ejc.101.2023.01.13.14.33.05; Fri, 13 Jan 2023 14:33:29 -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=UENJuRBP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NviBA3+R; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S230195AbjAMWb4 (ORCPT + 99 others); Fri, 13 Jan 2023 17:31:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbjAMWbn (ORCPT ); Fri, 13 Jan 2023 17:31:43 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9959111C16 for ; Fri, 13 Jan 2023 14:31:42 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DK4LNV017071; Fri, 13 Jan 2023 22:31:10 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=HWdBF1Wlcs9D9iqHgpLX6ouOUWk7M0HHi9i4cwaLOUU=; b=UENJuRBPW6JC9H42G/FhSnfJkedG6DSf/aATX3gsN9YAIET8pf5y97e52Sz9t64Bu3YG 6T+BIkU2lAxjnLNuoKW7Rr07v9mfTPycoEmj/j5Em8y0NcXnwo7B3jxTLmoZev76muD6 D+xc195GpM769uSCepHVO1x0M6zXlTFPchf+D/S4ZnX1KQqfH1r3FEmV8jJOOa0QXe5l ysWjovB2/p4UW66JI4IMxn/tQ8VYeZz7uCuOjgTMZ96zkVBRPSxmUl/HwERG5HPIoDNw FNmjrUbAQpzJYpMxW3iBS8G79e00RbZRe0FngoADuLEhlx8oqi74zf4IHh8UyczgdlhS Zg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3my0btwwjf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:09 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DKwdj4006706; Fri, 13 Jan 2023 22:31:08 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n3etdjkpm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E1zu5bnjXvSRnfZvO+VvggFUVHPszOSXvDhHqMNy6pckr4vnW5f1D6saqMmP8PMMaUheuIEFdKMFkFPlsM+9ys0k8Uciur6efPXzVNGDWzJVekK1+K3rRO4ahEw66+gS9PKOIpOXNNCemha51ZvJqxglilgPFBCgOWEkcpsccKYNs0yn9qWD83NmvdjaukMOQzc5MI1sR7j4uGSZXyMHO33qUoVXm4PWm5bWqXt+Dp1rYtRwtV6Q3kMlnWlSuAVWWFu96HxCeWXs82PkMG6ORqxbnAAfT4jPg2dpaA8TwJSRnLYGf6ZTTzXhQIR4JyLaNXezEwdVOxkNpnbqdhGrDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HWdBF1Wlcs9D9iqHgpLX6ouOUWk7M0HHi9i4cwaLOUU=; b=P7FehP0ofzRDQ6xhoE44m2W0kuO5QtNh8ikVpO8DDmaU6QSYPbUUKakhzEgs53slFlkA9c7OvZIufiJAd7x33HlF5Mg2WZMd2qKZdKKoM5tVIOZnFxjlqR6oJs+vJ/baFEmHgZ7cUhslLYF8xSEtx48KfZgMQjH3WsmJ7T4dLoveb4PN3zsb6yPGpRx1SITLSQTeA4pxd2LebXuWKh96R9+YFJColde62S1ZbfZ5mRl0p3LdqI5GNLJ54B4s4xQ1pc9Sdad9hT5Kb0y9IV8hWmgF8mto9w0GOgXKjSiqJObmUUJkHJVLvnuF3Hji5ShKzINVzv5Atya4jvJnumFcuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HWdBF1Wlcs9D9iqHgpLX6ouOUWk7M0HHi9i4cwaLOUU=; b=NviBA3+RQyD1yy4HVTJH1QjsRviJD2Hq+35K1+7JJL2uSSSOJNzvCm7NtjeijIGFiqdKHddsqjZbbrFqiZFecQMhurh+qy7wYj8wMvE4WMOX0iA8KgUDQGhtxsPYosZMcpbzL00GslI57kch7FzFuDn+VbMuhR7jbYKdj4eNZ7U= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:07 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:07 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 3/8] mm/hugetlb: convert dequeue_hugetlb_page functions to folios Date: Fri, 13 Jan 2023 16:30:52 -0600 Message-Id: <20230113223057.173292-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR04CA0006.namprd04.prod.outlook.com (2603:10b6:610:52::16) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 310e7877-a5ad-4ccb-8c05-08daf5b5dcec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q6GSPKYmSIORPbHfUeUvMuYTTqdKYkmYju/D4e7ODsy9DIFE1W1r/HYkcPDh0htgInvItTPtWt/3HMwwWySrP7G2D5inUiSvIJ9g/lrEoiTc1iA2DowTfZq7R3GH63pNMkR43v9K1jsLA2yWb0oYURbOXZXOG//7D4CYeWzgQeQfbY48QxcuwFDRVZ/vVaxxKhR/mpz6gHuwUueAwk0zN9WMCKRhnK7RbW7e72M4gP5ndbFF+yAafk441pYG9qBxlUL5loBnc9k8Y4o1ZyrFlSAmJNa7u0IGs2iIa5gSF+C2eEr4ni36d/iYpfYn5k+KQKuT8Rrp2xQu/+cKfM++8gWK6b44vyTO75FVheyGHhz+qGmt10H0GMvND1uA4suWkYzMA1ExqxObvMFE0yn0uD52BEhhUPL1HLBHMP9zZ7b672JfhmdgQxTuD288ZKRBZFaRgLjsoeCOw5vRR2wfHnCrUAp6DkhtMdDfPNJWl0HdvxfLuD3R1egcXzq012SYdVCERyQWq5Im2+ihRITHRD/L0Gub1iExT0R60ci16MxedloZ58poLHPBpC/q6ReVgNuvY0o0MAndUlskK4ypp5izT8cVdPgLD5GExGWB++dgtAslNSVy9nO0JO68DWkEXqeCok9cNkzOubOUmUaDZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TcKLX/1KKs6Xz6QfgDdFHniUobMiEuorpQvnpEgmLto02NgK3hhB0GeMj+Dh2q6a1lyTBCYNh4Fi0Z8UlHbLBIGVWVv1GlDOGNY1JV0hQK2gXjeB/Vm6M9ki6dvbbK/x7xtpxbX6oAft78Hs+GoJSBJoj1NuDmjE2h8Ia6oJpJplV9ngNRGH07/l7GyYOLIgv9aCL6+f9bBMhO0p/MlECGfnvLCAGWMgIiI6LPC6mv7RcOryWvRV5nerhW+HPggd7al6tuhnB2bLATDenL1W/F6O9WOXVF1TtaR1IpUITOLiJWCo7mJqWBCHCx2/N/uDMoUj0aP9d0U2UCS/at0oWC8nPvPFCfrrybwxQWrb1G4gFMub6Zb4swQ7WXv3KSYzf9ER73IbiAZzO9yea2pOTMQylSStTJ9X1BT35drBSjv9/mCLC5qWcXvsCIfjJoxQekVxe58PSAEOWw2gFJqVTDM8zUEKJhlH6eZnIW7zaTx5mB+8Q1DqEPkeD4MiXCAccyWgDt6WMh68JdjvPYlqnMJjXURjj2uND6+ZlBhgvrerA8xIxPm41jSdnn0epTppMPQt4z1ieCK/UE7psux7LvwvCDphlO44GPL7dAJgU0qWiRwyrFbqiN1TVoViLumZINNgYLbUgpcFgc+mkPMcLLVqrUJBrhrQVQhonEjSaW+N8EJEb3MTs3b8F3fL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UH62sdNkMSmhwsTqQdIclFyowM0m67ktKNqbOuPL9Y2EqUayvR0lCUaBDp2c3Cr2BeCkN78BN/ut6l3nR4fDnurcsFG7Aj0kBugkon6r8xesgFNSpej5Ig9nIWQBs5yZqnBVPd7p1cZOfdMMvohIRahtIWUkSXewX23WHFCDHy8zJpPxo41IKEna8dR+tLm+gxHqKa5pPJ2rD/sXZbdaDaDXwD7PYYIYYqF3z3okY4x0MSpXMJk8KATdU8OiJgXtQDCd7t2qrIkJAYDz+qL9NrQ3lyePJFlNWZrsA8wBV0jzvliqPKyYZyQNGEmiSoxrsoSVRTW3osGImUfVdAYx0EtgKlRHFr/xdR0FaC5mI0i/QA8FwMWCwH49j8Ic/CT24rvacvKxMkwnq9SznDUVPE27LdVXK+4pio9itvETLsaZ4CrEOnM/7oLNBDQLKfmRSKkCEyzp3CQYOyqfwArHscYbhpoFpANwzgFxVevXlISnkpM+1ImRkh7IL249g0eypJ3d2Y/MD5zlmjUci90oADAFFCy+D8/ANwMN4ZPfdoDTzAoCPLlxCI6axQoHUx4Gxc6OCJYwDg4BcaVHli9E3sdtbIyXN8JSv0+wE36URO1Unh5lJvVZIeIKLtAlLqFElHyw0bx9YA1v6T6tpX7laJrZP6hdKRAF90SqV1S9oW3gzfRWaQeUEaOq8HIJdwZgPlXjE/chi2F0np8+KP4mp/pQnfNx2jG4GdpixBRBlyXUg+OjNp5EYeSL7epL6XTmBFVrl7ScCi410fHEqPNjG7HYr4qPWyyWU8OXG5wbU6Kh+caSthpEPy4zHXG9WVSDibQXv6AWGP7p2tTjkUNeByPKE7OiRIyGorSSgW8TPpIultV8itp7tzPYlyaX6s2JyrVady6j X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 310e7877-a5ad-4ccb-8c05-08daf5b5dcec X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:07.4003 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eXg2HmkNdzZHV8w4wG19ZgV4Nx2d1KOUxc9rHeltLpI/uB/lFFlvhpKUwguQPBwwk/leKh7apEhiib6n7qOkKeFItobwh3B4fixcymqHSWg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-GUID: UwhZjTw3rZ1-cxucN7E9ckJqDl7cuW1e X-Proofpoint-ORIG-GUID: UwhZjTw3rZ1-cxucN7E9ckJqDl7cuW1e X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754948393113705345?= X-GMAIL-MSGID: =?utf-8?q?1754948393113705345?= dequeue_huge_page_node_exact() is changed to dequeue_hugetlb_folio_node_ exact() and dequeue_huge_page_nodemask() is changed to dequeue_hugetlb_ folio_nodemask(). Update their callers to pass in a folio. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 56 ++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 9155bb5ee570..c206a8c1ddb6 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1140,32 +1140,33 @@ static void enqueue_hugetlb_folio(struct hstate *h, struct folio *folio) folio_set_hugetlb_freed(folio); } -static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) +static struct folio *dequeue_hugetlb_folio_node_exact(struct hstate *h, + int nid) { - struct page *page; + struct folio *folio; bool pin = !!(current->flags & PF_MEMALLOC_PIN); lockdep_assert_held(&hugetlb_lock); - list_for_each_entry(page, &h->hugepage_freelists[nid], lru) { - if (pin && !is_longterm_pinnable_page(page)) + list_for_each_entry(folio, &h->hugepage_freelists[nid], lru) { + if (pin && !folio_is_longterm_pinnable(folio)) continue; - if (PageHWPoison(page)) + if (folio_test_hwpoison(folio)) continue; - list_move(&page->lru, &h->hugepage_activelist); - set_page_refcounted(page); - ClearHPageFreed(page); + list_move(&folio->lru, &h->hugepage_activelist); + folio_ref_unfreeze(folio, 1); + folio_clear_hugetlb_freed(folio); h->free_huge_pages--; h->free_huge_pages_node[nid]--; - return page; + return folio; } return NULL; } -static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, int nid, - nodemask_t *nmask) +static struct folio *dequeue_hugetlb_folio_nodemask(struct hstate *h, gfp_t gfp_mask, + int nid, nodemask_t *nmask) { unsigned int cpuset_mems_cookie; struct zonelist *zonelist; @@ -1178,7 +1179,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, retry_cpuset: cpuset_mems_cookie = read_mems_allowed_begin(); for_each_zone_zonelist_nodemask(zone, z, zonelist, gfp_zone(gfp_mask), nmask) { - struct page *page; + struct folio *folio; if (!cpuset_zone_allowed(zone, gfp_mask)) continue; @@ -1190,9 +1191,9 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask, continue; node = zone_to_nid(zone); - page = dequeue_huge_page_node_exact(h, node); - if (page) - return page; + folio = dequeue_hugetlb_folio_node_exact(h, node); + if (folio) + return folio; } if (unlikely(read_mems_allowed_retry(cpuset_mems_cookie))) goto retry_cpuset; @@ -1210,7 +1211,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, unsigned long address, int avoid_reserve, long chg) { - struct page *page = NULL; + struct folio *folio = NULL; struct mempolicy *mpol; gfp_t gfp_mask; nodemask_t *nodemask; @@ -1232,22 +1233,24 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, nid = huge_node(vma, address, gfp_mask, &mpol, &nodemask); if (mpol_is_preferred_many(mpol)) { - page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask); + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + nid, nodemask); /* Fallback to all nodes if page==NULL */ nodemask = NULL; } - if (!page) - page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask); + if (!folio) + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + nid, nodemask); - if (page && !avoid_reserve && vma_has_reserves(vma, chg)) { - SetHPageRestoreReserve(page); + if (folio && !avoid_reserve && vma_has_reserves(vma, chg)) { + folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } mpol_cond_put(mpol); - return page; + return &folio->page; err: return NULL; @@ -2331,12 +2334,13 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, { spin_lock_irq(&hugetlb_lock); if (available_huge_pages(h)) { - struct page *page; + struct folio *folio; - page = dequeue_huge_page_nodemask(h, gfp_mask, preferred_nid, nmask); - if (page) { + folio = dequeue_hugetlb_folio_nodemask(h, gfp_mask, + preferred_nid, nmask); + if (folio) { spin_unlock_irq(&hugetlb_lock); - return page; + return &folio->page; } } spin_unlock_irq(&hugetlb_lock); From patchwork Fri Jan 13 22:30:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43646 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1317wrn; Fri, 13 Jan 2023 15:00:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXsPSMibUX6jTgfiZ4yxmwPnfKyKGdeahgmtO75NrcFQsmt8E6XNdJczJop/tQke2H/9mjfj X-Received: by 2002:a17:906:8ca:b0:86c:8f4a:58b4 with SMTP id o10-20020a17090608ca00b0086c8f4a58b4mr1093731eje.13.1673650823059; Fri, 13 Jan 2023 15:00:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673650823; cv=pass; d=google.com; s=arc-20160816; b=gi5ZOQwG87dOc17U1KSPp0C+pZVgRF/EPXZeUwC3372zTuCjX6PIHK1X3z/d7P4jkL 7rWPNpdeEafemj4hNEr7M7My70H4m7WgZLZheI7h52BTTfAV/VYhBEu9gW3THIj9/qeZ AFbpHF/runL8kRe32QTRuYn8Rpdw46SzyZPwJhRDbJ1ZEQQ0pn2lhMCEHH+eM+ZD5Z1a 7S8RUIcmeJuWeLjhzwM1OicMC9AwmiCkADJGqx1x0bFcRNIJKqztNeE4txgfOrw0Z+13 UsDSZuyTcIbbIoMX1hM0rvUY05ydEFP7HMZkooAbuyJkbGEItyaXcB4+ms0BCoi7n7CW RJ/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=8LXZYJ3IF5YwIJs7/2QVzJbgQ0tay2z86vhYBUXlFls=; b=0iuZ++XM/IxW2T2BH+5qdKtoxuz/OL7ubYhEGr9Z0IQlv7F6mrx4DyzAjfPkBN5JEB gsORWtrBYTI3gCa8FIiZ47ftMuX+NNWS0LzCdP6zLzQWk3ygO8VEXtR4MhWtUjCTkpjY rDeBGjiqWQeH4qYqOdgrKQZkUuY2XZA/ieRc2OfOHuJRlSPk8ka2JdKUKfw5cE4NLAyW xRxqFMIBv1j5RfhmxW84kGsKyosvWqZIVgEtQIDtG3+Tbvy6RE6dLjad4NFXb7bnJ6G4 wSiVTr8/BSK2UlCDRbLK+/BgdgflWIXpWtt0fWpe83Gh/rqceZPsoyTb4iKvX8l0qDsT wRug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=cymAnCJ0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqKY72Dz; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ml21-20020a170906cc1500b007c1479b6a89si9521571ejb.823.2023.01.13.14.59.56; Fri, 13 Jan 2023 15:00:23 -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=cymAnCJ0; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=uqKY72Dz; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S231315AbjAMWqx (ORCPT + 99 others); Fri, 13 Jan 2023 17:46:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230391AbjAMWqv (ORCPT ); Fri, 13 Jan 2023 17:46:51 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F64A7D9C0 for ; Fri, 13 Jan 2023 14:46:50 -0800 (PST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DK47gf017334; Fri, 13 Jan 2023 22:46:26 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=8LXZYJ3IF5YwIJs7/2QVzJbgQ0tay2z86vhYBUXlFls=; b=cymAnCJ0l5okh3YPHT1RkPIRHOwWDAIU8AjWERzlrPJSsu3HjQ3CthmR0hF1mQiKpTJo ztP1wxs+iB8u2/S5RvchhWC43tbW0gBzuxnyh+3MhnzjMWlqIeuBcV/tdOwNJvHM11mN ER7lkIvfQR+AGUJgi7ys/pa6DtHFHM02oUc4Y9JMeYJGA+tLGsag4ZvNiWPxzNYpOj/4 TXYR9IMPW2pQaLafS67S/dsLjwSgF+FDbqik6uHSWtAjgpJYR0LP3pDmi5zOj0UHhgKz Eg3pcmXrIvkiMqNgE3AhmsO8CENs+OQ9AvxGp2wIANNT+rZ3x7YYGVKxH6CkNMFz01L0 5w== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3dxhrakw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:46:26 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DLRUnj004403; Fri, 13 Jan 2023 22:31:11 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n3f7usqt7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R3uCTLA4abyH2sk9K35xHo9IIcjUCK9YRr7TzgpZMGnoiATaZ/+FNVJlASE4rssoojkR0ut+fBlkLEatY4+ihehwnLkKow4xfidbR7hZhWnwUQ584Zz9AvXxKbACJpicrNRampd9viQ6Pwxx41ETzpRXjP+pStyS8oe+lB4Ow9hxElksXI5XYJBxVMfhQO+LeG0mb2wGkz5hzhZS5yvr2v0NAvJXP3npzfJ671+ZNrt/0lU1KRNUzRhvXJefPSwNApARdvtgKlxgLWw8pH5trnDomS9rZPRPySdzjzghNIFjVe3XrLSc9gRLZFPs5R9zBXT26+4D21xcYVi1j9gMDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8LXZYJ3IF5YwIJs7/2QVzJbgQ0tay2z86vhYBUXlFls=; b=OC8mLe8og8X7fRU9TQYzwyTOMW3oosey0g9PL/2LXeUaHODsM9h4oZcBkBKBgM0/btxiSZ77uAPLGgdP02QZsWEEJp/cMCcGxpySLLYn7j9ouEsBcCOWkIBqPitvJ1G/gFqaLj7/BdOaSDr6AO9Tq+CQjmMrrjOaOotVgdqJNEFlUcY28kebUttxV9cJ4mpMH8Yza67aPPGIY2IUaTZIJ/p/DqmgkCclBkIFDciYwibogkQvtr1/D5StZlGzTgYKLNgQzh25yzQWLtgb/B1txJb5uZAzXgF8zXiliOi1xmJgknRO2nqb+A1EziQs75SCZPaQTSAblg2mmQrF1Gyimw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8LXZYJ3IF5YwIJs7/2QVzJbgQ0tay2z86vhYBUXlFls=; b=uqKY72DzuOKJ1JkbcI+Z2oowO4Qbj1kY18tGHmJaMWdXJnFHYBkYf8etKoJtVFz1NTr+J55b2z9/39kvZxEHJ8zsw+IcC4ML6iFLbJYIad6FcqJ2VjL9URxGEnRj7r1TR38Fgh8aXIYukTWe2f9oOc4zeAChK8k0v8SbZFgIfgo= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:09 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:09 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 4/8] mm/hugetlb: convert alloc_surplus_huge_page() to folios Date: Fri, 13 Jan 2023 16:30:53 -0600 Message-Id: <20230113223057.173292-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR20CA0008.namprd20.prod.outlook.com (2603:10b6:610:58::18) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: e58823e5-24f7-4fce-f206-08daf5b5de11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gTvO80LArocnoz29rMdmL3a/tMD4DPxDHUI1vZkk+vJNVTARnnjHBoLVNtqatFjL8FanrL7niPfdgeSQjr33asiGecWfNmmrRsp8ZozmoEa5LKEoUcfVwKnIh8izeLLNH81NzXXSyJ3Kg0hUk8PWw7hrUtMsdINoRyTo2U/C+vwOHEUsRikW9rjCxmwUD3dgdcN77lBmflu75N4O9EFpGeJZTCnPIbSPwvVSteb1gpXzitBC5iIV4eJ2Y5VviuqyUV0WThgeK5+SGZ70KZ2UPOPmJsMkohI/lj/YFX75rSlb/n8HpJzGMqiJXn6CMEvMMah52adtF0PgVKACaFbbZ6vFKSk0Fz8jP/NmXm8ZcbLi9sSnYJXHAxydnpiWizzul8jgre5DSSNvrR5ov8YGyozhEflpYfO9Hhav948I/o+3otH5/QXgRw2Jsdp8FKx3aSr7+cwZoIgmXmriJF6zM/g3CZ/k4gjNMpcCsdl0Qq+el4eiTF+I+RSiaVxxuWrriuS3kRMYcSwbRKR+9Hf7Knl4Ftvk/HnZdNAdDcgcfK+P0Uzxo84RiEelUwh0ii5YvnBtMtMETMd3ufFvVX/dSiLmsSQS5VGkyAQ7HMqrY8sjRl6AuxQTYG3HjjM3igK3UfxuhBzkq4can/bqziGr+1mQqNdlBUlL3Ue0KCP0FWP0APR/4AKskiOtwLxAtPff X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Cg6t8hDArrPyPIYL1FbJc0yc8hMbE8cTOxJQRVjPDQdMBo8COQKP6WXH+vn2FZwN2BkQXdxLQ9oHhbov/eU50uGkpkVTLakZ1mhyEdEqA7rF6EgW22VvXmoyhErsQVMPMh2UM/lUJNWsDQObSpsVF4l2C1qJf7x1fesVLn3RXFt1omfMcX/bnLDLfp7zAisCJFRTx5hTW3U9CLb92NVsrOa7lqx1q6mUAloQvOXtV+nyuwR/Y7BRjrDSPNb6abQe5HuL7Y1Iz6qqcd4DIGxB4PsQXd1cBLBCxv0RZJZWDX31oiNMgQKOCqGgVzFTaYLHyajahKRbHY+VBtWAp7KASPSCOl4GwEgCGSbIS/PjMaklQvM9LVK9QEg7/qIiKup5aQTw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ULQOwSIYO57dtF4d1P1Qq4TunzNk4O8I0ibgsoN6K98Qt7si9qlBVJrp+KHigc11HghvWTaOdOAnuZURJsPF7iKCHT9BEtfVTkrAIkP8fMeI8OHGEv3UO X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e58823e5-24f7-4fce-f206-08daf5b5de11 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:09.1043 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: zBOg0Ugfg73IHrAXgbeVylyIuV9UJFDx6J+LHP4FJ8XKqFqk9GTj2A4lzLzsCsI+OOvLxaXwXXw1E2/kr5lKvqdoHErElBAno63Rm9Cl/aE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-GUID: NdggC7Npj6So1PRF5CqSQuW-W_2iMWe7 X-Proofpoint-ORIG-GUID: NdggC7Npj6So1PRF5CqSQuW-W_2iMWe7 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754950085238124500?= X-GMAIL-MSGID: =?utf-8?q?1754950085238124500?= Change alloc_surplus_huge_page() to alloc_surplus_hugetlb_folio() and update its callers. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c206a8c1ddb6..62552172683a 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2234,8 +2234,8 @@ int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) /* * Allocates a fresh surplus page from the page allocator. */ -static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, - int nid, nodemask_t *nmask) +static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h, + gfp_t gfp_mask, int nid, nodemask_t *nmask) { struct folio *folio = NULL; @@ -2272,7 +2272,7 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, out_unlock: spin_unlock_irq(&hugetlb_lock); - return &folio->page; + return folio; } static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, @@ -2305,7 +2305,7 @@ static struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { - struct page *page = NULL; + struct folio *folio = NULL; struct mempolicy *mpol; gfp_t gfp_mask = htlb_alloc_mask(h); int nid; @@ -2316,16 +2316,16 @@ struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, gfp_t gfp = gfp_mask | __GFP_NOWARN; gfp &= ~(__GFP_DIRECT_RECLAIM | __GFP_NOFAIL); - page = alloc_surplus_huge_page(h, gfp, nid, nodemask); + folio = alloc_surplus_hugetlb_folio(h, gfp, nid, nodemask); /* Fallback to all nodes if page==NULL */ nodemask = NULL; } - if (!page) - page = alloc_surplus_huge_page(h, gfp_mask, nid, nodemask); + if (!folio) + folio = alloc_surplus_hugetlb_folio(h, gfp_mask, nid, nodemask); mpol_cond_put(mpol); - return page; + return &folio->page; } /* page migration callback function */ @@ -2374,6 +2374,7 @@ static int gather_surplus_pages(struct hstate *h, long delta) __must_hold(&hugetlb_lock) { LIST_HEAD(surplus_list); + struct folio *folio; struct page *page, *tmp; int ret; long i; @@ -2393,13 +2394,13 @@ static int gather_surplus_pages(struct hstate *h, long delta) retry: spin_unlock_irq(&hugetlb_lock); for (i = 0; i < needed; i++) { - page = alloc_surplus_huge_page(h, htlb_alloc_mask(h), + folio = alloc_surplus_hugetlb_folio(h, htlb_alloc_mask(h), NUMA_NO_NODE, NULL); - if (!page) { + if (!folio) { alloc_ok = false; break; } - list_add(&page->lru, &surplus_list); + list_add(&folio->lru, &surplus_list); cond_resched(); } allocated += i; @@ -3352,7 +3353,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * First take pages out of surplus state. Then make up the * remaining difference by allocating fresh huge pages. * - * We might race with alloc_surplus_huge_page() here and be unable + * We might race with alloc_surplus_hugetlb_folio() here and be unable * to convert a surplus huge page to a normal huge page. That is * not critical, though, it just means the overall size of the * pool might be one hugepage larger than it needs to be, but @@ -3395,7 +3396,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * By placing pages into the surplus state independent of the * overcommit value, we are allowing the surplus pool size to * exceed overcommit. There are few sane options here. Since - * alloc_surplus_huge_page() is checking the global counter, + * alloc_surplus_hugetlb_folio() is checking the global counter, * though, we'll note that we're not allowed to exceed surplus * and won't grow the pool anywhere else. Not until one of the * sysctls are changed, or the surplus pages go out of use. From patchwork Fri Jan 13 22:30:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43647 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp6834wrn; Fri, 13 Jan 2023 15:13:21 -0800 (PST) X-Google-Smtp-Source: AMrXdXten075ULlEuYQy82v4/N5peRc5/hrIhVJxcO0IqukJJzUH9QlvnVrl0JvHuRKvc2GEyuL/ X-Received: by 2002:a50:fe86:0:b0:48c:bd9b:1fa4 with SMTP id d6-20020a50fe86000000b0048cbd9b1fa4mr47880663edt.10.1673651601361; Fri, 13 Jan 2023 15:13:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673651601; cv=pass; d=google.com; s=arc-20160816; b=ZDN8N6vcHhTcXuWMcLuwNSrGZobbEnn2N/8XKW7vooj5srQGslSF12PR0903lnXXJr qBmqKpPlQZgwpYDweihYU3ghJJY2ApmCLrgTOZU2kAmsHB82zRInSt0Sa7DSVCbmOP4u bO5XO+fEoW3yr/rcc+Le99Lg6Oss3bh1WJrGkldELFsO3hZYJ3oNE5VCbVQuzLnWYejT lBs3zSkPrIghAqlgxPDmEReIJAIeDbMAY4+Ax6XONCGvdtKp2pKKu8Zke0mczmbgH10s DmA12kiOQ69Cjczdj8ppuhnbjcoiAs1RQGFRe39pg6ZJha3heQm1ug6mGPrSaWgjVYIH k25Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=vhpSeVdJJnxCpbVJjLdyO4qMjcCDvPdV6wHcHyUDi+O3qtz7p728Ko7zzIMgWpEBoq e8oavLGwY8N6q/FhIsArNuDlcfNSKWHLhzb6IlSYORmn+Hht9U5Cb1eK/e4KL7CFHaci xsERCeWep2MTt1PXOotPTFsIYCT21393FJBKD8vHhZDaYscDFeekTBfeZCNdfIoRvJoq 1FbuhNfe5RC6HN+byiYVBt48qorhP6TJyf+ZxdHex3LB7YSJsOYuCGuV0idaQy66VIjb emrSN5yRB4qz/XZs1TpiMaZaC5EYv98Vv9DspMR9R+TqZSu4kXh7ox+Id00kBsKxxb89 vtfw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=anG2gdXM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jPCUEOWx; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l12-20020a056402254c00b0046baedff35bsi26741840edb.291.2023.01.13.15.12.46; Fri, 13 Jan 2023 15:13:21 -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=anG2gdXM; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jPCUEOWx; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S229992AbjAMXCG (ORCPT + 99 others); Fri, 13 Jan 2023 18:02:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231374AbjAMXB5 (ORCPT ); Fri, 13 Jan 2023 18:01:57 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3C684F8D for ; Fri, 13 Jan 2023 15:01:53 -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 30DMpBYp008226; Fri, 13 Jan 2023 23:01:34 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=anG2gdXMW7cw6oPWnrP9UoMR4ncSrGYHV9H7CsvfqQHKVZbDPLWLfiOER/CT2oHvC3Ns cokkWacXbDtBUCg2zW3urVbppuzyFObyY8yUOIw6M1MfXQEAr+0OKM5ZgMYCsNkzIubN eilZvYafHxklzpvism0fJCxpnFQDxoCJAwrzA9ev/zmaNY4tyU33l/sb3rYV2+RHkTC/ 6dSK/XyNxWeRTKe5Pn5yyWcFSAoemVTrE0FhuAziAcL2DMMfOmHOKyhnuUBFGYEUqyse QJ1cRyX0DrTIkOMMqDpFNS8e0gSHzSwlEkJ2cc4U/LF+EL+4/7GPAE8GeOhUd7kQOy7P qA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3e0w0adh-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 23:01:33 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DLRUnl004403; Fri, 13 Jan 2023 22:31:12 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2175.outbound.protection.outlook.com [104.47.56.175]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n3f7usqt7-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jA7hJmk3W/fHax6ZoaehiIWRKW+1y1x48Eavc1xaC0Xaa9fAQ18IpUF7EWL+cQsMsws7Jp4uhofqb7JKLd4uI4XQeL0bpKTWfGRRm5+sIoIDxj+PXJ2ZLt8Xnaz74t5eHu4j0kYg0aRDWCQfzWSqjP6tRWiPx/mBeFphe3wBXXwHAEKzv5mqnL77q0SShj9MurfmwDZnF5tmXmnnabApYE4dijTUvlpD1yGqwnXZKkeJOswXNBL0+v4RMLuVtFNBdQgS0UohdkCOjatCyUyJ5F5Kzyc5xwI0+qPRPCgWQ7UJmXcmfYxd0H63MtbuHdZyVREagRhkn70pJpxZILjQfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=kMcqHD2RDXSG84haPC/CevD3AgAfup5DTcvznQEMBlmMA8wmhfiizuCeW2E/MMkKN4rBWE7jLPyJfSR0G7RVndLxV/jQOeV8Rxx3zgUaVIXY3IetPTLb/kevGJueSByaPqUUN4wBaF3MCgCwLeE2CITcYljPLST5WCj6qx58uXyzhW7fWrT57D44OHByJY5Aaxmp9aShLKScKNxISg9T0NUN/X1T23xajnF+8qWAhhDlNTUKZvhuHRLyATO6Neu/v5YCDZNTx+sY02GHm937GK2Ow/EzOUViqjyR889pXt7piPdsWr9UZ/ah3zmPYa7j9kTAIx6iBkUIUq+WQLKi4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ON8r4iAi/C54BL7LxCnv7ms9x+EBmJEmmOUIFctdR/Y=; b=jPCUEOWx3QM/CeQAUyg5Cwk926fAKdqFSUI3woPtJfJJswW8XN+2dBil/GA62OLLem2AmfFMoKm683AUBHNlMiM/mIizpnFdcp7mDwB+mBhcp9aahYq6Ix1KqNlECg2hc7SUzsMGHg1ZtFtcgaBoK1ZTQF8nKircj/3WBPR/SMs= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:11 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:11 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 5/8] mm/hugetlb: increase use of folios in alloc_huge_page() Date: Fri, 13 Jan 2023 16:30:54 -0600 Message-Id: <20230113223057.173292-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR17CA0029.namprd17.prod.outlook.com (2603:10b6:610:53::39) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 3429cd2d-e3ec-4886-bf0d-08daf5b5df09 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZLRF5rQAm9caLRK+zOZHkn+oiyr9zLq/BkMigmq2dNjNPOBW6x4+rofg3s5yDIgO8pK48OeoTgKxRfZIRrNE+8CQY/BgsVrSmUnf/wML4R3t8CLFomWqQopPHSsl8rowieO6LO9F7O3Rs5OZGfLJPRmtOBVTzJY0j/f28GfH2mLfVMzImqoa/lDQnG6BdY2GxAga2uiv2rCsLhANTupUY4r0n1veIQeK9jPrfXVoBRIKxl1Z0ckX7M0HUq8U0/XEghv/tQZ5Jr+O3qHoQQ5EVz4fS+q9eqgzJVOk2cxfLDEeXg/rAXthc+Vkr5lgOHpRAlEqssCt+PxogqZy4tZfGWDAU7Rq2pcHxnMiic830ZEyCoSNSLy90uezlI4S+6fMnz4JkctltwJp7sYpWklMkdDrKJi7vodO3uqKVcYKuPyojWoj/4FFnNrVYD/pKz2vHQUiaqq+MdJeib++kJunKryYjBAXjEGFcLRjiDMyb5T2tWB/cgFbL2Uda6CMUSLWPWD1o9HRGfYvWHGdsRxWHyK3ub3PQ6ssBEt4HmkDWg5cRvM7SgOBqt0zR1CHiAGhGp/E4fcQhnSOt1RRTm4j4oIRNEVda6bG0iR9ojA2uso7g5DhxOTzxqqF8XDeduMS80/gMyrwDpjtRbOUhwJp60GvHLvDCHQoxoUbQ8YG0UiMMrtB0KwfvHLRXuzF3oWa X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I7Zu4/edujXnc2bEX1bfYKj7hfVaHMNFpqpVbw3mGOT3d8KXalFeW+vsFFDOGc69zxT6Z5JaMqU18kjDSCK1aXJZTHfehq9lopNIDSg0iCI2lLSL5LBSYnqAqsbizzM47rJ6+NofNIGnoLUIl7F+fR7A/fZY+wkb2wps4A7qYNpAEBYesBMXjxwWF0u71Fiv49vKh2BHYTnR6d/UK5tngirkx5eigz0ap6hT4ABgSDrlDC8Sa37V8BGpv/FfHbyj2xLNej95JmS7YQW1SU0ViVKzZZW2JNwJL1nqhzWNXOwYj9rC2qaVPUmgg1nYYQxMii8eblCeSQAKotsFZt+X9km7Dzinzf2Me+qJBMtuajb5CSI0HF9bMzGmi1U47YQJBwrUxZ1zc/jb4jWQHHvdX+9FM0t5xID00M6YY4ytdvRpbS/EdlYwm3Qa86UIJGnv0QzW5uDwdCXk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smdtM1Hz7SOO4veO1MkwSoSKnAzaD4OoFION1wODhxMlLBx X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3429cd2d-e3ec-4886-bf0d-08daf5b5df09 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:10.9002 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hMue7lt5AlYJL4l/w8TZm1nBMO657m+94J/gx51D74k0d0MVD5IJlzRYEbROXjh923EHPPzV5hag2CwArAjBT+NJkZSlitnZ7yijwuHtpuA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: 9jFQFCRsq-ngaknBfjWp_a2Dhaz2fNDD X-Proofpoint-GUID: 9jFQFCRsq-ngaknBfjWp_a2Dhaz2fNDD X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754950901507737935?= X-GMAIL-MSGID: =?utf-8?q?1754950901507737935?= Change hugetlb_cgroup_commit_charge{,_rsvd}(), dequeue_huge_page_vma() and alloc_buddy_huge_page_with_mpol() to use folios so alloc_huge_page() is cleaned by operating on folios until its return. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb_cgroup.h | 8 ++++---- mm/hugetlb.c | 33 ++++++++++++++++----------------- mm/hugetlb_cgroup.c | 8 ++------ 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index f706626a8063..3d82d91f49ac 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -141,10 +141,10 @@ extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup **ptr); extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page); + struct folio *folio); extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page); + struct folio *folio); extern void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, struct folio *folio); extern void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages, @@ -230,14 +230,14 @@ static inline int hugetlb_cgroup_charge_cgroup_rsvd(int idx, static inline void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { } static inline void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 62552172683a..f3e1d052b40c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1206,7 +1206,7 @@ static unsigned long available_huge_pages(struct hstate *h) return h->free_huge_pages - h->resv_huge_pages; } -static struct page *dequeue_huge_page_vma(struct hstate *h, +static struct folio *dequeue_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address, int avoid_reserve, long chg) @@ -1250,7 +1250,7 @@ static struct page *dequeue_huge_page_vma(struct hstate *h, } mpol_cond_put(mpol); - return &folio->page; + return folio; err: return NULL; @@ -2302,7 +2302,7 @@ static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, * Use the VMA's mpolicy to allocate a huge page from the buddy. */ static -struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, +struct folio *alloc_buddy_hugetlb_folio_with_mpol(struct hstate *h, struct vm_area_struct *vma, unsigned long addr) { struct folio *folio = NULL; @@ -2325,7 +2325,7 @@ struct page *alloc_buddy_huge_page_with_mpol(struct hstate *h, if (!folio) folio = alloc_surplus_hugetlb_folio(h, gfp_mask, nid, nodemask); mpol_cond_put(mpol); - return &folio->page; + return folio; } /* page migration callback function */ @@ -2874,7 +2874,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, { struct hugepage_subpool *spool = subpool_vma(vma); struct hstate *h = hstate_vma(vma); - struct page *page; struct folio *folio; long map_chg, map_commit; long gbl_chg; @@ -2938,34 +2937,34 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, * from the global free pool (global change). gbl_chg == 0 indicates * a reservation exists for the allocation. */ - page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg); - if (!page) { + folio = dequeue_hugetlb_folio_vma(h, vma, addr, avoid_reserve, gbl_chg); + if (!folio) { spin_unlock_irq(&hugetlb_lock); - page = alloc_buddy_huge_page_with_mpol(h, vma, addr); - if (!page) + folio = alloc_buddy_hugetlb_folio_with_mpol(h, vma, addr); + if (!folio) goto out_uncharge_cgroup; spin_lock_irq(&hugetlb_lock); if (!avoid_reserve && vma_has_reserves(vma, gbl_chg)) { - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); h->resv_huge_pages--; } - list_add(&page->lru, &h->hugepage_activelist); - set_page_refcounted(page); + list_add(&folio->lru, &h->hugepage_activelist); + folio_ref_unfreeze(folio, 1); /* Fall through */ } - folio = page_folio(page); - hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page); + + hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, folio); /* If allocation is not consuming a reservation, also store the * hugetlb_cgroup pointer on the page. */ if (deferred_reserve) { hugetlb_cgroup_commit_charge_rsvd(idx, pages_per_huge_page(h), - h_cg, page); + h_cg, folio); } spin_unlock_irq(&hugetlb_lock); - hugetlb_set_page_subpool(page, spool); + hugetlb_set_folio_subpool(folio, spool); map_commit = vma_commit_reservation(h, vma, addr); if (unlikely(map_chg > map_commit)) { @@ -2986,7 +2985,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), pages_per_huge_page(h), folio); } - return page; + return &folio->page; out_uncharge_cgroup: hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index d9e4425d81ac..dedd2edb076e 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -331,19 +331,15 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { - struct folio *folio = page_folio(page); - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, false); } void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { - struct folio *folio = page_folio(page); - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, true); } From patchwork Fri Jan 13 22:30:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43641 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp11615wrn; Fri, 13 Jan 2023 14:33:31 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfyuyQEOJpiqMEWRUc7ecnqVX7ual9R8nPOugoBNgbay51iMLhujnAKrArL7zA8eQur3bR X-Received: by 2002:a17:907:6d0c:b0:7c1:652:d109 with SMTP id sa12-20020a1709076d0c00b007c10652d109mr87294388ejc.35.1673649211346; Fri, 13 Jan 2023 14:33:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673649211; cv=pass; d=google.com; s=arc-20160816; b=RHXgciuMfjdg4C8+pHrCzsOO4Fx5Qsrnpuoee4Qc4v0p1ylFK6kfjtehetZMSitB6m 62XpVuHJ/fZVfP8z8SZ6iU2NJsUJJY+bpQx+wqotE6alUd6hY8/usPrZa/ks7smLfZVd Lja35c0AuVqxkg/TIAuGx1EIj0kSuI2nKxAKWI9CJNhn83LN+THgP7DiiGsD4TDW3mNN 8TAiTjBLYpRP5Onpi6CZY7xR0S9PO5ARRLBsx8BRZRgujjJ+CYvsMd6hqvVRXanlFTVI 9jgZvsKwgOObfd/Q2obga+qKTyt4iDPUFCtVG2orS0jJRqhoxWufeR4ZX+MU+hBH253e bNiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=/QULkUox5rmihInJovSFDI1yjAOFhDzEXSOdbMBjXi8=; b=BMVqtkqTSWVQ7/r0120kJe4/+qWHnGtW4L4xAHgTaJN/9vJc3PficdR2hJQDzyljvy djs1paO+0HRdxwPphEQj5SnL+5SKoatHu1POk1MbVcW8nbJiHMyB+YQprFR51nfDH2/s cTTyBVMyp4SD9WSuF5IR6RLeYwx0sGg3FZzdf8ShCQTMbmRqUPWDUNFmHysYawZPBuU7 62lPW8qkgnOFcvPr2SAqsvDdTqVb1t0GO2Qs8b1KMhdNqkl1JZJ/d6zSGvf0qXPh9Jmz LF75kImBbq3U7BoXpautZiY/oZRPT67toylFbmLRDvR8NvcVkrnAs42BWWoV7YF8+gnB u+dQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=iLFI+vkU; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kW246ouD; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g25-20020a170906595900b0080e1b35ebbcsi19465895ejr.453.2023.01.13.14.33.08; Fri, 13 Jan 2023 14:33:31 -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=iLFI+vkU; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kW246ouD; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S229883AbjAMWcB (ORCPT + 99 others); Fri, 13 Jan 2023 17:32:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjAMWbp (ORCPT ); Fri, 13 Jan 2023 17:31:45 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C9A076EC8 for ; Fri, 13 Jan 2023 14:31:44 -0800 (PST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DK47Qt017331; Fri, 13 Jan 2023 22:31:15 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=/QULkUox5rmihInJovSFDI1yjAOFhDzEXSOdbMBjXi8=; b=iLFI+vkUqFXATgbCM7wRE78BgT6H49s2Q/Uti8bH6Q1Ha8G3PrKC/h2TfPC/xrMDQtzh YohNFKVaYkbheuc1vhvdaogbwkxXsNfIdOWfygmuHN0i+y8tIXJ/uM33hJ7ecbxP17zd d04l70T/phwWDYYqgNwR+rZNw44c0w9JpkzimNHJlr9/MN3+YXDZzGbHuw0ldWJvq1tn 0hnWA7e+fDdFAbYB3yccnsnRGZSjf9mypZBC4uqf/FmBm4QzwVoUhLj7jbr74toMFBQa B4VzKHKshdMvFdoKGSGgC2n/cht901omCyX4iPhsP5LRnT9HUUTicvn3Vb9GCjG4yPcn 5A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3dxhr9xh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:15 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DKwdPU006693; Fri, 13 Jan 2023 22:31:15 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n3etdjktp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VpwIQYacfImDES80svwpo4TGMzmcKnZHIDH15IxyUjbz6Q0GbV0bU6vO0w0yrmVlaUC/rQ9jW+6MnXFuWDM85Hjj7rCq0nBQJ0KERBiBFXbjhm2VBn3xbF8Z04mP2YdBIv1TqLwbwXhfSEa9TOj8Sk9LC6J97TOLh8AWhnJzj+D05dbS6h+H36mSiDMZ1N2W0D+m2DhLeWeBJL1ndb/En1+SEMStjHJaHmRIcaQv9I7+aS/wPiLF8VQp/uMprZhxEy3e09hCD7Pfnup2LSRTqQzOdTljuEj+hyAUVVeyDv9tNQqs+8XIb5hU9X4idMNVUVbG4FlT9+i9fUQYSIPGuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/QULkUox5rmihInJovSFDI1yjAOFhDzEXSOdbMBjXi8=; b=cfRk4baA57e5YfF/Oho5BfKvg3oAYi9ffgq/ItHGAzM7dF88X/N6e4ZW/Sh6QU2JVnPxwHlDz1I+uvUmhxx4FyPKBlURje3nE0NUhqdqaVS+OPbWigfUnycKydiBzIm4BPyCSwSBLQ7+UIeg2BKOczBHCGGXg63lyc4Q2dlnqf++I/SooLJuRhGnqTVOYEJ+P2R055aGbShAIzhUxse8u0oAExfukh98z5gMMwe0+BExZs4TAuepbEllJn4KyK/QF4HvGzuzlmHTjlt0agd2Bydm3j2TDgZwxQwlwxKnfJZt2BLys+IpkNgVdAexBmSoXXBo0TfTBJwX4i9m3iGQmg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/QULkUox5rmihInJovSFDI1yjAOFhDzEXSOdbMBjXi8=; b=kW246ouD5xIROEDXsbwVEafuJ8oL8MQAZpbmfW8tlomQbUnZa+a3OsGa8YjzQzaRej1KpSUvBE4OoqNp76NxdA0NZOuTNKQqpXloaoPxy84bfdW/J+M+fzIaLPU0Kg1kSuTaPgIKi+kuoebDWXcye5s2esvCZWZo2+Q/KrRnEH4= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:12 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31: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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 6/8] mm/hugetlb: convert alloc_migrate_huge_page to folios Date: Fri, 13 Jan 2023 16:30:55 -0600 Message-Id: <20230113223057.173292-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0199.namprd03.prod.outlook.com (2603:10b6:610:e4::24) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 03c70bdf-fb1f-4636-60ee-08daf5b5e00b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s5idka6sIibe0a8L2kII7BC/x1/ueSCov7s8o7QoIf7nArJZMJRdoOCYn14OEamjoPihBdH05tgFKjCtTDnoqyH/jXGYMN7FKlPPpjcqN6IvGUO5C7aB4KHVcBDaOvGJFGJRN7qHTNN8RNc3r5w1WMq92ovQk/VUQ/BRYZiEKk7VG5lnFCWafdtVUQWYyvYUy2jYZuSYd1JMEBxfIgo9xLwvCDrgvOlvfw6e2Wujii3wh/UcJ5cfmYHhpHd7pRgxlEWSdyfg9qqAl9WamLdzX35dBot/IuUVVrLWvFuoDPnpzhmpOlPgX29bLNH9iraTLSrYYv1G36DZBIFmREvGHdKOQnFwegKhOZRmXZcEkPDmE4PxryRIDHxUCvLO5aTfy1NFag9A0O+yGmcF0I84qzM63R8/XocJ7qNW4XnROlkN+GTVyLBPmm5qAVAMQ3lWBehcA6fkiCA+18klLYLGsBJEzXQPMc791xGcgbcIF8CrhppomSbncHZ5EoVY/Tle612ZhrbR1/loItIG1UBp7SwaJFYu0OV7SJYS0rL24nQFP1udXOv64A/k+EVHapxNwjTw0tU6VmCsJOgIjZKGSX5mfpjn/thKJoPfzqIiainwDKXe7bOcBmlKRQ/mNvN5uvHuN9+1lL9Fc4ANCatmxb+61wK4IutZ5K8kEEyHTwBp0o4O5TgKRwaHEVEG/6e2 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: On0CBKCY/2wAeT1JLFLoF5AqaNEE4qvbwY/eos4Jt214WjxIkiJi7fFA4CYMFOiMmSqoM83tI7v/wazLwFvXQWOMe3gX4sU4bxq5Yu9zPPGFKtErPAqNWHKCtvesZkdCbjL4v4Lz/dKKGxQiLcG9rYVMamIeutmFOfJxmAttfBGT5DZO445ZlOBeAAMNBYGycE9MMjFPhkmyWmlXry+gxRo6kX+O/cOXK3Vr+nc+puyvW05+6dVSjsuLtKr3RpHBe9EY9QRAOoExQg88dZ9J0YNyjf4hjHQqIY3tunQwmMJWaD9b7zYZiuApPgCn4WaRRjUuP1L9ywnIg1T4Q4TmxPZYlXTrsmreZmGQRXSw5oFn54pOhHkgQIqauAQ4IQrsCLw1RX2jjBb2Hx6lu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qBTSnKQPPHEskXy2EeFlPYDsstSGaoSoyjJDcan5jrPvUTY+6G8lOlvos7VuU4sUmvZCmFOggeQE1PwHkYhgbjfhXPpoIhgSOzl X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 03c70bdf-fb1f-4636-60ee-08daf5b5e00b X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:12.4480 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: yGlEtD9Ku/4TAo6IYCBlqMraL8XB1bkn/4b59Wtt6QT0DyrqRedyWjbJBjaYKQH9qsWfthMMaVL1qBRGspkMi6S/TYjTGa24KplPs+/jh/4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-GUID: ncM5SHMg8SEG6cti6XMu2woIi0VAkiXF X-Proofpoint-ORIG-GUID: ncM5SHMg8SEG6cti6XMu2woIi0VAkiXF X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754948395440173501?= X-GMAIL-MSGID: =?utf-8?q?1754948395440173501?= Change alloc_huge_page_nodemask() to alloc_hugetlb_folio_nodemask() and alloc_migrate_huge_page() to alloc_migrate_hugetlb_folio(). Both functions now return a folio rather than a page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 6 +++--- mm/hugetlb.c | 18 +++++++++--------- mm/migrate.c | 5 ++++- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 482929b2d044..a853c13d8308 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -680,7 +680,7 @@ struct huge_bootmem_page { int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list); struct page *alloc_huge_page(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve); -struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); @@ -1001,8 +1001,8 @@ static inline struct page *alloc_huge_page(struct vm_area_struct *vma, return NULL; } -static inline struct page * -alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +static inline struct folio * +alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask) { return NULL; diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f3e1d052b40c..c0cfb075cd58 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2275,7 +2275,7 @@ static struct folio *alloc_surplus_hugetlb_folio(struct hstate *h, return folio; } -static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, +static struct folio *alloc_migrate_hugetlb_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask) { struct folio *folio; @@ -2295,7 +2295,7 @@ static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, */ folio_set_hugetlb_temporary(folio); - return &folio->page; + return folio; } /* @@ -2328,8 +2328,8 @@ struct folio *alloc_buddy_hugetlb_folio_with_mpol(struct hstate *h, return folio; } -/* page migration callback function */ -struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, +/* folio migration callback function */ +struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask) { spin_lock_irq(&hugetlb_lock); @@ -2340,12 +2340,12 @@ struct page *alloc_huge_page_nodemask(struct hstate *h, int preferred_nid, preferred_nid, nmask); if (folio) { spin_unlock_irq(&hugetlb_lock); - return &folio->page; + return folio; } } spin_unlock_irq(&hugetlb_lock); - return alloc_migrate_huge_page(h, gfp_mask, preferred_nid, nmask); + return alloc_migrate_hugetlb_folio(h, gfp_mask, preferred_nid, nmask); } /* mempolicy aware migration callback */ @@ -2354,16 +2354,16 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, { struct mempolicy *mpol; nodemask_t *nodemask; - struct page *page; + struct folio *folio; gfp_t gfp_mask; int node; gfp_mask = htlb_alloc_mask(h); node = huge_node(vma, address, gfp_mask, &mpol, &nodemask); - page = alloc_huge_page_nodemask(h, node, nodemask, gfp_mask); + folio = alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask); mpol_cond_put(mpol); - return page; + return &folio->page; } /* diff --git a/mm/migrate.c b/mm/migrate.c index 6932b3d5a9dd..fab706b78be1 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1622,6 +1622,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) struct migration_target_control *mtc; gfp_t gfp_mask; unsigned int order = 0; + struct folio *hugetlb_folio = NULL; struct folio *new_folio = NULL; int nid; int zidx; @@ -1636,7 +1637,9 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) struct hstate *h = folio_hstate(folio); gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); - return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask); + hugetlb_folio = alloc_hugetlb_folio_nodemask(h, nid, + mtc->nmask, gfp_mask); + return &hugetlb_folio->page; } if (folio_test_large(folio)) { From patchwork Fri Jan 13 22:30:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43643 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp11928wrn; Fri, 13 Jan 2023 14:34:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXtgVu9YAvz9PF7Xk6bWFYdwn4tVD8oC+EyBFQEGZ2xcQeYApNov/uOuTXyfH29pIKPuH8Hu X-Received: by 2002:a17:907:8dca:b0:84c:e89e:bb4c with SMTP id tg10-20020a1709078dca00b0084ce89ebb4cmr4969511ejc.49.1673649265977; Fri, 13 Jan 2023 14:34:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673649265; cv=pass; d=google.com; s=arc-20160816; b=mlen0ieYrbuWVTOhtmp4S+tBa70TehAd13iCCylYpk4/xJF02/ncBPNsk0cn8GL8mY 8D0rZNnFPEARgHDIHrCN93K2ACACSWi9dpvzsnfN/mWM46LMkADDAU3LWBLQGeEbDeeb L18xOQZvdWFXozajySC6YuM32CqIfW7IUPzmabIZxQtjb2hwwlCrw/G9TjK9EGkNI3g/ HiLA5JPTOxWRT9/EM0Ks6/kLXf8UTRkh2Wu6usNt1t5jHT1CdEc3VeAmG/kJYKMfOLX/ qYRrwPNCeriAlBDWZ83xwUAw8EqjCu1CH1RaXCM8txwZHscStD9fecFc6cMkN17lNH2l yKhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=JSuCthEGD9mFVQwtGBQpQYgIPpxHUVzJky4kAU11Yd8=; b=ylDGsWOtoTwJ/M9fSrEGt6smlrOw9d/NjawhWlFErBtiolH4gSnKOJb/fYEF/IYVO5 I4SJ/xvrczUWWbtUTYEerhEtg+j7jycdq79jtrnYlTwrWxjmR1/LIJkWMd4p2EC4adlW 3YtgR6ea+JRss1bYYgKDo9/R1LYIz8v3tbhd/jKxNnYHxPq4oC7SNm0FwEh091yp7gRn pVklmH2afsqB3zftWYtYAoqfWJBFh2IqFuXG/e6+8FyPaIo3z7sgSwIZY8qVx07pvBn0 iI3c8O37+88TcoGFSQyWIx1qAcBRTc+l9jXbnpjg/3xYM47WxYoUE9+AxP+r2yxPrJPj 0DmA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=k9zcBAHm; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tq6pBPjh; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z15-20020a056402274f00b00478ab006e1dsi27341070edd.124.2023.01.13.14.33.43; Fri, 13 Jan 2023 14:34:25 -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=k9zcBAHm; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tq6pBPjh; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S230515AbjAMWcK (ORCPT + 99 others); Fri, 13 Jan 2023 17:32:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229825AbjAMWbr (ORCPT ); Fri, 13 Jan 2023 17:31:47 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AFEC76EDB for ; Fri, 13 Jan 2023 14:31:45 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DLYhPP015861; Fri, 13 Jan 2023 22:31:16 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=JSuCthEGD9mFVQwtGBQpQYgIPpxHUVzJky4kAU11Yd8=; b=k9zcBAHm7ighNBzTNll3x70ykerRhWlMQIObu67JpHW6szowhyfO2t3vctzZiZYlZq50 5ygl5YDFo4oURmK86asQTki6aLhoBVBicPa2LZXu5cKgObGT/qWXBoB2jfQvR34gyeOE qInbcnH+g7h1XLg3jETw8xLF2j01tM7IKs+eD0rf11Qj1WkIh1vxnhzRFL1r0vExEQSD iT4tLr4w1ivB+1hmdi5k40sW1s7vCK9nP/ujExmhIiaH0sl48pNDsp7ar2e39OBk6Abv qiE4goS6Px1rBTdtRhk6BVXfnjFvyeEAKhVIDnMzUFypYMbBqBmDRGP4biAKQSqjoJBy pQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3av80phf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:16 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DKwdPV006693; Fri, 13 Jan 2023 22:31:15 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2177.outbound.protection.outlook.com [104.47.56.177]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n3etdjktp-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=R3qwwdmQIIr41OyH3VJcEb98gJatl6EX+A6HDELIudBUTWyBZxLB3wUEeLQF8/q7dYaqnqec/w7lWVI00lXF6ghmgwsLvCMJWhbfSsMZjYKCL2wCkW1FUiW9A8b22s0IulPMKCois86lUdVJyOvfr64AmFnFfh588cGS9wWgW5fGoj9UsTHHXMyNcv5+7uQZ0FjxjIbwcXX9wG3twjQvMHju8hQlj68HSTd2UXYEfnp0AGvoXxoyaudAZYzgAx7p6CwJeEPBhnlsMUXucKe6kqZ7E64+kw/oeTP1RKDGm1v7GmxIIhFpSR6HrMwWSUoYGiFwfspTOrht4G0rrXvhaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JSuCthEGD9mFVQwtGBQpQYgIPpxHUVzJky4kAU11Yd8=; b=h6i6Q8R/nKcqJFpiPcfsf+npzun/SH6g54hhpnPunS5ZKogdVamfzJfIH6ZPE6PcKgYCwZAWsX626gsEKDmcD4eQcN/GY+QIydrtY/yjBNs86d9oTEs1YTuGEJU0C0s0+wUEBIFYKXiMFWUwuo6vU94Hv2EzZnywcu+nxTrBx/FExq6vGgtvo5KcWaDtGJ0mm6hajjAebALSdcWR19TOLo+jt+O/KXx8AM4ZXWioDT4LQReWLW3272eFbskm83LJaiTfINsj2zNTcAPUu9uv/O9IGjgJd9qIdnsx5uLiNFIGe5rCOW2OH+ix4r3nh2DWdU5sdW9zheNYGp5HMgwUig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JSuCthEGD9mFVQwtGBQpQYgIPpxHUVzJky4kAU11Yd8=; b=tq6pBPjhzrADvnJ48bgAgb7cdylmkPLp7Bqh/y/6KsoEIF5uhWbY0Lk63mYm7P/BFCVuAymVCQ025spURcMDr+QU8YJ4tHQYlQPWWlOUdi6Y7aoQ7wv2Xee0c/hJNd/NWOMcNkdzZPzzO/ti+OJGRuZx8C3krqd5soo0sMnFhUE= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:13 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:13 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 7/8] mm/hugetlb: convert restore_reserve_on_error() to folios Date: Fri, 13 Jan 2023 16:30:56 -0600 Message-Id: <20230113223057.173292-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR07CA0021.namprd07.prod.outlook.com (2603:10b6:610:32::26) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: 15eb3f18-121f-442b-b1e5-08daf5b5e0c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +h0wskAd24U8NZcCTltxm//scDJMWT4Rnqp9OM6OAp56uZD7YzzhRGHPvCDLNhuqdF6/NdFM21Knoemo0IJ8GWO25WGoMl03m5SNdo+2kyWebC5xeLlYo11rwF7fKtrbB+uT7GSlwlUNDi7qrf9xafrHh7cbId1unGvXtp4Eu+z1BVqN0Vyym7I03LEZGyjmb30Wbv4HgCK6aiZsst+44t0VfwcdhGhPubBnR9wUDgB/1ZECgGhNdY7SkEl2mxWrk3LlDTtDWfLYmN06VSoDTIKZR6JlB0kj8TrBvXsMPdZrDJryZTqPN0OMZmPiCjavOYIWaLCJMWgcoAOnbzI+mQbhX2/Xs5U7blDuXEuWxVSqEG/jqGscV95EZTkqpzr6e8cPs4/Ckll6oZYf2Uceb3RoL7eiQzeewZGhbtAEF4/iFwC14NMy2jJS5xorrxCd8nWtNj8Pw4BmSre0/XJugDIynhqiLBDOi5MfZgGndxU235XL7ptWaMlOkq3SOyaZlvkq3JfuHqJdWLugclYiOBMurrMoJgk/Vjy2I0GaVHoSgqO9005A/vs1JFff0g9MfUbQwY49/5HhvzGo3fI/bIyu1JreLzaDq0tAWcAu5C3rjGNVahA0JgOjoFs+ve865oT9fR7GeToxADjlb6JRnA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QxvetK3TwS2Mh+SE+KgToFOY5HxuN7OZGD9RGLpkDnc7d8kTLjCqs9v8LR1SEhw7CUsT7VndLQVXrWTxpoZ+6sU3dmJhEiteMYvV+f6CeAHzDecSNEqDkWXrejTcYg+A4MjHb+Bgc/cEvK8mya++sP9xR7AfCeQIATxyFwblMQT4BYd5Xx9V5Zmy3Y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Fun0iqGC9zSGUrnRm4lNfyIHBSJlHCVPzoOcySlXLVPFvOXTzIPJVdlPAbzLZjjQAwlv3KTGWgK8jM5dODKYaIHcm0HxJP5a9Zv/T60JrksZYbDxNGRutbyv5i2Ij8i8RqudhVu0nwRgKmGROVxOVDCsM43Bm0R9x/bLjsAAE0xg8lGFVUdc2vlmNnd0Pu2b7rMNNl3E8wyCOPk4McqSXRviM4RPIBD0CotTm2uWkTisrQjNP1q9ZUeOeix7fQ8h/ZUFOaboHQvJxxq8lBmVbJtLXSG2RPbqAbaroCz/t2n3IDYBm++PDuvEKD6XUXBZ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15eb3f18-121f-442b-b1e5-08daf5b5e0c7 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:13.6509 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GKoedDfAvgXV6n76aOwJ7bYcqGLQfzNLRg6mL/PecsetJQS8RTyFM5Iq+LiFKNIRsWHt7JrjV5YN+BlrK2YTO5zPAFG6ZKAgsvyoeFfX1w8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 bulkscore=0 adultscore=0 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: pv1G2gLvH0lszx2CIc6ZUUJVxyxK0i7M X-Proofpoint-GUID: pv1G2gLvH0lszx2CIc6ZUUJVxyxK0i7M X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754948452443534980?= X-GMAIL-MSGID: =?utf-8?q?1754948452443534980?= Use the hugetlb folio flag macros inside restore_reserve_on_error() and update the comments to reflect the use of folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c0cfb075cd58..f8cd0c694fe9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2675,22 +2675,23 @@ static long vma_del_reservation(struct hstate *h, void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct page *page) { + struct folio *folio = page_folio(page); long rc = vma_needs_reservation(h, vma, address); - if (HPageRestoreReserve(page)) { + if (folio_test_hugetlb_restore_reserve(folio)) { if (unlikely(rc < 0)) /* * Rare out of memory condition in reserve map - * manipulation. Clear HPageRestoreReserve so that - * global reserve count will not be incremented + * manipulation. Clear hugetlb_restore_reserve so + * that global reserve count will not be incremented * by free_huge_page. This will make it appear - * as though the reservation for this page was + * as though the reservation for this folio was * consumed. This may prevent the task from - * faulting in the page at a later time. This + * faulting in the folio at a later time. This * is better than inconsistent global huge page * accounting of reserve counts. */ - ClearHPageRestoreReserve(page); + folio_clear_hugetlb_restore_reserve(folio); else if (rc) (void)vma_add_reservation(h, vma, address); else @@ -2701,7 +2702,7 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, * This indicates there is an entry in the reserve map * not added by alloc_huge_page. We know it was added * before the alloc_huge_page call, otherwise - * HPageRestoreReserve would be set on the page. + * hugetlb_restore_reserve would be set on the folio. * Remove the entry so that a subsequent allocation * does not consume a reservation. */ @@ -2710,12 +2711,12 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, /* * VERY rare out of memory condition. Since * we can not delete the entry, set - * HPageRestoreReserve so that the reserve - * count will be incremented when the page + * hugetlb_restore_reserve so that the reserve + * count will be incremented when the folio * is freed. This reserve will be consumed * on a subsequent allocation. */ - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); } else if (rc < 0) { /* * Rare out of memory condition from @@ -2731,12 +2732,12 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, /* * For private mappings, no entry indicates * a reservation is present. Since we can - * not add an entry, set SetHPageRestoreReserve - * on the page so reserve count will be + * not add an entry, set hugetlb_restore_reserve + * on the folio so reserve count will be * incremented when freed. This reserve will * be consumed on a subsequent allocation. */ - SetHPageRestoreReserve(page); + folio_set_hugetlb_restore_reserve(folio); } else /* * No reservation present, do nothing From patchwork Fri Jan 13 22:30:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 43645 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1321wrn; Fri, 13 Jan 2023 15:00:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXupJbsthHSEcrbJFxQfjQwuUPcmfgq/00yiAeU42zGKzpCeT9IBPfHKM0ITBD+D00yHY1u6 X-Received: by 2002:a17:907:7b88:b0:84d:465f:d2fe with SMTP id ne8-20020a1709077b8800b0084d465fd2femr18876426ejc.41.1673650823086; Fri, 13 Jan 2023 15:00:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673650823; cv=pass; d=google.com; s=arc-20160816; b=yMLGJ5h40QqCuo71iEym5osrbcKPnA4DmWEieqS5tIW7l61y471lzUfrrYLKu52K6N zK0oGtZbKjPUNTj0I7LTgzY5ELXD1HWtxT1ebQ2/A4OEqEWSjUYoFqX4ZdKxtk92qQpH /zv4rRbwhG1EEMNjowI9UYZFf+Y7ceSyufTdRcyWZOwa9alwbUjjJFk+O0iDW3ZwsTN+ AZcq76KU/g7PFJ0OUWwm4Qfv0TB/GjWOljJV+Vx2h6GzbiwGiLyXuGDa/xlUany1Wc1v yUpcaZT1HVXQWpHrnuhVRr23SsieeldPUyhCUNDQMfvSbJ0/OLjBQ/yikJy+/PahGhn8 YRYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=pGdWAeKShSEOdUatZSw1ccDvyeotIBxn/OWkxHEn6r8=; b=aoOUtDegSWv/kdwH8whDFpiRGoPAzxYIXIYJtdlWf5dzVLHiV9JiATW3EbadyBNOO3 wZIjatg3O0J8v7jckQ4Tn8OhTS7XkRdL3QmO6T54i78Xxoyljqup9jk03oSgF1jFzyZL Xr4+KAhoc/tZpkeng4QGJKtRemqV77wXNX1jCMiI4cKsWbLlLqEDteLPeb15M3zLPqpI /D7pCVW43UIvBirw8GrwiU/vC5yYQ+ERqLh2diaDmVnjNALXwKvcRK/Wtx1cz3SIB2rD YUcVJggdDE8MK3lYxWBJnMtLdGlME2JdZxYeP/NH/x4Y1z6DV/jilXHG5T3nHE4NUyz2 hutQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="HWc/4KxE"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=A8vppx84; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s25-20020a05640217d900b0049cf9c21eb4si1657033edy.409.2023.01.13.14.59.56; Fri, 13 Jan 2023 15:00:23 -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="HWc/4KxE"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=A8vppx84; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); 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 S231337AbjAMWq7 (ORCPT + 99 others); Fri, 13 Jan 2023 17:46:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230040AbjAMWqz (ORCPT ); Fri, 13 Jan 2023 17:46:55 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAED7D9C0 for ; Fri, 13 Jan 2023 14:46:54 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30DLYq29016127; Fri, 13 Jan 2023 22:46:32 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 : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=pGdWAeKShSEOdUatZSw1ccDvyeotIBxn/OWkxHEn6r8=; b=HWc/4KxEASMVsKQtqPzseaDHeehFDQ4MH5dTBEAAUZLDuv4RoZFPW/+yyrmRV29ouwqt mNkHmr12Lq1+2Jyi5NAd2aRwkA3wgOxpyEIk4NeyslEWR4N8rVFTh4xyTU56/wEjVvgc /xWCa0C32Qh9CRW9yzHbHSa4RcqJ+fYhTL1jWr75NTmYV17yGbbd4dg22uS3wGoidSaL 6eKRM18T4zlLFcrO26wHazT6ppHkF8flAASIKwD3n3Nn4VmXUs6vSuy7jynw8gobz/rC EqZw3lS5IfvIXtQ2cla+NIx/jkPpni77sZbjBEOyE7TBhQ6yk9VHda1vFasE5ggo3hMg Wg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3av80q6n-9 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:46:32 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30DLRNoQ004334; Fri, 13 Jan 2023 22:31:17 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n3f7usqxp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 13 Jan 2023 22:31:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=djJmpcTYxSAfPfqtoLwFbcZkvvs0VkIYS2PViOMp6uHgM+odQMlSAdY/DAZOh+VBCWHYocu+MPt4106Q3M3hGETfBILJmnwePcEGjbhHwFMEeSRyhkWHXUNcQ1vR4kZ6fnDMNAvRtS1P3F2EVnWL1Wr9l2EPMGNgEdpovVabx3Hnr04KS5UY287BoAjCb5HRS6JV3JmvJOeLEaIkCn5QeSW1jb0OsbG4ZasBadU98/gsLVtIt0QFgy1CBr7xT99aCs6ILZwabdUaT8BWWAtlLkayqM9dF0I8MgZybcwC2LTtEO6XSWmykFk4YbUydsnQp8e99wD6wtpReLY2tRlH6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=pGdWAeKShSEOdUatZSw1ccDvyeotIBxn/OWkxHEn6r8=; b=m9uO+8Sr5gS0sixHPnpx6r4oWpGCUpF17yzVSz2kTWg5LYkaO2utiYDs1jnSFWG+V6doULaCkQSU+3FXRCPs4KEr32s7gvlliiNUQLhuzrrDVIUNuEcwxMLyrrrzBLAS8yk1Dfs4TvnjQtjgPhKnB2aZ/Pfw5Zia/fDLwiWMX8vvOvJeACvcuTCsBHIT/myToGlJO1WcW1se/WmejwzRqk8L995aGNpfhjb+hS9znL76dEcP9R5P9aUGo1k5hDXBRCU89gAL+9NhiGBL+gTv/USb2jeZ/6SfCxIYRReXjRDeMPmijWC0OL/jJiaXGnExVFzrVPBNC0Fsa9Q7y4fCBQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=pGdWAeKShSEOdUatZSw1ccDvyeotIBxn/OWkxHEn6r8=; b=A8vppx84Ce+UeRY3C3nbeLaV46E8+5FvyQcz8PSwFmsxyCVBUulEKrsBQ4IxdrMi9ttcch2LCkeYtxZO4EyOL+hIZUzFScqIfhAm6QN931yo0NSZgVtkD/xZyWUxMtxij0Y/joiCW+RHIg0IuoQ3BnsLXqqnDijfNOABl9AF7OM= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by IA0PR10MB7326.namprd10.prod.outlook.com (2603:10b6:208:40d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Fri, 13 Jan 2023 22:31:15 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Fri, 13 Jan 2023 22:31:15 +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, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH mm-unstable v3 8/8] mm/hugetlb: convert demote_free_huge_page to folios Date: Fri, 13 Jan 2023 16:30:57 -0600 Message-Id: <20230113223057.173292-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230113223057.173292-1-sidhartha.kumar@oracle.com> References: <20230113223057.173292-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR07CA0026.namprd07.prod.outlook.com (2603:10b6:610:32::31) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|IA0PR10MB7326:EE_ X-MS-Office365-Filtering-Correlation-Id: ea4b6c58-5c09-4e00-682f-08daf5b5e1b1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LzbgcC0mDEsozysUs5PUawbs1BgWmy/bgLXBGV+sZx0tMrtN4/PGiYXhiWZHWOprygBbSSUbpc8NfsTLI6ahNkTCIrzpWUcb4v+J6E0hATekRXwypqzAgh/hbra37Y+hfQl01DaTLp2M2NBzgKMLT9Jyxzs4/vwuYUPQetQwjwx+hweGJHcSg0Vo7nV1uU0Os1+5iMgu8IsP5DsbCje9SVarfBZ1RuIMQ8bqMBI7lCI9W4ydjV1tuEUvjW3hBVzo/s5QcGA5U7jJMZZDgZ21ujH3Kq+4cWhUiApej4fSmsJy2MwBgC9h6qlzbrI/rPayX6oi7poQMivMZ8NaVMjZvtBOl5wqrfVvIdgAFpTL9QVL3lBgwIDXaDSCng0Ktah7K6Ws4cX4hkXvz3wfdBxajb2We72Uq9sa3gnQDejYYcsXK/rsO64OijVGJkjoe1R3yYOqZHykE11Iuf4aSBX6IQOZM2ME40tahZt21fM8MBFaGRUHLdfltvV3w/+/xxWWN40dPV82vEBjmi++MSWN+UWu/NQfsjdpck2N265xEnvDyi1lD7hBzdRfgJclmq3mfJl5tzknXKJYsGzCYxe66NkFhPhjbbAYL3Vqd4775vHaRVLqlauoic8lpKoKZDeEg2G/kf5TPKorBhAdhkAIiBmoTUJAhXyA//nJu2XXfD2sXdOTMAXPsUVWzAYoCj+M X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(396003)(346002)(39860400002)(376002)(136003)(451199015)(83380400001)(44832011)(38100700002)(86362001)(2906002)(41300700001)(8936002)(5660300002)(6666004)(107886003)(478600001)(6506007)(1076003)(2616005)(26005)(186003)(6512007)(8676002)(66556008)(316002)(4326008)(66946007)(6486002)(66476007)(36756003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CmZgAVOiRNVb9Un7kP9dXsFEsPXfeS5pU3gD6kM/l09cKcF/5k7p58VV2lUBmj9/6MYpLvJ29es1JBWDCoCoh1NWHJdsZ6qYS0/m8KPeKlNapCELT9wS6u3DxpjSXyBr59Yr479kLjKSfLljuYa8JDPXqKqZjDxdopWiHnjzn1cWeWpByImF3Povo7PGHh1y5Ybn5HfcZDl91HqLv88qmcSk6xVe+yw6oa2mrxoi9Ua4x6Xf3Ye0RmlpR7wUAc+XNAY8/u8NEnZemsPFFJ6fQfP6TOr2j+Vr/FZwgLk1e4Af7EAD/ICT+QDiwJtheBdEkHWQGiiw01lWConxCk+YMvcxn0jU+gbGmQJSY9PjD28uIQyo4b6VlotvFrQ2Bg3m6+7Aj9vhSTmzsrSYwe11xBwN3bJ4zlionbSWdP8X8uRVuWHQHef+Ue414JBGz5tXXF9Ru8gc6MaVJdf4B+72rU/RQm2OCm5homTKcD8lmVqkUZL703SZfflWRyVWxhtVCeSoZSLUtfgTZ5ksDVsZkrW7Rts7htIpOabrw8odM2w1H3R9LM9Vwz/a3GsnE/BLm3/6jdYZ872cWMIVXVd1S60ziYsnrRPJnzn/cR3tUOvcrP9Jbwf1b5pLP77jEVt4STDN14SBCMcLiPEpswKodbb4IZc3IyIX/NLSJ48xYZSE30B8kK+0IR9uAmgq2jU0xQReeYRpwH6/xLNASwv/s8DufCqaTXNuoEVi21aURi4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BlmmBgyHG/kIGt2BKDbJbUjxcsqk6jd0/PRpbENmxzq6LRhqkXtCLA4PtWVfhGZ/+8yNW4WkZtPIYO1NijDaSlm2X+RfZ/XdHm3NfPLlLFfyCU/LY9LAegFNrQSxjnCGsE5vjKuKuRBvet85MdzHSbQ4IJS6dBlcIuqMk97L1G0H5BDp4Wr6BCYeP8fNdnUM/W41qqm5a40OETPykTSQDl3/b4gbo/NJnktCW0yhep+JZQy98jMb1YtV17bKusC9tcKR9u4NaigqbKJE7pHSqTHQ49lfmcjj/Lws7ZP9R3TaDPIGaX/igtujHNWzv9kB3MI1f3AFXxIGp6IL34fbyDzTdoqha48TiQaLqP7AWWKjZAeAcZpBYfL6rHc585mw3VO0jLP0zhKl1PatQ5x0wUaSgVcsWelJQ3uzfOZ/TJm0AXEs/Ykr7W/ANggYaIPfDV3Jh6kogr2dHvQyiOrz/2phMFtC74PDRCJLcDVX5c/peQBG57mWa+S66dObB5J+YxH9c1QoTBI/p0gVVfKtyxLunfNiApBIdnbdYaH+ekyoCH/yvlI/l49QgZJemT8vBqNvn2vWgObTeB05W5KGqKdvaJkU+/7ELkaSyv24fTCQIJEBweVPS1pShRhEJisBOu8hpLABFnEcP16wgLX0AHQnlJaYqivjuLTfc+NHyckWrrVJquFXibd2L8O26wa+gTz+j2n3oMLZb4lDgNMybJsgqRyr+c0XcODkLiA21DygK69oHb6pV0Yo3MuqLEaRKPMQ+Glfw+bJviD2CQIl+dyo1E0lH+k0xdDXA/Bc8LNUddf+t9sMVzHlivi0+oGMZ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ea4b6c58-5c09-4e00-682f-08daf5b5e1b1 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2023 22:31:15.1669 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2ISje+F35HFhK7AdM/Gtac3yShcL0Uek6xHFGyr8gLwuB9IX3zX8I04rf5hdinl4E1kVsD/SYcZQZfQe+kvKOmGIA0dY2as9woq2M7BHS5o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR10MB7326 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-13_10,2023-01-13_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 malwarescore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130154 X-Proofpoint-ORIG-GUID: x-LEmfQAOwQW5G69KFaqw44tesdE_SO6 X-Proofpoint-GUID: x-LEmfQAOwQW5G69KFaqw44tesdE_SO6 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754950085511043662?= X-GMAIL-MSGID: =?utf-8?q?1754950085511043662?= Change demote_free_huge_page to demote_free_hugetlb_folio() and change demote_pool_huge_page() pass in a folio. Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f8cd0c694fe9..46c5daacc5bd 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3435,12 +3435,12 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, return 0; } -static int demote_free_huge_page(struct hstate *h, struct page *page) +static int demote_free_hugetlb_folio(struct hstate *h, struct folio *folio) { - int i, nid = page_to_nid(page); + int i, nid = folio_nid(folio); struct hstate *target_hstate; - struct folio *folio = page_folio(page); struct page *subpage; + struct folio *inner_folio; int rc = 0; target_hstate = size_to_hstate(PAGE_SIZE << h->demote_order); @@ -3448,18 +3448,18 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) remove_hugetlb_folio_for_demote(h, folio, false); spin_unlock_irq(&hugetlb_lock); - rc = hugetlb_vmemmap_restore(h, page); + rc = hugetlb_vmemmap_restore(h, &folio->page); if (rc) { - /* Allocation of vmemmmap failed, we can not demote page */ + /* Allocation of vmemmmap failed, we can not demote folio */ spin_lock_irq(&hugetlb_lock); - set_page_refcounted(page); - add_hugetlb_folio(h, page_folio(page), false); + folio_ref_unfreeze(folio, 1); + add_hugetlb_folio(h, folio, false); return rc; } /* * Use destroy_compound_hugetlb_folio_for_demote for all huge page - * sizes as it will not ref count pages. + * sizes as it will not ref count folios. */ destroy_compound_hugetlb_folio_for_demote(folio, huge_page_order(h)); @@ -3474,15 +3474,15 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) mutex_lock(&target_hstate->resize_lock); for (i = 0; i < pages_per_huge_page(h); i += pages_per_huge_page(target_hstate)) { - subpage = nth_page(page, i); - folio = page_folio(subpage); + subpage = folio_page(folio, i); + inner_folio = page_folio(subpage); if (hstate_is_gigantic(target_hstate)) - prep_compound_gigantic_folio_for_demote(folio, + prep_compound_gigantic_folio_for_demote(inner_folio, target_hstate->order); else prep_compound_page(subpage, target_hstate->order); - set_page_private(subpage, 0); - prep_new_hugetlb_folio(target_hstate, folio, nid); + folio_change_private(inner_folio, NULL); + prep_new_hugetlb_folio(target_hstate, inner_folio, nid); free_huge_page(subpage); } mutex_unlock(&target_hstate->resize_lock); @@ -3504,7 +3504,7 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) __must_hold(&hugetlb_lock) { int nr_nodes, node; - struct page *page; + struct folio *folio; lockdep_assert_held(&hugetlb_lock); @@ -3515,11 +3515,10 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) } for_each_node_mask_to_free(h, nr_nodes, node, nodes_allowed) { - list_for_each_entry(page, &h->hugepage_freelists[node], lru) { - if (PageHWPoison(page)) + list_for_each_entry(folio, &h->hugepage_freelists[node], lru) { + if (folio_test_hwpoison(folio)) continue; - - return demote_free_huge_page(h, page); + return demote_free_hugetlb_folio(h, folio); } }