From patchwork Tue Jan 10 21:28:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41664 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978580wrt; Tue, 10 Jan 2023 13:33:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXuqdSYFi/Akn/oMmWfpTdxOnbIH/hbAAhi8MLEa/MFIBsmhKFBSvCwC0Oec+wkJBavGw4ss X-Received: by 2002:a17:906:f193:b0:84d:3403:f4f4 with SMTP id gs19-20020a170906f19300b0084d3403f4f4mr10750216ejb.64.1673386388249; Tue, 10 Jan 2023 13:33:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386388; cv=pass; d=google.com; s=arc-20160816; b=ufKVJBG25WqQihGzVrSBq7NCbehP0nEiBhK8hUlI47TIFoSso4sEep91ONhPEC+lz4 rbIzVyO3mZhCods1Blcfvs2Yxfgyo9n5qamMAyjL+/t8vsMykIDkVRmrV54MUdcRGM7K gk4VAe7V6UFksR/sQTpYrp7e0JHBDQ/pvmgngEJm66raFpwpdEXLTL0A3cW6Mh/5VFXV HbmQ5TaQiydcDvKEsN5vLz8Fr2aBcjv+dpxyase8tq1zivad1CA75SoRu74gfQ1dSuca LCRxDxXKyzG8ws8b6FsbeHVlsr27mYVPXOBYAqKBzxX/KK9nQBscNOZKiG8Piu71kP9p pBxw== 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=Ue5KRszYjMTnj2K1AHindC7y6fInHEG2p6kUaNmTi8A=; b=r25JGEwVjifXvPpkIDFRw4rOqmqJJIuD4fxa6uQOLQXeCDDlo3fYsg8zWWTXdvm8HY iDZCspUSSg+LpoAW9/VVk44hbB9RdblVmuR/TJW9jzPE+/tEhbLwLWbUy5eXNVWCJOHw drpwt9Sb68usG9DYlIL5ayY7d+Nsn+htuRgFGgGV3aphbRp5HkvTWcyLl9tMzvf/Ofne Ey8faqV/oy7CP6bjA5VMGXnp50eALYVjxb7KLEHU+ux9pcvL1lhw5XBlV1XZ+MT88CLJ imYAok+iFOGDVR7EuxHEyAiVqcwRvPtDKelRzXI103Sr6+wnWp7OcnsG0HQu5m/fM09t HNwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="iMO/PPaj"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RiPI0k9N; 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 hd41-20020a17090796a900b007c0c0d7c4c8si13230257ejc.44.2023.01.10.13.32.43; Tue, 10 Jan 2023 13:33: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="iMO/PPaj"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=RiPI0k9N; 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 S229707AbjAJV3L (ORCPT + 99 others); Tue, 10 Jan 2023 16:29:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232959AbjAJV3F (ORCPT ); Tue, 10 Jan 2023 16:29:05 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70FCE5C1D7 for ; Tue, 10 Jan 2023 13:29:04 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30ALGkw3030256; Tue, 10 Jan 2023 21:28:35 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=Ue5KRszYjMTnj2K1AHindC7y6fInHEG2p6kUaNmTi8A=; b=iMO/PPajVxFO19BeECZndmlvYZIh0EAoodECKmu0hzspwbUcmQW0WBPLp1A3YNOVeTVT Bnp5CAmm6jFu4W/pnYgeF6Kkwt4tPnEL/9ctbxJaq8wkkulj956Tw/0TtsMHUwxgjTrl EWTMKxQCWGGP5eSINKkpKUwes74b07QTotrmVELXx8hCUONUrHpI/k7KU6CkV0SsxQye zCgUTZ+lp5mC0EEtOitZBpJWX7A/cjBxbgaap5bnca4uRQ8ddJlNKWC6CYjlvy8KyiRR +3J2tp5cz29In3YVCjNC/XysnVFcNviBp73Y0ZOZUOqvuI48aJ4WAy0mRFn/wLejJ5Dx Kg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n14nf9syr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:34 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30AJcce7024447; Tue, 10 Jan 2023 21:28:34 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n1ebume2q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chM2DfBur+/QebBmLXEUfooxLCLcIuQMMGhLtl4m5kaBlcxtqvjtmoxgJfpU2hn2nsnwBEKtqeabIYBmXOdl2VCGAcf2HagvcsB6rMyXgzv5l5zRfT5yK9h8JfqMNTrT5nyDdEknZPT54FEjE7JMIY8326vsFERL492YJ2iyynjbJS/olx5eOwg2mjfk04lvmk3LGPInEn7xwR+nPRlP6SH7N5rhZ4E8LccR7M4axqEPF9rs9BUItC5hA6dIQ0Ugl5AgBFoyW8/X4qZdd2xxb7tKnOGVyDTzVg7Knjx67fU81th37jmRllhVz0v+476TLat1gT4ShDAxbwOtGHQ8fw== 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=Ue5KRszYjMTnj2K1AHindC7y6fInHEG2p6kUaNmTi8A=; b=jLKNzCfihGbsy1d7IGSi/IFxG7vUsLMoC7ca8+3bbq9Cnp7fkJ8ZCpaeybs+xeGmFeLgzYOiPaOXbb+EvSYhKwyDoKyYRQCqdvUurOras3eq29KA4ZRFzXF27k2z/HA6l/ZEPEzm6uKY+1GeS4MxDvO2lfoFmsRbvlMGNJGxw7JJtq8QaDNn6pzBCvk+CVwkzoZqlRUI1pWhtEAD4v+Ita2X8UlIVoHvY+CBIOgZTjsCNilZPpYZKVvOBF7MLqREbowVAjdcHhPtFGqOKAkrmh2wyEYozcb0cKRbIkCvkllq+ZthQKdzdQb+jYP33463UmT9GiD4SmUtJFCuycZ+HQ== 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=Ue5KRszYjMTnj2K1AHindC7y6fInHEG2p6kUaNmTi8A=; b=RiPI0k9NV9G1CXpmf1US8IqMj6F6qK8Ya9sCjgIaP1r4wnnLNeWT01lv+90+94zE2LqB63/E+svEgJrjqekHaIILgnQnZBAOcU6Z56WvOgwktZHmpjXBAfEI7fYy//K6pRd8rsCboNfCdH4eg48dIGtXvYQU13vhk8odhZNosEg= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB7153.namprd10.prod.outlook.com (2603:10b6:8:e0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:32 +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; Tue, 10 Jan 2023 21:28:32 +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 v2 1/8] mm/hugetlb: convert isolate_hugetlb to folios Date: Tue, 10 Jan 2023 15:28:14 -0600 Message-Id: <20230110212821.984047-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SA1P222CA0027.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::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_|DS7PR10MB7153:EE_ X-MS-Office365-Filtering-Correlation-Id: e7a814f3-84ea-412f-10f6-08daf3519fa0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a5yDz8nknjeIaDQRw4n5fvsVxDpHdXxoqDwTrvyBc7qCFFoYkmXoBVjjIYnx/dCfTUaQexMh18WHh/0mf7lJjZD2NgdOTXXkME9lHJnDN7lbNrKOlgDuVc4Gy90eNWDqKA2DX01hFDPv9aSwlKcQtsHQJGbyWjdVKb0KRFseXdaktLk46SnDVB+rL+f2JqiNz0NeygOzPD3llRnmKbmIcoAHNCIZdmovOZcSbyNC9Xox7m9LJxLR/7vL8qtXpRKTNhBJpvoP5q4p+qgYK4FqatyXPjqtiBVlU9LoqE5Tnz/F60XOXSmRRaj76hX50CtA1mt3rhSr7qwFiRxXIzHXsRtbbxeAXv11LwrvW6TeZc20BrGggRly4DafCxZnwligd+4D+KouQXd3LkMt2FglYEgXBDS4gGQUtUI0fL2kkI+xbIBI2b750z7/YnonVJnbLEYNrYgIUr99bxbFch1NULb0WSTfrD+nPH2MHsrr2VQs7Jbe/JQk8/g/pbL/y5wR2FbIf+cbR9jyKOg9ndW6OCP5/b2gaTb1thD7iQa1zxxPF/bpUkzXrlT2BHt5DFayDn+QyhRptz2lPbkjTRoRFRAynJXGph++ZXWyryejVymSDytBJwepJoW4I5MP23Q0iLYMYGcoxkyoq8pVPtNhtQ== 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)(376002)(346002)(39860400002)(136003)(366004)(396003)(451199015)(2906002)(5660300002)(8936002)(44832011)(86362001)(36756003)(4326008)(41300700001)(8676002)(66946007)(66476007)(66556008)(38100700002)(316002)(6486002)(83380400001)(6506007)(2616005)(6512007)(6666004)(478600001)(107886003)(186003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zZnn3cBj7RDKUW3rBwjrXZ+9I/KAPKVnKOdi65DF2Aa3Q/qKYc7NMr7Z/atEHwTF5k50EFFs7C0Hr6aPriXqiZyCinXEptBiV7wJJAiRV+prG9b3yUdT/SWC2qltoQmYo9UIuT41kv7sJYhdWMj4jBtsbJIQwyBNlolQ3bZxPsN5NbsrSbd7E9PdaC6Y4zc74xGcmSwm2DTEZkPBzaBkIcEXGk8AWbIoZkeiID/wt1L4PmcQyBYZYLQ0XmNvERO1qhaSjVU2refiLPUXU+Mtp3oLyaWnwM50a9j87PaXThVHJDO77G2OTPwgU2oseUFlLkH11CeM4Sp08zfrrVhNjBsI1yGsZbhaatfWhRbiJKD0omgCj8PpqtQHhY+4eDxyLjjVRc9ljlC2G9az9UEX65AnV15d56CDKOidMbZYSWfGFG+PQ3CtXhSqsf7jvF41+i+5HD++XMpk5xx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4YdKX5l1jTVHbdDYTNgJFg22FFepmQnUXeti7onKpSC62rjmzzrN1t6SNnMVTUHZ37cwtDu+EAT6lvw2B X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7a814f3-84ea-412f-10f6-08daf3519fa0 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:32.3720 (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: I3NNSGOHisfW3M20/hUTBQeNx0yW83pww5Zki1QfvD7QFD9by4wZbv9mV7gL/t3iqdBktJMo/gFApJrBG7uI0Ry7sRGQfB8dtIM1pVI6z6E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB7153 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=825 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-ORIG-GUID: 0nUvyz0MlfwaLtX4PEUnXexhLEvWSstL X-Proofpoint-GUID: 0nUvyz0MlfwaLtX4PEUnXexhLEvWSstL 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?1754672805650338977?= X-GMAIL-MSGID: =?utf-8?q?1754672805650338977?= 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 63d8501001c6..cf60c0fa795c 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -2438,7 +2438,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 Tue Jan 10 21:28:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41669 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2981791wrt; Tue, 10 Jan 2023 13:42:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXty26LSAEbftjhESCl38FC3TkmNPwwWw0OagzEIz3PZ15g+DthiV/qbWxxcsGCADo6qN7ud X-Received: by 2002:a05:6402:6c9:b0:46c:2c94:d30b with SMTP id n9-20020a05640206c900b0046c2c94d30bmr76587837edy.33.1673386946864; Tue, 10 Jan 2023 13:42:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386946; cv=pass; d=google.com; s=arc-20160816; b=AKWvVolNAucEzSPpuAJRsRLH1CSJzLhaxrR8nsVq+7TN/ewcr42cT7lBnAaFHIXGID CG26mqGQXVlTYK3cNihIxhkiMp1UPICnYyilZvVhVMabfJjjlb+MQ5TjPeejnLSz0E/3 BWnb92LlhNBZUZgs1z8Nd3AoAAOPzV61cI1VxQlgY5scznwCYt9BSoHsmixhKKCmhmCA S8CthSrUSjdhGA4ZK+Q5mo0LSpkl5E2y7ZRKnNbrfwXJippwD5f6ABO/53TFTuVJKLgw lEU0+X5JLg90+6OE7EbcrizbIrcigjRhsjmRExShD18mz8mks0IUGesxb5NAYONn5MAG xpPg== 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=P2l6FD2mjpzfMdEahcvl1+u9rZJWgt5DX7tENAQ/p/+G41hypiwL65BdECnXIsnInD Kg1HE23Y7fnv1A+ctrim0qtix9Ux33gckwzAlMcrifyNKumHeCY1N3dMbMfrcGjNaSnS b2f+hoeX4qEieCrZ9QwTBOCJ5iM+wc1T5oHQY0SVcN2nsgNIlfaHSjn1Ofn4anVuVvJR /0xvDMpwzxRmYLyncQ8XFrlLEREDPw9nNIV/62IjsessxCOIcJsCnjK6aVbOhHVCj7ii XMvv5rE1QV2NGzt/8994HSq04Xl1zmwkvF0QeWtwfQzTe6cVpvtux6C/PaLeplaouWjj pjmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=fTNoAIxR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iWkdDCSA; 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 h6-20020a056402280600b00486a1eddd65si16013585ede.125.2023.01.10.13.42.01; Tue, 10 Jan 2023 13:42:26 -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=fTNoAIxR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=iWkdDCSA; 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 S234966AbjAJVfl (ORCPT + 99 others); Tue, 10 Jan 2023 16:35:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234892AbjAJVfL (ORCPT ); Tue, 10 Jan 2023 16:35:11 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F4F215FF4 for ; Tue, 10 Jan 2023 13:33:28 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30ALURlI023382; Tue, 10 Jan 2023 21:33: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=ia/pKYvs485DK07VT5Hlv1uptsr6AIwYUeTt8NNpORU=; b=fTNoAIxRBkWp+dRlqkY7ujQX9WGEtZJDvbyhlydkZfv53fbfajR067Rj3a6dcNYpU3W/ jUFl/9/NIG/RksQkLoRhM8XKR8ekr0jYPCVdcV2k/yuPycrfpzaFu+zZqkVFylq7lUa8 zoadp3gd4wZgFcyfmzOsK38lJygxwzLX8Aio2e9i+vILQAn56P3BNnnYxuDuePQJEDQL 2TyWkN3/LQQhqjWyDTHTVuP6s1OZfMKdbNdqXFhJCpoT9isVp/1W6beNtxfiFHZH/CTz FOpRIa6Cv/+GSWUg6/RBh8J7mKybr1EAiNKMbmkYuYb7JKTA0xdqPF34sNXJKv8gFgXx 9w== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n185t96fy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:33:10 +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 30ALOdsJ003116; Tue, 10 Jan 2023 21:33:08 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2177.outbound.protection.outlook.com [104.47.55.177]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1fwera8d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:33:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YddkCwTs2WJx6lF1QYlWr6nXo9uq68Q3IaF65ne9uA3+55ALdKrRg8LeEpYePctlEMvN5t3r+DRrdFT4ptitq2v0b4ImzS13/AafEchnCbFq3VObCwjLQdmDiikUH3QtLD0/AqWlxl7WVcGOjCIlqMTvI/yqhU5S/F8Wt9On/0neVbsN4ZG4MMRCGP0wEJl5NYSXpnVmDpGKPfXJDKq4GZBq+Vc42MF3t8kC1S3ttXz2X/XD1zdzjUpiJ2hU3IZcyDK9XVn3bEPH6ty0znyD3e7JB93BlJKDSOPpc0K/U7AX3Gcs1F7lyS8m4YQfRd4MQWaO3r8ycNzxGHaJlqebOQ== 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=jspRWFq/I4w6EYaofsW5E0iB+XkSyEiox23EmSmaoSl3KZd0CSw+upZRrAoFx17FCCNgscI64gbvn87Vpn4kG02Ff2G++7SOt/5Blldp+k54cE54ccT3QmplpOnlDFCyeXuv2OPjMJT6qR/S6aUht27+LTvi0+weEDdsDSanPIkHfQp/CdgiBsTmBntXKmt4p5PXTn6iEzckuJoxGE/BG7SH4vO48Ky93EVzZSG5t+zOVKOFO4jRP+V0rIwfUrkxht2geCQ03bU8L0wpEXRk4IgHkFbekuvcP9cYKVoFo1OjPz7879Z+j+7M2Yel1Sb6ehGUlorunfI6Rg6tnbgprw== 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=iWkdDCSAFFZ/Q9I9TVULsXtOXbWVvCss81IOOTDw8Q1zqQ7DiPVENV1JHsX0ytXZaBFlSVUYDWkhGqJAGadOJ12Z53tqWOvOujt1heeGZ43q2/ckRUI9CC9qXbvMrnm9tB/W4EH8p23q+8PHUrkHIf3Fk2tMkf4fQ7t3GHWm6ic= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:35 +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; Tue, 10 Jan 2023 21:28:35 +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 v2 2/8] mm/hugetlb: convert __update_and_free_page() to folios Date: Tue, 10 Jan 2023 15:28:15 -0600 Message-Id: <20230110212821.984047-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SA0PR11CA0109.namprd11.prod.outlook.com (2603:10b6:806:d1::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_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: bdae4b27-ffaa-4b77-deea-08daf351a15b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mI9lrunfJ2xs+JpKSSar20cyp8EwLL/4pNDZMnyrtDBiBX4zxs6ILAMWm77IIoiOIPSia23SFowSIY8KTV+Qk9kLPmn9jkQTh4Lr4Xu2Ggc71mOh3kV5KMYcvfaGXCe8XRZdkVU4VawuhNItrwA8olsA8tugZ9k/HcQy0kHyKb3ocWdFZHW7B0wBgl3gs3GrJAPoO5eL/oUiSo2u8J6Prlz4zFnsMqEhyEU3BFybmNNl0HTGVevc0DRvk+i7muIWaO5lYAcES/CEiS+lx643uDYS0DvlpHkU8abQ1LH3AYrCsfTciVg1it/5rfwDXT8cN91IpArIJoyJmeuz39s6279EHW3tA60eBIhcvcnL7KPeaBV3VjGGjTQJyij25YQfLVOSFI/T8sUZYlHp+foLufpsHuJadD34+52g2qW/JXcygKUJxAbGogj8N+MluZVViEjVMymRSUp1EKvlVHbktC4AMWIlfsvn//PvT13EH+bMhUkp0JzbTMMTsVWTVIuMosD3malqjhZp+zi16JlB1U9V2zqkYu+G9mW6DKkhIIft6U+UpWZ5sMfn6T5ZWhOaCEMOoWUXnQbMm4/PHuItaNvTESjd2Vz1xgHdVvQQR/ZjlXtsXYFoNUxXuAx3wf/QVIr5S+sHBwjO8WX4SqAlTg== 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1pf4ss0ZXrngEpP3s6Fad79txZOqDpBBGjLpdipeLg6G8e9jy+polv57fGNIxaCl0sH+r81aV/734H5ZSrhKMseLeczA6POCv6P64E/rR33aI33+eDIow7P8M6hxIdZxcbCawbgZeuAZPSYHs+9Iwm0aet+CQSYu/YF/inxuRys2xXV1fuIdgv5rdJKdlGDJPcfZxPxE7G30NB1ZuIYDrruavIeWDkm0L6s8dLO1d/C77HsSfgEF5VOXHRpoPb7bc1FruBO8Fgh2FYp63PNxQqpQbX8c/eiu9QVQK4aJK/P7jiwvRw6FsIimWAj4uRMy5G9qvlNV/taaLrIaq3Jw6Z/W2tSa9VksuMDIaGQvXiZ1WqahA3MHzur/f61XnJ3CKM1mnXbyTlMs2KbPQv8chO3UiKOFCRGf5BjJKh15rz5VeloitGZGJnE5OQNqni1nbd7Y0OAszuPJrYQ37gTwP3/i7YJoRz6aA7mr1t6XI8pagzgtkX4GEgLvQzHj3XAMWeYD5RHdoTtJdat/Bfb/sYGOKSX9iUv68mz9wiVRmERmIzwMpzMRT4bYuMjn+rKKhtdqFY72+5WKFmwv7SXMERkIIyetDrvupWWQIg9Z29tmbDt2LTFMa9MU2bYvBvav5H7kOrTKiKhsLigKaVetOPaBBl3h3scQeivRld7O2VCNhdiBIQEtJ+lGfuNiJSVFxs0uw/MMZgPxQ/3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kA0Gc/7uCmUctofGpJs77Xy7tgvCNWLYZNc72QmzgliGIfgKZVtrLHN4S2bUJy+8oT6n0lfjAAuOjDG5eb5/uPCIlFBkqcQ/f5mEvdvcbKJNxfEw3qhzf2v3F47ow6cz4DZRurr80e/ukoLjyB8uxbPJKglycSLSBa80aqYHclQdbflqXg0WkjEwhp7Y3iiULxMg+hBzcnjiNz7FhdWGV+kI9GYVEGTTeYVpYGi/jb4GSUux6lj+a2jlMbJhjV4suKRNiYf8z2YbRQ/amaEq+7tAVxiZm1a8xdianEXaCkJJ3qKGvKfDXy8JQBeS/mPth/EVEfXvjZKyay79zVHoBVI65xsQC4m0h/jOpg67Xva5dEe2uLgTy3HZ5ipfM3UsRU/wUri2GSUcE7x4m1HISrtY9ehWdl2F0aowd9g1gd0Xxw8P2CSYuFKT7OUzgWZtcV5G7Eg2EWkkZXWl6JMFU4bi2mCp/mPM4bjEB/idpKTIQZhSUeZZmdDJ0L080ZzFzB+iOcRUctY/hj0xnPnuKKAkH/o38PbwDOpZgwZkWBKn9erlSYGSboK9MK4XOW6/uBRJlJIv9A6lRoZbRt/VBJ7XnolW3W8FKlIdAXpFXqXQCXB1Llul1CFXVmsaIVPMG0BCnf5m1fxoUomItkW+PXeOghyGMI90OoFTPA1vEWEtxEaBt78mD57VYTEGqMgzIUYdj/BrJEYdQTl82lSXK7i1Vfts5O+LmcUEMo9KUvXIlOUozRcvvki7xXwWR+QEpfCG92smTUX73XdP5pSz8oqKAI4MWa8YiqLLY/LLa+iON5Op0vFveD+BCINdO+BMeMpR7yzITXxz4J6ZziyYQePY2SqmMqXBNT+EG8vK8Lps1eQbuGw X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: bdae4b27-ffaa-4b77-deea-08daf351a15b X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:35.4055 (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: 4gd9ZhhDq8ibECPYdu307LtwCie3V4cksyW2DRS9ZjCXfrypo9HejW878+QpbCFwjE5bN0FPnewofDgZDAJEcimmPFKNQX/E1zKu4VdamcU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100143 X-Proofpoint-ORIG-GUID: krBTCGsmoZ1qLCk89MOoVIMewxOellAd X-Proofpoint-GUID: krBTCGsmoZ1qLCk89MOoVIMewxOellAd 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?1754673390933846138?= X-GMAIL-MSGID: =?utf-8?q?1754673390933846138?= 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 Tue Jan 10 21:28:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41660 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978318wrt; Tue, 10 Jan 2023 13:32:25 -0800 (PST) X-Google-Smtp-Source: AMrXdXtRPZCyIACMkwMabVe8jJndafdU36ESeBdIhyBxWdMLLnBnpriigLwtwgSEawq5YWYKEgio X-Received: by 2002:a17:906:124c:b0:7c0:d60b:2883 with SMTP id u12-20020a170906124c00b007c0d60b2883mr46392996eja.50.1673386345043; Tue, 10 Jan 2023 13:32:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386345; cv=pass; d=google.com; s=arc-20160816; b=I41dYmgQIZrWAJhsMq0iUiFxHTPaWfxLBKg6njdTepaRuzJh7RIw54raqH00K3mcl5 4vf1/R3OnnZ5Zyu+v9KI+eEJaOTGTAXGS+qR4DuFkrmVJx10XhVavsxY1xI4A+PJZH1p Gf7TIqcV7ljhXAANTCZN3rgdL9hu4tizP1y0/0YKoL3ns5ixkmDHd5SY4gPusfY/8OFS Edrl2Jt3fz21TP0oXpWkmAeZGWpFiv347PpfjSQ9V+DYAonGK9bPaXvc1axmvO8kNP37 Bd8tZyzqvV5m2Vmm9/zdy/0MIZZxdXv2bU6P+Z+GmJcShvI5ydGgYRc/+Qgmg1chJT71 MXtw== 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=fnkA86E6u75T77dLL9WtrkLA49FwBSRVbuMIY9Dnzb3m+4WGutGa3pr4//PMWF3SxQ EKE9C8hC8AGQgvl/yInYz/+4VGpR2aDSKoGF6Jgc5Js8OJY8SgAxarIEAPIgtLsgAHly HaWy8z0FuG1NyN+pcg+cxHY1feX1W+0fdehiGx7Wglxl92YA4cGMsMEGlx0+/YFIUnM7 JRMQNmULAi3+D2qf2pw00IR7y/r2QPQEzC3KEg+u0lZRx7JCPGk2Q98ar3+mdjpQ9ZzZ 2vvH5N/zHx7ukps8Da5TOk1ApqW5JfnBSdOZQ1KFB5gItpX5EX9IEYdYIQjoQDhtljQ8 1/vQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=gRaCsTfU; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IczihHzO; 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 mp3-20020a1709071b0300b007ba49ec6d3bsi14155118ejc.390.2023.01.10.13.32.01; Tue, 10 Jan 2023 13:32: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=gRaCsTfU; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=IczihHzO; 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 S234994AbjAJV3x (ORCPT + 99 others); Tue, 10 Jan 2023 16:29:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234326AbjAJV3Q (ORCPT ); Tue, 10 Jan 2023 16:29:16 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B170760CFE for ; Tue, 10 Jan 2023 13:29:11 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30ALGs7j030302; Tue, 10 Jan 2023 21:28:53 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=gRaCsTfUIBzx95Yz7G2YzaxsO3ttrccPO0pbzgPbu4JOYwEXa9TfgAxiKYZb/+5GbPZ0 KltVcuBZj0vDBbkBEsLXi2mp2kQvEy/648iBPi6ZA5a3YMtmrb+PcHks7D6SM/FKlde1 xfhI+XpWviHZU4ohce0sJ36z5i+TH78jK7LIj1HNSmfm029a6TQn5lx0T1vG5ZJep0Eo yAr2RLDc6SjRva+ft+qQv0Jo8J0xXQdv7FsJcpWtTeckUY/G6B8a1k6A/WWuDVfUz9MV YQEJnkH6lGWkTOqjbHnTs+0MJtgF12XLj21Gn7iqKSBscMxVb8DAoNFN24e4/D167KDu zg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n14nf9t20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:53 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30AL8cBX013069; Tue, 10 Jan 2023 21:28:52 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2170.outbound.protection.outlook.com [104.47.59.170]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n1fp4gngq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=enYiR0rA6BOEgu8ucj18ec30RZOSZIdqztKuksE5kdnhwS05oCjYwD+ADBQ9223Vw/PT23VzQJY9Q/TFtvFOVnRv0XlLlYiNRmYvs2TsPTF8utx/6l/lmFDtiSm+0OwEcBpyUEOI2kTXB2r+/IbgYqw7P5r7bDTawGMO87KHQqdTzOyyLU+O8pBsvd+b/u7iKBGSv7LYY4rO5SBvXEJthcjGgyZaSHgiW2a/3tldG2qQb7IJJ/7SqNFHFrfGmAEGV9j5l1nPh9NocnRkhNSFaXZmhh7vTXIraOwxjS/AbntoFgz9pz7ux5jR1sNZYEhOdT36y1pBtIoOplksx+l5bg== 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=Jkzie+AX+KOu4xGrzjPpDEaDxp4IIOMtF8mtVCq2ToUXX5widJDWI6vNZlKdZScJ8ccFEgHozI5U87zmBrlPKP9T7b49PTw16RcC1MBve/PuHs0zPT965nzmO5bV0eSok3plo54QPw9DWq4oTAcW00LwmpEj6X/G1JlpClkN67q1DLjLJmi6a5+0g7p/THBMwCfNEa7yfmFpTVrTdzHQCMYAoJLuJhHaqPQD+77Lg6Rzw/qVXPBBhJoNjCqhHVONpz5OvmtJKmkwFfzJDPwjvLtrEg6HxmUx+SHGZMOCWuGuWUaFqm1/egmlpKBfDjSl2u4Sl2ysyx7bbNLVu1gsWw== 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=IczihHzODhEkVWjSMY8OhzRFtwbT4+YeHNryldNrNyRTBcTle+iq48p//f1svgYOwQ+OsB//xnZAmo7T6b6O8tjI8xby7IU9PG8NXMSZar+dzjIXwpqcTzU2qAIY45W/eHKmPgNvn7oY6clbdzQ+acM6YXc6PL1GSe0A8buBw1A= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:38 +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; Tue, 10 Jan 2023 21:28:38 +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 v2 3/8] mm/hugetlb: convert dequeue_hugetlb_page functions to folios Date: Tue, 10 Jan 2023 15:28:16 -0600 Message-Id: <20230110212821.984047-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SA1P222CA0016.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:22c::8) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: 1443c24d-3124-4b07-f278-08daf351a2dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /Zy0KqXr5QXuevtZouKUoXH/g+00Z74A9TBRoFB4mMgxpT0EgIAU3PzqUgtQCcK1T8E5ZLaQlBXu7AEkVbqGRw6B1hRbaowgIfDqjxivKTSI5Jirpx80bXB+/CuSPY137hKyJARoEKeDAiTm7JqQqe1YbqqEzGxbju0EOcgMo1U3qJB79t2HzAeUacKMacHmUAQU6eg8vfeXldEAIdYRnEzOp0ysjhSD07Uuqow5ri3sHcu4ENHgERtSecR11yENJrHn0BIuUtW/J/4e2nHJUu10wlDMvVAgypOF4SVwEJaR9HKDvL3NdMWt0JFF7XpPoL0d5uBcL+4AJGweYt91GNFA6yOe4yZ7pEYDJJ+8BzQ7il3z6dj3KN1bdbapJJYFeHC5n7Hjc7WdLAU43OHhPuGBGQmTb3YkfKVt5j/K95Ic5ElJqriW3219a94dTY1U4xyTBlVBlqtmEogCiXoTzLOTEZYlsAeBJmMs9y+lC+E2xmVLXQfRpgcKDZ5xIIj0v5BB2Wh9WZvG9nyKpxZIX/pJL7Qt7HFJBvaXyNuyxv34WFxcxOCV9zmFCB0In4AXXeQtSZhZ/7hAShNotI5ewhtV0VPp2wcYFgm+MUKzSlc4fK+HEBv9Y0ar9cBmWTRtwyq4cOSgDatcr4hVVg5yOg== 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: rftnzb3txsJvaKEUskxY25Xi0ehcYAgD5j5sE0VcKHQcujzbhtvknSAFUZTHt6gCZ4AHCR42cYzyTQxqkHObAOpvxEs50pdpEMUck7kO59RLTckJ1h+acIADJtV9Ao4Chie6gP7orAttU2/jghag5K+nLBb0domvtM4Aigtu0axf9Gh7j2wLUh1Wp7wQQDgjWg5fRM2lydJqU2EjIokMAOy8yFzpaOtusZ4X4h1KFHl3TeVE3afYCnFYL6kOpAJF8ew7Gxo5ab/r6696aclv2W06rDh2ZetiBVbRHfZIvIl4Q4fkDZZ8PctsoxefTZHAxu4fnkz+bKHmPK6d4/ZsZo2yzpab531JwSbFQcV6wf+zLL4yQNy3k9uRRepH4XqGjutGp1wfec8ftzsb5FXDqA1ECyBA30vw4612go2CeEEWG0E8KzbBP+DVnAE1ov/vxsInVmsNImUOj6tMj9K/zBXaRZcp9dxEbXKLEgNDAXp9zPfBlup3V+Hlt5pR9220iweXY3SygltLCj9W+xVDyn33iq1N4fq6Myfh/NmnN/vLnSU2LVYJbT3iOj0VCh8tvIUvvxt8tLBgsHRd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MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wC3G+f4Oh53egn+YRzZ426/KOrVQrxBwBcmsBwiwKq1inEzs1CI2OyLiXP8YJWXlWXq+xqeWjdOXFSxvw+65nKnNWQO2dx/OTAHTv1Ip6Tn7ZW+UX1TX/IIU3paR6weNaJNDhZFciIArqKjsMJakEPVouGo0qAUeHLEvLe6tGNB3PfWb/qEHIF6aTitgSNKe5dgL+Xjnb9HMR2Xei8txhlHsdThZ/vlasJikYW1s+Hx+7aFRr2cS7TevkbFSPxy3eAkpFtHRXSzWSSzjnLw4p1Mx8srMgrIWp7GbMHpPHJxD0wBp3pMCppDQ7fJAD7654yRSZxE8U1LHZkvyb/r0d0F95CdAkyQkz0jsysaVWtzY4xke2ABAJfIw+1neIZL7287kwX8dQmHs0AHvU76xNbygPdPi3T3szKXWyHMM9m2c0eu0L/LuyOpOo2xmsqjOEIdN0SdrdOPee9bMY+S5ZJj0rEs/Tkfd2Ma3WxodapzzrmUURUwCUrsiCqdNQi4A9t3ODonCSqXA9RIUTiK3/Q4wRL+9IBqtPQIegbbTDxTzoZxfcTb9yqxnt+Gd6yjqFmnlSYqboqQPmifq1dutN4JqnULj4bW4Tlzn6gKvbYbshqsMV/3ABmUEjSjQS2m1Wh71b12xnTYYtjMm25z0pNYOJMFthpRWANRli81tamNbgjIYcwmUR3n+jHSOkRCrgklz0n98aZO23hQ96ZpQmmfyiE/6ufXi2CcdNpbgTmsf9XmQyel6XhlOPd6tUsXEaxJHxB5kD27q6l0UVBl3716Qt6lvvs0eLkGLrkXexYeFxvriQkQy92Qq2NTeR2xfIVDesKV6tJwEwRtioWTXL/H6w4cykVwA6HqU3XefpuFA9XpTOPCc+waCHMxIaJmlPHDueXmRcF9QhbuGiB4DsR+3QkEmXRtwh1I30bFixHmEzIWoYznLDSiJ6rCweXoM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1443c24d-3124-4b07-f278-08daf351a2dd X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:38.1700 (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: gXKdbphwEECgzz85cTJlsHLqAubDRk++Tw3AnoTHsXrjFuo9sWB93nj+sEIXfBiSl00LJ99BlU49tT6wC/U/n+YN4a0VmdytxQ59MfdW6IQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-ORIG-GUID: F8pDYTWsLqR7dy66Ea6uKUhzx4AvaDMC X-Proofpoint-GUID: F8pDYTWsLqR7dy66Ea6uKUhzx4AvaDMC 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?1754672760122784379?= X-GMAIL-MSGID: =?utf-8?q?1754672760122784379?= 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 Tue Jan 10 21:28:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41656 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978062wrt; Tue, 10 Jan 2023 13:31:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXtg6gVixHe4S04iMG0L/tmz3noU2K9CEYQRPx1KuDcRrfEVCFUefJU66HW5gNZEAfrjMBV9 X-Received: by 2002:a05:6402:1f89:b0:47b:16c7:492c with SMTP id c9-20020a0564021f8900b0047b16c7492cmr68394707edc.25.1673386304670; Tue, 10 Jan 2023 13:31:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386304; cv=pass; d=google.com; s=arc-20160816; b=AH7VFZcQyoIT3euh2nj88NnEeYO2pVfSqCIlEPDxygA+PPAPmwPBheIRB1mzj0ynnt m3OGQ1qO1/ONbWa85iGFSMsCdWqCrmaahCozZIHyVHnNuqtEZhN3l881WWjbiT9iVs19 V4K3W6Sx0L+YiQDmwugxWyGrtNkwRsMba6nU26ja30kz7KA9ShEDkp5+ai2imlFEAGA+ DcwmW0gmS1HSi74d7XLSkLM9rA3QvUwWqPcDFjtdT4u27mjEFh9hY4I5nrjNid6VTF/C XdhpFnf7/wqTBjhczOtecPB/dJu4OXUxJKDTdGnp9qGZHgGQCHXHj648mvmAMug6AKLy 7Qrg== 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=GTNnWxsy0As6XEFxLH8h4dLhKBfdaorWt8d4/kKokC/60GsmwJ+V1wczQNz0VqVSIg D7bncDMssuuiTKfqUV56NJpyZbNjjA8hRjVRDA0fYEFWp9nQdQGoD2DYZacnc5fkJyoh dDIlhYi6ZlkN31Z8uZ5Nhjh/wx1i2fAwkIL9CNCKQp80J1hiKzg+v9ciHhOBsH8/MMNY HTU2tobrsLK5Hl2gt8fa30+bYPayYlZFRfxbUtns1vwhglB7XNfAaUVjcg9JnCfjUiAL iB43Kp5+t1GhuhjSFqkwDZaIYcKnLfnxUYZeff6BujktcSJ4w75DHldoH01mXw9mGuCa 0tGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=liQg+Oys; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kApGot+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 e7-20020a50fb87000000b0048c68e201desi12118570edq.555.2023.01.10.13.31.20; Tue, 10 Jan 2023 13:31: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=liQg+Oys; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kApGot+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 S234367AbjAJV3o (ORCPT + 99 others); Tue, 10 Jan 2023 16:29:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233179AbjAJV3S (ORCPT ); Tue, 10 Jan 2023 16:29:18 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86E805F48C for ; Tue, 10 Jan 2023 13:29:14 -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 30AL0Pw0030230; Tue, 10 Jan 2023 21:28:56 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=liQg+Oyswq18i1XeSN3JWa52uLQp9deuM2P7BlKCXG78m0B9FlGi+QEWp5yI78W7ggAA HvGbPavVCePAhYF7ITFEHfuGOU0RR0iyRk4ME9oOBgnACOIhHbRfEPtSwfYlFX5fi0OP pdA0BvpJrQylVEkibI9nNIc4ft12AmuxoUfJkoYnUgBrqUZLI8GBUVYZJFoq/Hhgepwg tMebYCJUmJU7USUJ3C+5L/fAWI+Yd8jQEk/oEDM4sDo+R/LAa45ZVfnPIK6Us7qKduRI Pf6hMYVJtIkk/U1NXY5qZIl526QXzK6SKYZhC6PAZ48kksuwwtalO7sS08W9OZRerLK+ Bw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3my0btpf80-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:56 +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 30AKY8kU022668; Tue, 10 Jan 2023 21:28:55 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1f5x25br-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=noEEqFT94ehjSChaYsvymqQ8m7qLp3FaARO3VVRR87U22ybv+PIOwc+wxM2rjraHSTAIksqcD3YvDcMljyapVJUN28I2y2VsW1oKciEkg6TNvWWE0xM7fZBfqFizwrir8CkoQ24bINKTJo5puuPuxzMGbaNcMAadh/tJQ/TVyD8jLppBCdpcmlZJl2La89V/SobAigcCDorlhG6yoDUFB7l2bXx/u7gKUZu3g8FVE4rMXBLedsd+nZm1LuNL/H1XmT2S2zuftxfIoBg4Gvj7soSA5h5VaD6me1vUmVU2fF7bI3BLgjKXQHK2//te+1p5lJKhUZvZaDnIFDUKoiZFpg== 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=GukLpCRdkDNd1+Q8Fuq5R4SmINQyUwfRvAlF6V2MyDC3Kjwc6OvyMN8sBRg0g5mTg/b5R9ygTEuvu2CPP1ShNHt19blV5f8A/sNGrkjQmbePAjtIksX2c2eDzUYY/5vCa/ulOtNcbH2li2ZhoZPfdZEDYxHL2krFCePKO8xuNcmD51CrQckckGNY+AiGOWZSQcGTs59kjaLPkSVvMABkDy+GJIEfcs+nMn5fFS5qa5qO81YQCHvWV7ueUZUuQJioKYn/gR8PbOZ3Xj5RDbmJuVXx1Lox4Sd2RU/0kly8iw1Te8U3FFozlAeAu85R6EP9nO0jCbpSytIn7AFvy0lZ4A== 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=kApGot+ru9Ozl1Xg/OMtUn9lilmbUIPbpZM1cB4k+bB8e4lQAdQbVOnIQo72hXx7Ndik0vw5EtHgemeAWWMStQwurPsB2TObXXRrfSTrGaDrf77YdE4ijHnrNaNT+PROorxBjm5rh9UpfJ3Kgirpwl3GaOuJGdeQb1VkwPxHCKQ= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:40 +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; Tue, 10 Jan 2023 21:28:40 +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 v2 4/8] mm/hugetlb: convert alloc_surplus_huge_page() to folios Date: Tue, 10 Jan 2023 15:28:17 -0600 Message-Id: <20230110212821.984047-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SN6PR16CA0041.namprd16.prod.outlook.com (2603:10b6:805:ca::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_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: 13bb35ca-93b6-4bf3-87aa-08daf351a488 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2GxtNwQ8zfWyyIXBljBK/5885SE3Xvh1pSEOBIzJzuzMNDFhi4kaHwUtzmdkl88LwW3C/mkj8zDLKI7gXCDkVYdyP6Dp8R0gXSRpuzy6Fbxa6ikurUoPC9wRGl8nhrZ3UqUSsFo6mGc9Un7jhui/3fJ6qqn1cp0lwSAymhlzRGjOWlYJfWk2a0P1TpxvdqZ7xdP0/CpMa6L5QDDk8+ZbFvnTfeoiJ05iBzTZkmsFu45Lvwj1RnldFU+ZAwjDCeM6BWPAhUwO1ZcPw9z8jTf052BldLz90ezDQ+OISm6w1EXnlawF0NUSDUyMyHfZaIjk8WcUyzXeHFR0rvmilGyceeCicXY2W/ZpMKnJw8WSZDSWgd7udX/1f044EXVrATe5aNRmKCnP8l3O9inmlLJ/g2pXfSpnjKb7zwVac49qUsF0f69R6nng4qVrhm3AYKXcE5Wa1+4yQdY8kyoC0Vh63qhQCNvmxM9YtkfMMxaEoulIt5afP2FJosd0Wj0QZqbI3uviVZ4lTy00rfXP6vxJOGl/X1vqy3U5Uln5RPaNdTcWH70AG2W9UxiMmpm5JmPcVarnfbSHZgDPemR79FItLLmGK6IOm8M1hpSVqdR+dhQPuOcP4oMgewjPrS/duAODtfp/DjpOwpwBctH0dAIViUuufEtsDCR7ThgA4Fq38c4nKIlgPbwyi9KhGoNg6QiG 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tQUB09hrqR/ZraybNqzfdzZZp0FPodD0QdtV9aAQKyo0wvWBDVLLps0C73WQCdJZ4/mKxgzYxsZvxrtE4+I5PHaYBzmuHqWijfHuWdOuu0dHxYefP4HNTuzwIEoj4iNnn1fsQd27nMoU+O5OP2lfqGwoajC59dxbnQHqs5C4y0SIT7fzuzf6cvbVUvjlZsoESwLipPIorkhHpdvtcN6xBxHg7KqVSZTPX42icA+NkeYvnkLH2oalg4efiFqxv+noFRKPZr8VnHN4unCEeJUptjaYg9gbiS/Zh/zSJsYJ2vkgtDkt3Xf83mzoTuIjsMgnDs8y8C8ElRPl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GSbpFGF4DjkRVxws1BID/D+/OKVv8ywIrgAzim293/cRvaBqmUMtIo0DROuBLUdFhKPhFHFjgseCojr3z5s27JFx6rLbFvcASWzAKwLAjP8DJux6o0caFQSpSTfNJeGWEtugziCpeJ7vHZdw855cw5mxlgSqb01RR3hO74BnBd4b2Fs1AosF8CJpbteL8tHg41nReSa6vMxMiVJadK3V8kXY= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: WLXKdyFDxDuZGgbzCmMs5l2Ck9vVGh95OE9yDUJqjiWqmaXnZng5WOZv7Ps9xRH5m4uLmbFqQdLuL/zhgnzWbNxqYe+jDgxnYfJhJOZEYrvWH0bv12sS8cWmXWm3CMgHSKKKBQ6Ftx6njDEgWPAsomAlMDEdKZYG9pBI1ZLc+CEqWpSBSJ/IkRNmtB8JRu3zMZvSzlDP1HRmbQ800X2c09g9/zRR4e1FJyu+g1pEJnjpAUECvT7v1yiOMkc92wjeNDex3e0DVEOzS+Mnhtwe4wWf0sRSnifVOXO0xP1zeHsbmB8KvycgYftbMiWwdmiaBVzledsKbZt187KHRoijSzLKMhoTI9bvzaCRhshB7MIdspq2tjo7G7dfePBC9MZNt/lVwPda8I/mNEJvS7hgxKVGUajBUbdyPflddgJO1yKxk+eDc5lzFvJuk484nz+4/DdB78Toimtv9w6G3RfBaHwF0H1oznySMfUMTE+07XTFEDW4HCi47yD6sQMaMEb1tWLYo47/1sAwTxKyIzEylUuuIiUlKx5mFoY9yPgsWF0vYjkt11H0xIigYklr49JRFfTdKvgd8ftYSNOrK9qUOcrkJfUDCF8/7U7X7N1082qzRniWyisJk6ygqp1HnnIIeEmwa0QK+ZG8AGJb2vt09TiJs07ggZe0I6IcvQjaLEw7WMV7yxeFcmT9MWU/SAPNZ4dnq2JT/O2/Gi/V5NRzUtEyjKujjoXoSeCCTUhA5yV0oaf6tPSbl1yToR4oSce46pqMYlfze0GpBiKSbOEn0+xYh8Go7l5F6evwsigwFvREbrb9kJa6cm/Qy8Yz6/gRfnKxGcmaaz833IOZsuR+tNdOPf0OK/VAc9xIsHvqsdN0rYiqM+vli/SY/XTpjuBu38x3Jx07AIdHUo51EAe2q6/cdfqaNbjq95w3Idv/k6YvXhz3N22hA+ipJyovpin8 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 13bb35ca-93b6-4bf3-87aa-08daf351a488 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:40.7313 (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: 0rNl2NzajHxHF2kx/Jsej0Ic4/Y8SdimmIcriQwIs0uCTwnBSXQPho0UpUa1mLMUm+2zDQP7PE0ALnTQYmG3gik8/maBieh6mENKZ/cxTUI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-GUID: X8_GjbM1-XiPd5aTgnVEMPyCWNJx3trr X-Proofpoint-ORIG-GUID: X8_GjbM1-XiPd5aTgnVEMPyCWNJx3trr 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?1754672717938347215?= X-GMAIL-MSGID: =?utf-8?q?1754672717938347215?= 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 Tue Jan 10 21:28:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41659 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978278wrt; Tue, 10 Jan 2023 13:32:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXvqWs0NMxRSwLC5EWfYiAuiA4gJv3zuA/Z49KlRH2/HDtESgTu/a1NFKDNMDys60UfHa+NV X-Received: by 2002:a17:907:d109:b0:818:3f54:8df7 with SMTP id uy9-20020a170907d10900b008183f548df7mr77871295ejc.2.1673386337036; Tue, 10 Jan 2023 13:32:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386337; cv=pass; d=google.com; s=arc-20160816; b=vvU0KJSU3Cn66YVGC2Fr6EEn8AdPR80RlV4N0+i3h8pAxw6uEHv0xOUXUvLa0lAwZ2 RAwGcEDL46C+gaMXoS2snCbgoZzmP/FdrUSAVbShHpuNqCuvs6FDXiBKxb/uXzahsc8J NkUUG4lGmpQFmEH4Rcl3beMH1mVkmks9OygTzJb7MYM64rHXHnHjRR08PV9+9b/3u5Wq XCcLuTfNA49rmsKReTexz4C8Gq1QxB+X+M/qWRbQwnaBu/ziRDxcRhdcaXFyT9BmVgVH jvCPDvyXq3dtaeRSC5tsn08rLEbbap+U6s9ZskTpIVTH16teE6stjOzSUt64kPSG7eH+ 4y/w== 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=0CpPRZ38whT6a40rdvOmHOUj9sz7QKQpKRbWzKiggczv2i4olLVltOB7J0VDEVIZJe AGI95Elv08yRQ1t+lu6/8AAPrQPZNl6JVk5LhZmtIV3+BpkU3se5xeXxOubvJFPYyss6 Ax44BOHe0e+hZrujJu4+86xmRk90/bdoLn2RuCnD9HZiSUGblx63EdEdv/l1St0o/EWg JjYKvTc9AOevkz1ScL9Tvea4e9TTMTSTQl2ntlf582ojEyIXzWQqmBkgniBgJti+ro// TqrLBRJXq8u31rbcYZCs9FMVs88MaeWIPnhfcOOkXaiKYcmyN0lPO9ghLSMd5KY+BzoI K0ZA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=mOdAsIBV; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PReBubmr; 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 dn1-20020a17090794c100b0084cd1f106bcsi3297500ejc.467.2023.01.10.13.31.53; Tue, 10 Jan 2023 13:32:17 -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=mOdAsIBV; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=PReBubmr; 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 S234389AbjAJV3s (ORCPT + 99 others); Tue, 10 Jan 2023 16:29:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234551AbjAJV32 (ORCPT ); Tue, 10 Jan 2023 16:29:28 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCDCB61338 for ; Tue, 10 Jan 2023 13:29:16 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30AL3ccn011294; Tue, 10 Jan 2023 21:28:54 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=mOdAsIBV+cT382pE6Oia/JAR/CyKuOIoItJHs1+lWj87QqQjBcvfBcj/o+PPadRdox0k GKrmbyTHZDOagxh4IZJKk1V0DKZErXWQB1Ptxpq2995dTmMGnW3oysxGoHPZsnST2bqH rVhb7/Jqv5mIdYADWVJsgP8kuZB8CtOvI5NBe85PPP/KmZ/GiA/ulr5nGy/tyLXGKu06 dH3g7UQPZN/qG/XTA/YecMqVLNUc4KtOrsEimWrFJ3Ironco1r3F9Ko5deRwIjKvd+gO jMrwOrvMhK4Ym5oqLQHC8h9n89EkNeisoAURV1ihtQwxSRAwURI++FAPLBXrAzl0OqNz 8Q== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n1fe5830w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:54 +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 30AKY8kP022668; Tue, 10 Jan 2023 21:28:53 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1f5x25br-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jGFv7gtGJxVlGP5fjxefIKdR16jZc62au8tQ/K0FmydO/DuymeTFIpIc8lX2dwTHr0K46lMQxuHXo6vRK7Ns/3idYGKY2DqUgSVIOEy14bXKqb6tfAcwfZGpTzx6oKqUVJJrpDtN9eJbQEln5I9vgxkyLYDQA9HYoWQpxDMBUZkRSS3rrEFWKXm9/Zw9U7EJJ/+r++fKW3k2YrlnLshbnZpcqwFIvP/C6lgcVoFMITeTZu36KDmNDzUTZjaV4/LJE4Lm7g4kbN+Z9JKNcCuVATERA9Ag3F7YFvrxUcgG6rBfpFx268ICB49r/xhOElD9e9svKbk8yJg9beo3sNnB8A== 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=YmhBIMFU7/nDvYkt158LloSqj8GC2rbUsEL4Kg97r5UkU2PUT8pzF6DgRo1I5Yw34LULJOQ74cWB5IZy1SXhdaE8GZoNyo4SbZ58YjN1E8z0+wwkJ0cVSR1v70uzXn2jdoVy1R3yrGCDY3yEQKuc8yZTByEgqPTOT32iYkIEQKOdrfegp25PEJBmyCwjMntnFB90rd3lHfcMwWofDIsuVa6QnfrY8HZXEEhznCZQKz2p3GmeRc1+YZrFshNFfVN36wVeiawz4KYd6qulRyvTYyz1pvFOkJ+1I+fTXQOscYJlR3SHlYNUOqcEt4HZBfxFs1qeiHsFSktnHQ4+U4y9Xw== 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=PReBubmr2rq5V/Xo4W4IU/JIW2qKsSnxndx8v5oV/DJH27ePUrSpYanBy2e/MM4DOb+8jEB7K0ZY/KYolKH+OO5ubZ8SKmtPXj5hT7mmmZis6E5T7bY77dAN532Bie96rz0FzxWI1C4H4jQgYeaeWT2gwCwNeu/23/KhR88rApc= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:43 +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; Tue, 10 Jan 2023 21:28:43 +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 v2 5/8] mm/hugetlb: increase use of folios in alloc_huge_page() Date: Tue, 10 Jan 2023 15:28:18 -0600 Message-Id: <20230110212821.984047-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SN6PR16CA0053.namprd16.prod.outlook.com (2603:10b6:805:ca::30) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: e13fcf2a-5eb9-4d70-5447-08daf351a61b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UTILyRM7v1NDC4eyaE36NrJ0kqnkQjBiuW/ffcN0ovNVVNFCCnr2nWFFOTPJVA4qH3FVcHTkQXue+OqWWANRJZCyxafE0s3o8gFRce54NHAJ6kiHiv9UCk0u78yK3BdjHddlsR7873/AXSAiMONRox/s0y39+Xfp2B/UsXpCyIcBXUsPeL4nftP62i9MFPMlno1YDN44aPUJzubYXFCwcx1h2cM96Kk7enPjCWhTccwCQSilyrfNWBoiUQSeg3mCVcqTzPihKaDSEcxZ8EW8JMHcE/uWZHo9yHqhEgf9CSfjQUJx6yXoRSd0OKReKyN+RHTwoBVuzCZCaJpz+rAKw+ZZswlZNtY3T0XhlXHBuoLAjzovp08lTjtn6w1MA0qAZ8Sh+9kY4AITNckOvuI0+b6QV/5SpwTP5Iiw00Kdi6nkEGtMkDhg1oRLhhfCWniC02kJsvVlX/XPnXrLwdG5jIl/ahy/XgEeRjw8RWQUGXyVO5raPSt6VWzgtcyHFcRXJFACU8/P1LYzakvS10c9E6jfw2aJRp8VUnfRYOB8t0udaNEI7QWsOeJf/jGAw/6Vkbqs7ML9D7HpDi5xNUVh9F8dD/K24ducCJYG7MH2Cz9q/SshgF0EkC0nPHQzSC4BM7PIW9Y+zj6vNdA0NM2QVPf+ApYZa087xi8LrjTuZjX6D2OY/GK2mWWAXgVplSk6 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uCHurwADmS/zdCWzGip5P+tGn7009sNnsPA1wpXmYIVwz8DMlv6ow0L81wbX3Xi1crPDgWy3VjgDiIKmNTRS19WdFTjlWfAwPQn++KGSKzc/UwVmuem+Mqye5F0LKG+wOl67XAaU595Zg0Gh32276qHMHsu8qKwQnv4PgpwHoyGq+E8zbnJucxT4IZCICaapQTT5x2OF+9Ar+6T2PxxDjlkSCascWkCiVCNu9Yh/oj9+Z5xpDaouhkBqtTDLYPtNeV3DBuXhGo6Tyelqzsc5DralmSGIuMWt2cH1QsWI+TZXyShDsBrPDCjTnnDaiXrgtijf+DJKAsea2n0ediquqnqJxOR4c8aTrkAU94jVhziMwDn97A1QLginqmtXMVlrAFuvygfG8BkT/sFRym1/qZy13YH3htTJmyka0wl8xUdo/8XpU6t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swa+Cm0/kYdh338llTAGlSb04JIQPZodNaQgRXgC3sd99cut4TYHx/SVxWARGeFbaA9eEMrFVsXeLbqA37hMibx4GVlV+V6O5Cqa3pAll88R X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e13fcf2a-5eb9-4d70-5447-08daf351a61b X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:43.2774 (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: JrMchX/CdYxNIYn0ONyzoN0RbbLX6ilnoBiRFi85YnuXOsIUmDiEI+dnKn/b83ujdBpc6v2/aovH931Bl2+lwCvtxke5W/H/1SN5MHHeNpE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-GUID: 8SP4qecE-oqOC2h013PD0HmLHcddQYM2 X-Proofpoint-ORIG-GUID: 8SP4qecE-oqOC2h013PD0HmLHcddQYM2 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?1754672751749708415?= X-GMAIL-MSGID: =?utf-8?q?1754672751749708415?= 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 Tue Jan 10 21:28:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41663 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978556wrt; Tue, 10 Jan 2023 13:33:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXvriAbCevaIZ8no/HNjVLMmubdDY+plfY0uETFCv3g/VKIjFetHUHI6DVPv9amPdMnZ+70V X-Received: by 2002:a17:907:7f04:b0:7c1:36:9002 with SMTP id qf4-20020a1709077f0400b007c100369002mr75718094ejc.67.1673386384370; Tue, 10 Jan 2023 13:33:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386384; cv=pass; d=google.com; s=arc-20160816; b=eltnAi718xDmJ4pn3vbjmSph9xnmgafRc4Z8oLoz46KAM4hfapcaZfHZYubBkGhjqI WdfDVbaFWoubNEJSEzzrfEC07NlRCkzZw2RNHLDn9B2JN61HJUw2hZKm7s/+gSup2Dgx XxeTKVw62DIsasWYaFeaLJcN8Ta9tH28fSpkies/CjHz66ts+es7p88PMGneye4eaQQk s9E2uAHJar4pHdqftB/9YfwY/yjhQqt+RdqoIFjvS5PmBIzNRMwiWM6zvy31Ybia1TxZ PIcdWn7Qlnl0B0ESMyIIffQ8qVyRWnD88zH84OW9dcVv8UWtsEYnocYrOXMGvJcpkaz8 CFDQ== 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=U0og07iqQinjncOrMLaldynSbNPOkEhEM5I0f3D5nNsCrIZ+OJtCBAG8DfZ3o7vZJq t6tYv3gGDfTZdTYFpB6KGYXuq5FCpo3ThRpuoHmrezTD8S5XZLTdvry0xyz9mOKy+sJ5 BTnksztYZY1w+o5VmYWDdEWnEPH1hLT/vaIql+JaTWcdFbh7RaxrbGm1tzYdwWWoK/LK puhBDLd17jVawNfFKxpoqFylwjZuUEBhlR/DdXR0cunQtk4u46/lmQp7on4XT6uCltPZ tAl+bmn2IWTFMd4rhadOa05cMMs+wWoxa9HMtTJJqfyVdmmDx9iag/9vBIXEcIE3Kl7H YKHA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=eBp22SYB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wOwCSzhr; 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 fi11-20020a056402550b00b00499c424f683si2707271edb.223.2023.01.10.13.32.40; Tue, 10 Jan 2023 13:33:04 -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=eBp22SYB; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wOwCSzhr; 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 S235275AbjAJVaG (ORCPT + 99 others); Tue, 10 Jan 2023 16:30:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbjAJV31 (ORCPT ); Tue, 10 Jan 2023 16:29:27 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED15C60CD2 for ; Tue, 10 Jan 2023 13:29:14 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30AL3cHe011301; Tue, 10 Jan 2023 21:28:55 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=eBp22SYBtvNKEZ6zOprjdyIyBSwdb/3z273+jMBssMP1Okfy1mUL8kBPSM1Gv0hY3TnQ wSEomke+4H9hQppoydCfvgDKVmk7D85tVfzmeg/GCSorOP9xI8gHo21Dr05AkvRKlBSg L3Faf6Y60oK8vgxwdIYAY5824ClAXfoCBLc5Z2P6HGFRYFSJxXO62FcgaJJIh8+kGjRg e78EWlNhWybGV1WreLzVMt0yAjaoUfdb4QKWuWjNaFWHTiCqu7KBiQ42LPeDuqXqcut9 w/TcFnmRSUaANd/6kDLYou4zBvVJGh1S0P5INzij1Ksu8swXwBOOqIGD06lLYMnheNIY YA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n1fe5830x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:54 +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 30AKY8kQ022668; Tue, 10 Jan 2023 21:28:54 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1f5x25br-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MeSmqLawREU9WB+NmaDkjvt3fVoAV39/HkUC+wGMFw/8IaQ88aKt/druCCT1C7kqta2NazqsxcDeHSv37bD0PoGBezTQfTI4SF689Z9902pLe/KrdIsYIazWshlBwRMLavBPurmbino7McaneItpuhS5jT+w8FTNLCWtOQEZJEWzKUBAiNajptLYrGhaxQ2/cMHuFlSgYAEixVumqqbZkpdYf/P+4JR2AT/JeLJf/LHIgQzEEzTidU0YFbnRbrny3bjjywgHLdX5SGeK5J2MRq0abdcDxtgAhrpJN+SFXeOAkheVFDCu1gbsYuCFBTdo1oMU716WuUlWz5pbhFJtlw== 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=GirLEpTHL9Vyu8eipOnHfKDPdlzHFmgvcdIgeZ88diB+QObIe8YQqX/SOV4S+wwibEHUxMXqWf0VWQOHTLZsI1+5Dwvq/0p7TwbHuwIidXrXutu/SgQKa3rqr532kjI0Hw/m69Lnt5ZYxYaz/gw8hJG+fLXbXRgIlmlwjiKuHDnrMVDJygkb5Klk1W/8FKdmJN7u4t2ViDqw58/Lakzb7Oz4dzhbicO2i6qtmuaf/DCmXfIYHW4Ag3W0w1V4nWkYKuU0zljZn2Ks9E59huz8vxxtm8GpoV319t2OTBEdsOWlzD4qZsLQ8sZGxhm2ye1nCnj7RQ+TqI0h5+tjRvjpMQ== 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=wOwCSzhrSDm5sM4iJ4hMhPgXHZFFkCA0su5HSt5Tuj8MkP7KDmDVbqzo9POoJjc0BhL+lPCIKcfzlkmr/b1LWoQIznHm/S7LPXcIvLOQOBcurLkNZUHkDuFFWYDMjr8oDfYRWD7DcLvkyqt/LhCWlZStTs4o24iBFvF3FBUJymI= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:45 +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; Tue, 10 Jan 2023 21:28:45 +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 v2 6/8] mm/hugetlb: convert alloc_migrate_huge_page to folios Date: Tue, 10 Jan 2023 15:28:19 -0600 Message-Id: <20230110212821.984047-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SA0PR13CA0029.namprd13.prod.outlook.com (2603:10b6:806:130::34) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d520678-d78b-4982-8d93-08daf351a796 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HlGY2VRmQt1jtAqr6txqzH723D1txWZd7Q1oyO2nJH5eNBSPayQPIq4WO2tlL1isVaZgFzMO6MT7ZPPj58uwraEU8HbLqeNMIQw4U4x4yH0UHnYqh18uG1vlXnKRieksSa9y3CG9Uz29BaK9UAV5gMxnTuYg+CotPBGCChrr4CYfDLPMxTXofT4/rY1q7Y5KIKdbtMXscrpKXvH7OdbZnYP0Six5S1HxBUxTr8V5mR2VqB334MHhhRBnMXHQfzCQk4u/b+FbgWFNzwZ4Otd1HTuG5p2N2mdzTiO3GCSFn4p6jJC7cXMstwZxt+rj13uZlFLFJjsC6PH8+yt4AP8YZZagw77pedHaydMbTiZ/WMVvzVm8n6JyDYrpz1SCsrZX6wYixUn/Pg76LzOsxu0N/hn6d221ZLcUelK2kts5IN63f5uzZzd1Hi87A7mEkKp1qASsUer+OAR9B5z7+xPgIzuyg2stCqSe47PCK0Zg+Vi1Zm+0vFGpTnamD6Kz35BUFFpVmToliv3Rnm6YJSaTmYISt0oJ2nIgkEmHFrtiSWo78ZRRcwzkJthEUALRp+M6IoYRNFLzz50xd4OqyqX5D8BZNbxogq037tRIbgGPa+OS0rtU6VKhaghXp9MRmxrJ02aFTiBJkIrCee8DsDJlmQ+NFgkKjA38Fbv441k0DAL2XQe0NO8rnIfUdLIJ2sId 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7LIBioIc03Vjh6qEcvWWmobp+Axm8JVNcyNppew+iqYv8I7buyvg11hhfy1cPJItgzUJtcPGTGEs7iJ53hGG7ERZ3Od0iiLnFv+hoCav3/cJdxz774E6u7Em20bdjw2m3oCRn83SYw3+btqrMc0d98w2k7We5B0i6pjQWJmunQ8Tb2ETuyy2PNcX1G3SCkSvb4smtWHqm76y33TuRkK4QxNFSTkywYO5S646m7p38d62olk4wQBhLujej1wWZOJre7oUxeAJRZ+o3/HrzyAEgdzjg7CdMRWZ5qNo7jUBprcYw+IvImPLhB8QHZwBKBt71aPlEQu5ECZTItypOsWw2jytlZnEY3W8O1zTuV+WIOZb/bbSeG0awAxSXf6VzH7JgZmLS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kU9RExaIcjk+MLZ1J6DLeiTMpWDran6D/OLMFP93pBBLdroXqyZnKEewKbeuVVDapAtQDnfBr2ozKx2Z1GKGEL/hilndisaUvTIRZSEfxXloywcEVEK7qJYKJOtB+TOARp3LbG X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d520678-d78b-4982-8d93-08daf351a796 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:45.7783 (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: LFJznWQHR27S4a41dMgZ27GkYO0X18py7ywBMWPzMlzgzx4MV4xlHX9OsMVClLaq9RKp0CzmsxYpWDAiTsC3tKqLJl0XXJOX+rPxaf7oWrQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-GUID: zZBcUxr38dw456bCMStSmob7VO_kQPnR X-Proofpoint-ORIG-GUID: zZBcUxr38dw456bCMStSmob7VO_kQPnR 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?1754672801389653943?= X-GMAIL-MSGID: =?utf-8?q?1754672801389653943?= 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 Tue Jan 10 21:28:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978366wrt; Tue, 10 Jan 2023 13:32:33 -0800 (PST) X-Google-Smtp-Source: AMrXdXsINkC1UtU/X/Clo0L0+xE6OfMnT6zKL4lpM9z3qAUrdgfQCvSorc6tPwxPG4qEwc1a603B X-Received: by 2002:a17:907:b686:b0:7c1:7c3a:ffba with SMTP id vm6-20020a170907b68600b007c17c3affbamr65377678ejc.35.1673386353306; Tue, 10 Jan 2023 13:32:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386353; cv=pass; d=google.com; s=arc-20160816; b=Pk7D5YfsPoyhb9G3ffLRTUkYbTe8xfa1ZDadpt/PuHITA7vdXLhvxjLWYSNPDO4zFB mOqN/Bwic9DwXH5oZVtnD9Jkp9BuqvOUnAmXY4PulFB+AohqCOdkqk6CrXmjlF9Y8RBh aUBdqD3YX0MhI3XKO16PmzPJJk8r/UXr73F7NncG3daGTdcqdzStfxefpL2Qn6PY1/5A ahU+OZy9h0KChyxCbfkQHkDiKcD7QUC6BRKunMAoQBTXA9tT/icIhHbNx81E/jh6dVbE W/BPahMlhNWatlKf61b9YGu8Lw4rPc8pTXjme7zCobD6qzEiz9PoiMcvSN3eyObwcW20 s/SA== 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=O4JvHYV8O9ALfWd2/mPr/Bq/MXXLv3y9Xj69mDOrtb+bGvxUHlKfA4/tzIUrjpIaUf HsRuz62A7yyTvkVtt4ivJojCD0TXmBurDbku/FUAJ3XhbFlaq1VbRKq4n1ympt8l8P76 LwS9m4ZOW3uc8uMI01ORJw2airspatSXp9UBN5vFawKLA95NetB9etYye1rKBI6Mp9hk Z64XP5Yb720LMQMHcZ5d6IjJ2bj2RyGPS/WTfKkoluw5L79zTmAX1oq7jHBB/C8+i1c1 Tzc8NE7aMpT6QMpXozYwc4Edlw40jrXeOe/Q/yMxOzrArMK91TRd1A1w8XJRwhM8ueVJ wrjg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=bjHs6MOm; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BVjtNSEA; 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 l5-20020a170906794500b007adcc8fb7a0si14834536ejo.399.2023.01.10.13.32.09; Tue, 10 Jan 2023 13:32:33 -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=bjHs6MOm; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=BVjtNSEA; 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 S234797AbjAJVaB (ORCPT + 99 others); Tue, 10 Jan 2023 16:30:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234449AbjAJV3R (ORCPT ); Tue, 10 Jan 2023 16:29:17 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0516560867 for ; Tue, 10 Jan 2023 13:29:12 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30AL79oc003394; Tue, 10 Jan 2023 21:28:55 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=bjHs6MOmTGzeiHevdYCLp9OUxMfy+MIR2ELZC4G02tYO9Fsc5HJSaL/bg9gPquqGyNfh cjL1Np2LC6r3yLb8c8HO4HCWxI0Lua5qbozQH+g8D+jzPK9YNWF+lK2LUrEbWsEuXLx6 uecQYGYq76DDu5dIedNOA3Gz01RB2U9UcICLB9vFuK2TCt3N6XBcsdxjQUONKsKiyCAU jjEWcxtv3MqYrb6yGOzbj8evabR5F4trPt8Bv//NZn0R+D+vAb02sL2UKdQgMoqOeDnw 2mMuphu55zSmVx+n7FYOtvazjNIAJnQB/CiWgwHHNtpMpcqIRvRmKmWOibUnulzPwVov 9g== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3my0scedt7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:55 +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 30AKY8kS022668; Tue, 10 Jan 2023 21:28:54 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1f5x25br-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S5qV87XunAXGbyq6K7n/4PFOCelgPxU+ic+HyQrcTVq2GzfrNpvPPU96qdl3sRGbIFtR3y8wa8uVEUOS0zH9ESBSqpwyifjBjhKJANvuD2Oc1X4cck53jeKBfGwwy9euu+bpjtRkfQ8fhmO5vjij8YiPdCMWMpmz2a083tRm+WYW9VBVmEfOp4B6ULKe9ROhNUP6yj4CEoye27pWdW/1GGjKAWyY1vEhCR40rQ7K8NMM9v1485F/NRauicrYmde7Sd6tN1YnEPzUIoRgNpUvjamD7le9QFB12fmGYiRMBH7GsWwgXY60paebmYedCcB0j3exYLx8RYwCWcvLaABxAQ== 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=O8SOIX+4kAZVGhWCM45Wk0DvCAs2QMcApXfCZiuQy/I20HQPGWdajE1vP3Q9yRI2bH+DnRV5jgJI5KhXQIDQtVXRgpMlpky29I0k7ti3/hnqZVa3GYYQ5qADSV7c4RKPolNZg6/biPsSxp3e/w3qPQt3a8M5liLXKGdF7ggvp0+lM2L5l8mep0SzPpa18LzchOWiZcUyx0iemGTVmxredMwxVsnpOQWSBuUkFxa4epbNhH/BiqGHGDIFxfw0YA4pRUG1+1/1gnyGL8eY/TK+6z8RNg9bYGVuEj57sEnjaP7G/25SzjBGoo1jPBUOVyqS/ZznmT7DtarefGU0wbFlfg== 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=BVjtNSEAMruyUhcWbt80p6WDBx2GX9o0sPxu6vfc58yh9NA9JbPQpdCvN3QnCur4BdmjUwiUdLV5p6Jz6XdIHFZmCclHP11ERNs5YKuNGCVpgH+Od5+yuCDRplQ+nlG4HkGihtWWvMOJjavtD0fKW8ekdjfNr4JqPZ5lLzE5CKk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:48 +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; Tue, 10 Jan 2023 21:28:48 +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 v2 7/8] mm/hugetlb: convert restore_reserve_on_error() to folios Date: Tue, 10 Jan 2023 15:28:20 -0600 Message-Id: <20230110212821.984047-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SA0PR13CA0017.namprd13.prod.outlook.com (2603:10b6:806:130::22) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: 931f2644-3f35-4a0d-76e5-08daf351a8f2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7Op1fJXOAhxt/B+MP2vi8aVDyrKQCCF16EDsX4LgqB/PPrt9PF9DDVGfeVLiuIjioLTYPNFllbxfN/t/IhjIoYPsgu+Wsr6CXgX4Z6nuf+VRiUCF2QGOq0/bdXt0CMr0azBjSXGrXMnjopwT52E1lwEtKLx8W4C5i7UxjsreAo45ZzWuiBkplfDuXZBiinx1XYaHOtPjvCu1Xrm5a291uCgEcBKX+d6ayMLx3tO+hMARjjKBTu+falnCjcFZ3P9f+ezao1r+amHUCu3VgiN/KbdBXonQ02uIXGKzZ6pqU8tSmCqmkPdIMYnjgq/s4W8JTvPG1U/4G40IG6o1cG8Nay5wCPkjGoFfyFj+V8GPxSFFEcVHYGlNMrDbTKyEssCN+tXhVpXwb2Q1Nc/QCnmjB+ZmTvqVRVzxpZvER0S8myHhVN2DfVOksyL36M0N7xkLnNvGqqM+UwdTXXSZL8EMqW/5OOWhEZdVJ0g3ZWSPc3bwnBoBV31/mFj4DlEaB21GSOwIvk3Cv8y+xGWwdKKkhnvc8Pp1g/sPMcEke62ZD014rn7TC9XR0uqnQeQYHUQgmfXAUZHNZ9H3Ph10RAs2uWQFWYSm9DFoAZzCjCMWGHvBZ40f6oIIE//655Rakwc/2JMGy+y5IIalGp5PVFxgXQ== 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7iTJpskraAojz1GbnE2AT2KG5kENru52V+8Ww0Lv8DFjHudNUWU0CAOleQRiY2nX+ZND1lQ1lZYvxo3xXiWrb6Ccrg0FECyBpgEzNb4k9VBJHX4NxCeylKGV70jrXixozeJ+SqEux7wZvOd6+Oip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43CESzh87JcSi2ck9kh5O7LR8kS2rBN5rIrlYBfOOKzb4WjQmYnICEt+Upq/3iJGy9413E9iKYYAr93yfyhR+kr04rDX+Q5dGbfV9bfNk+MG/eQOfxlcNmzKOedRJrfMGESHwdkQFftATL0PtyEEgmgktLEkxeM5mS5vz1dzxXkk+ozm8uR+tjZhllyZMssxxjqqayeBEjS9yq+gEzpGwfbxRLVGNB3EX5of0AVBrFHdkqhhW4kDtjcp+TpfdPbcSj4QCYro/Bx/VH+zk6UVRN4gVULqVG8TXbCpLkL09y1yFhzKyGecaB7HM4ykB3a+HxxxxdliBC2H3qakNaAs4W7MzpPdWjoN1gtsnxi6EhyIX/ X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 931f2644-3f35-4a0d-76e5-08daf351a8f2 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:47.9959 (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: wOsK31rU8axA2Cv8B8kDQsG8IaEwd+oQ0zNcUBdkQlJJyDCPTTplFYGX2VK/PfgZoyTlXPfEm53Ss5+d7eOpgya0gkjUKz59fKu+pJsSgTw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-GUID: cPj94O7dIZTjnwK0wnKPwlQ1Wwdctz9p X-Proofpoint-ORIG-GUID: cPj94O7dIZTjnwK0wnKPwlQ1Wwdctz9p 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?1754672769163340990?= X-GMAIL-MSGID: =?utf-8?q?1754672769163340990?= 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 Tue Jan 10 21:28:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 41657 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2978181wrt; Tue, 10 Jan 2023 13:32:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvHrr8iKKCJ1aerrytkXdHXuKjAHIqmP/wXj+zj2gCYc18kiNv3F+T0mfZwa86sk2HKQPOb X-Received: by 2002:a17:907:c303:b0:84d:2025:850a with SMTP id tl3-20020a170907c30300b0084d2025850amr15640617ejc.68.1673386325991; Tue, 10 Jan 2023 13:32:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1673386325; cv=pass; d=google.com; s=arc-20160816; b=L8w3FrUbsp73r9DnD5yE47Z3mFq485Lqza58QoDQRbKw1NWcPjnKDwVT7lxb2ZavUG 7fBlwJD8vDJnA1xaAUrf3+FzgQz777+wEQfO0liwA20NcWVIghmhyEUrPmglzeN0wnvc /mUFOO7bBfSgHyli1a2OCAyF8KDQ6xaTWId2P+vQ5cYfXUT1c4ow7njkeWTPR2sDQNhk QIzaOoSUzEpTG6PlitYjslIfCKjxTfnSm+xf7P4iU9n5m2g1QLmf2Zkqr1CWKPvq5HD0 c58x5VPvVyr4Jt6/VtQjx1trIM6RvRxhq29derjppEGD+BmVmYXSvqEq623LdKHLin0H +EEw== 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=0HbIDU9gvROZzz6/UYBDpx1N31Qr4FGP4cShMjeUTgc=; b=xi8o4U0tIUzECRxNzeMAyKLEpwmqf126PliS1TE4yqu7AX4OIgZjv5Il1piAefmXn1 4l7qv/k3WnmzfE8bJqzCLAMmV0ASm2Pss4Kewc2UHQDIBIUZmZ2qZ9M+ZlJ7y2ngBFW+ U//tvgF1FY8Tw0uSd7uRcm4ucBpEmVjiwNUWpxrC17NzyVbZW9yT9stCfyumZ9n/n4nr HU1sUwKAHwc2STRyetKBg5B9afTG4SIFr0GTjTsbjhcjBSRAndBVZoEpWZWPBU0E/V56 wF6gd2qiOVZxpjTkirzgxUbJuX+YHuLRL/n9vDtQjkFEMs4zexOq7yL0pQsktOCmwzUK i+5w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=njljbaOh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tH9NMA72; 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 qw9-20020a1709066a0900b007c0969e429bsi14490657ejc.30.2023.01.10.13.31.39; Tue, 10 Jan 2023 13:32:05 -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=njljbaOh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tH9NMA72; 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 S235187AbjAJV35 (ORCPT + 99 others); Tue, 10 Jan 2023 16:29:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234454AbjAJV3R (ORCPT ); Tue, 10 Jan 2023 16:29:17 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376AB5BA14 for ; Tue, 10 Jan 2023 13:29:14 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30AL75TY003384; Tue, 10 Jan 2023 21:28:56 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=0HbIDU9gvROZzz6/UYBDpx1N31Qr4FGP4cShMjeUTgc=; b=njljbaOhL3N5YeyKZeNnCX6TrY2musWjLmR5Rpl1V0OPHc6pkph8IpEE2VlfpkF6LziH 7AFSviSYFNDb7B/2+e373lCxzxwlsaHxDwqxuvVNZZyHn6GQx3OHOE8Q5Z6BkhVqf39O tuKw0iHg4RdDyAUURi2NS5bm3KZaESngj9DJcjxeqbw41kUrGiZgNKP62PGTdknQ9yF+ plxQgYECpWUnoVYiuhVTSBBhiVQqJDSnUnaEHRBkNqECN5OhR23LKKAovMQmWFchVCXe iiQUgPQNEcrZJm21KueCBpn5IiZOq1vOVjdJrAZKeXhuqDm5O8e6Hha7oWw/tAMDj7xy Jw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3my0scedta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:55 +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 30AKY8kT022668; Tue, 10 Jan 2023 21:28:55 GMT Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2177.outbound.protection.outlook.com [104.47.59.177]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n1f5x25br-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Jan 2023 21:28:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nRBJjOOnvG1jserSMLEHUEEH68giFPpMa1AAvA0PWSbAgeERLuKaIglq8GdzJoLrOWjUTpep4JGs8I9ZJcCQkSFCxwVmUk2kQi2KHuIr8oh7prL/rFNcULP7+9v0EpA4t/tK2oPDttLkksnau+yTNJu00SVPZP5GMp51Y5+lLzuT/9ishVPMagvk9WVmnxracJfhK8aNGfq1RCaX+Rp8wnLsId5HLbVmf5a7oQBccNq7ORZl4hdbShUo9Unw3Reok99s/mGvsAzXbOMreo1IgXpiJ+aKALlBYWvnMK+ORCbHCHu4f1VJwXzs2ZJhSZQ6tcz9Z6AJmGHy8T07YsixBQ== 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=0HbIDU9gvROZzz6/UYBDpx1N31Qr4FGP4cShMjeUTgc=; b=JDo91oBPJ6Jjz0DywgB1Ag/gxsSNG5B8Kn1sRiuw6jBvajE94bv7Co3Jhh3W/ktqJCTrzx/TXULgeNBOA3UidsFzYS5hdAN+tsREn2BpyoN/W4WFrJAU5KDbxPxNR3FqOzRKMwPew2y151WBkET78Wthk6yKVhQ4cBSFDkXG3r9cZofvrsj483Em9VuCvEzI0cu6cMOyNKad3Q30psVDLIoiUhFiVXsF8thy0RQHlZ0X7IWmkl2x/GjmbhFGP3lSt0ZfIqNTUBuEe1C+M+5RbZEJqhe4JgKpD/9abBCu0PrnQ/TtAWAAnFnrFrT7dokFCMwmEP98/BAE38ZoCFS28g== 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=0HbIDU9gvROZzz6/UYBDpx1N31Qr4FGP4cShMjeUTgc=; b=tH9NMA72cmOPxLCU/xr5C4XarjTe9y8DGDVxrA9dZ9OGcpfZdGdhOG3PA4z/Yu1q+xTPgwPFSu1DvP61EmgHo4lq7EQVcyUx2fPy8OqsI5iiX0VixxU3Pz/fA+H93LCs5Diyao/2QKR5YIIbugbTezeBsERNPGiyuNyyxkXsEIs= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS7PR10MB5133.namprd10.prod.outlook.com (2603:10b6:5:3a7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12; Tue, 10 Jan 2023 21:28:51 +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; Tue, 10 Jan 2023 21:28:51 +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 v2 8/8] mm/hugetlb: convert demote_free_huge_page to folios Date: Tue, 10 Jan 2023 15:28:21 -0600 Message-Id: <20230110212821.984047-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230110212821.984047-1-sidhartha.kumar@oracle.com> References: <20230110212821.984047-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SN4PR0501CA0109.namprd05.prod.outlook.com (2603:10b6:803:42::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_|DS7PR10MB5133:EE_ X-MS-Office365-Filtering-Correlation-Id: 43935b9b-26fe-447b-7543-08daf351aac8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7mNVaNsS/guQTrxyy2p95G+lLeWq/OkTCtVnsik/T7HgI8wWsIQb9gn8bI1gNgz/xx1KxJ1k6Z/VKiChOcYX5V5FzJcQC5ld5BCsLFUoSQ2chfbxQb5dk3lEX0w/3VYRZ92EtqCSOELTD8g1QX7XlLlgDAUkmCMe62dJTcBXK7tfhgFVDBQ06ndDbZEqaHEnINTQJurvopEsKFnmAONj/GzyJrvUhpHbJZuyDGFnat/uu7fCQZPTXbodq7tdTJAYHX+A1vZYIe1bi2cq92Klllx5YuN3xvUQxHr94viLEZOP2Cc3TkYlqpGGw8Weke8GMNrrb7IZBTookoP37eYaPmfgpHQV9fjTXkeolkoU6RLk8jsKoLRWg0SsJifhuEIVbD2WMeGiAGNsdWcFb3xx0XL/k1ocuD4BGs3wmxy/F3eAQfpQr0e3Nlfj+owEOn5LzsdMfmM+MmwgkaLuZo7kqfGlZDDBwndz9wNJb8eKyLWYnAV8cHDQYwq0vrooKsg4707rjjK0AtDnL5ClFLY8HMmmXopR85158lvpNk2sh515fvr8pnGnG0WX01CY18Gm6yu9p/qXfu0yNDYZMC8Tq58qGpAXsPNg9qk/no9RZQwOSf36E3XC+Uoq2XnHGe/nb1qu8RfX0XaJr+sMLWv++RC/bS8pzpiq4adxJSA7MvFQRoB/s9TD9ZIYpDpXBvbA 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)(39860400002)(376002)(396003)(346002)(136003)(451199015)(38100700002)(316002)(36756003)(5660300002)(2906002)(41300700001)(44832011)(86362001)(8936002)(66556008)(66946007)(4326008)(8676002)(66476007)(83380400001)(6512007)(478600001)(6486002)(1076003)(6506007)(2616005)(107886003)(186003)(6666004)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WfR9fycZJrlV+w33zHd3+UlD8TH81Dgs3hXBqUm59bub4cmph6Gw5A2GMFdnh3dS6ryrT6EpEWcr33n0c3SciMSrkoUHbDWSEQ8bGr452fi643JDjkESoM7COHYRmbQTbgmWed7faiQ4s5X8SwCt9MAwuD8o/XyanZuvuC5wLypAK71Ej+sZLpUK5aXfRub9pV1zZqFkuIXmDryBHU5lfoCC+2InrUN4IhlraSJK0LgKTzuGby4NUlgDC9Z8oUeCCsy1yt9qWAMESQrBi2yt173UwC7xcKk9wC8/DeOjSQcaZ8vsGCdNPYznbV9//Py5Zxvx7uhnVEKzebufONq92lC3sjml1W61FV+UUiNO9ka3ae2pb9vuL31L9Nb41VWlZ05yUnq2rndiw4Ggg6pHhi7lwANRAkItgZGJ4qQs9vfFF+7KerR6uT9UNjIB9J8bRz5auN2M0rumZuEl7zbsMfV0mLIm+aP8z28Cc7KCvx+sNz9Lt5eu/TT6yKcO/lNsacSSAiPBzF0jL5B89c3SLwOwvnHX0yAwQaAZn8b1pdlyjJKR4ujo5qgsW0nKyKsuEQEJMcj5x97Gj2yK7E6XDDMP0E63zj6Su4KtYNraBrZDjn6vxiglPMpV63GUanyKng6WqAgtS6SpWhPa+DzCW6AnQt4peU0emCqW1iqQydNbKQ74PqeJEI3NSh3xsCW5mTy+lecbHLF4Wqnb37eEtf5fqhzbLbJb2h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W02q2zfWX/MWWYrM9QDto9wjmAoVlhcyLnb/gDBHejQMKi2s3+ak8uahNg2G92JtD97YAWn7tYNsZIbzR3fYaZ+WOqh8x4FhqVjtZYma/jZBmHHVVRsGpC7V+a5Pm/PRSJFjNczL+5k8ejJzm7MZ8E8kYgTux7G8WnfZcRdRNYu55UHZfh6PUpYK+2ghUkjny3c+5MCpAMNIhFJWUFCcOvW/SWrSzIhWK+BumlrwXVIROc/tTHARHNKNuqaEalntbmLFts/dU9HpYl2EeAUyj8db/PUUQO5lNnLqrS2+Klm6mxkYMekLfIBSHZXOfp8pgiQqNSCWrSYKrdKGDeSmNvBrG0i0wviC2zmTFJvjDvZtNg2NkYxeC8VlHiJ/C5LAJvQh39ctDcB221fDqGZM0owlIuR1RByAKazFfsnEVZPZSFOMB+5Q49XcWA6/2uNPAq3r2a29kblRg74Z+MNsbbuPDESGHY+GrZ93zTjGDT5LgR3Ewt44QOGvkiDWLn8dY5e1O12xySkTWugiEIYsA+SoU+E7C8/6KoqA8RAV26aSRsNznVDH4P7D/PNHh00UpQgEEoXNUNp0v6KgTikoW2X4x7DLS6aAqHZC6G4el7yjG7wHoqi5k3I90otvqsd6lILhuYdlaeQ8XE2A4Z/eu+TGtKwp9agzSgFIXeeIT0yVYiNVxLhYqcTEdbwuKwfD6v9GijYE7+FUjnUFM+bQbWl+U5icOsKRXGNncSJwQxrov1vuZkR4dCX+jx2GnW/dfSmvq85X6t8YVstjKgE0wZNOdd/rjC/Q4yzX3dvnvnWxEbvIdoT9sEQtq6OtLbemAhKvdFGm8RiXdaVf/EbeRXGgtTk70J X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 43935b9b-26fe-447b-7543-08daf351aac8 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2023 21:28:51.3104 (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: EHwiKpbqr60yiE2+jZSaiTR2yVp9m03k8khCqSolb3D3g48R3EMXVZEZAhEp+05nV78VpqTkd8ZkqJrCjFGY09YZ+HjdYznt+NA/bZFn/AY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR10MB5133 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_09,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100142 X-Proofpoint-GUID: TK6OfMZXmgatTfrpscOYNIbXxvyTBP7w X-Proofpoint-ORIG-GUID: TK6OfMZXmgatTfrpscOYNIbXxvyTBP7w 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?1754672739727210962?= X-GMAIL-MSGID: =?utf-8?q?1754672739727210962?= 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 | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f8cd0c694fe9..21ffab744c8f 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); @@ -3505,6 +3505,7 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) { int nr_nodes, node; struct page *page; + struct folio *folio; lockdep_assert_held(&hugetlb_lock); @@ -3518,8 +3519,8 @@ static int demote_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed) list_for_each_entry(page, &h->hugepage_freelists[node], lru) { if (PageHWPoison(page)) continue; - - return demote_free_huge_page(h, page); + folio = page_folio(page); + return demote_free_hugetlb_folio(h, folio); } }