From patchwork Tue Nov 29 22:50:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059279 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08390C433FE for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 205E76B0071; Tue, 29 Nov 2022 17:51:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1B5AB6B0072; Tue, 29 Nov 2022 17:51:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0579E6B0073; Tue, 29 Nov 2022 17:51:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id EB1086B0071 for ; Tue, 29 Nov 2022 17:51:03 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B6EC5140730 for ; Tue, 29 Nov 2022 22:51:03 +0000 (UTC) X-FDA: 80187976806.03.D8E47A5 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf08.hostedemail.com (Postfix) with ESMTP id 2F4C116000F for ; Tue, 29 Nov 2022 22:51:02 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATMDsOP015137; Tue, 29 Nov 2022 22:50:46 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=tGmuZTBNbre96NHUK8JjH0uovdu0VRYw1Si/RwfIyuI=; b=mq0c2fsLy5cLmwupFkkaJnXjfa9zYMBaPrg9037SbEnDUQm5rgzI2/7j5eNjp/MHBPiz hKih/AB/PB2+3P06ke4/tKubolti4/ej10YLGGc1UxBuye0eLkv1qscxo5ZFmYCoZY/c bqLyyPf7dT/9WxPRU/p8wf1c2giUrVviXdyKDX+1b0mu7M7K9Nbd6DvrpdFV7f7MKODP V7Os2IPnOpkRB8Mp7JrBcJmlWz8Y2DYXrPKsf5ivZ1mp2T5j5d4H2MOp5KHb1JOvDX8M YrUUJ2eZH0ZE4LzrSp8L5w22L8owWxO1orgjkwuxNg0NCcs3ZR4++QTpI86PokU6wySA XQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m4aemepjm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:46 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2ATLF0FH027905; Tue, 29 Nov 2022 22:50:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3m39881gmu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U26riPB8rzpZD/mVj7xcQmCmmSme7gVs69ABJoz1+o4R3aGcIu+MQAWe3AhA0Jhb6BiwoCL+dB++cLpwj63JUes3P5oCh7OR1MHyd+ynco/o3btc85rVbt4PS1ub/qZ3/n3tWKw7i7CG+0XEjsn0WE/zkPJz3s89UVPHxKTvZqUPdWUoxVnH9WRUlsAoi4uSm6KU/stYb48HbsZTx3kBxOXCbSfet8iy6qPKLrSxnQNbkFRWCIE2hGgQPFZToXYBn0PbSaRGQiyVv+pJqN8+HzDCPz32rcyvltKVGeCx9Upg6JS+fArGEOUh4mlMLvJF+ngFof1TjNRrie3G29lzow== 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=tGmuZTBNbre96NHUK8JjH0uovdu0VRYw1Si/RwfIyuI=; b=krEfZmyNKJ4y+YokliQLhMoy4CU8y8x2XxulJtlPdxz8zo3eyCHBJKTqt4aR+EhN4Ox2dD6QhERmODSWCUce3RuGJRcOMBQouCXpaEd+q1mP3BK4N9TcLiY6x/5Zcv0MnKXsmLv6iFc5XmxVdRctrX8UNFn2xA4dw59YIcdMzG3x+qZe2BUwYAR42Zv8Zd5iiUnRazk5slUIlDI0HNKBYxRlglDm45aJhw1lgyyN528WWueOWLEW0ra22w/2PTvpbkzHL4XMEucn9Qwv7pIjv8RgOP2I7NrM0bQ5VHJ9NKH8Rb2b0ZV29YVUiLwX7QSUkWkLl+KSVu0JYJ3FMEFjqg== 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=tGmuZTBNbre96NHUK8JjH0uovdu0VRYw1Si/RwfIyuI=; b=btFQdzpreugE1+lrF25lSUv340mhxEHm9tpb512aC8S0k1OadUrQ5014mIQeTYgcKPW7KqiaE6KMnqbiUuKWLTg1uTZS6eg1TvfV19fYu2+caURdxoXE1lZavY00nvarju9C21O5cN5m/+RdJTk8LCdCGVDgRrq5NeTEzPvlOao= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:44 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:44 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 01/10] mm: add folio dtor and order setter functions Date: Tue, 29 Nov 2022 14:50:30 -0800 Message-Id: <20221129225039.82257-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0397.namprd03.prod.outlook.com (2603:10b6:610:11b::30) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c488c91-f80a-409b-e44f-08dad25c25c0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4tVBZRxKrWWNI02ikFOjc22TlbxwdcGSSV8d+RCfoqU2sMGnUcWiO9ceXTvmzjHZ8AsGevv2FlXUuFkSIpuaP8cvvvEBFdjkzPEy415g65KHjN45v8kOdeSnb0hBWJuRDsjIWoitIyqZSWbYV0hrSVpm94iZu90rh/9i5giSB/EEtQACElPL8gcJJfybjiUCs4htToDQFETRcuyKYPJtVSIqUscfozxjxEzyBOwbpuJHjd6oQF1jt3hhvY84ZB2tackTbXbzZxuaaLbZRxIUE+eRcGcEUwcLqZ5Iuetaa69WeaAzorWOZoFv9ERTgX1UoZQpcT5w3WXP57pwMsjnZWf3LA2Ifl2kBYfQXe64itfmDCqY0K2FNz3oxsicEsdWN5sANGolyCJEskz1OtNwUHiyX197Pk0ZyDhVK94YHzZl0G94M7iUG3aVCwHt0FD7xEV31QLJ+hW5EmZ+V/qkpdq8nSZLxBT8aJ//M36M+GW0lTQgvZMwcqserY8zokKOWFm/pZPFNcH78lQ/MIAgAlcZ38owgT0GcSM+vsj0EbusggBvEzyOun3y80uNuxj0hlQVdPqRQH2rT8wgqif7icKFL1RzMBtADB+9QAIn81T+Z8zQMXBlxkRld8Xw2qig X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8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BL+7fWYE4AkHMNCCNJOOzprDgfJaTHZDQXffIh0W4Rsol8Z19Ouh1TTg7yUgeF5xwoOTxR1YXYwiScJZ/SfKq85/UjJx/1FVGdx88ep4lrsG4NqFRVaxeu2dSOOAo9PfJFsRpk5Cof+0yVo0l/WOpIy9UTTgEW23N8HA8kg1KirAI3UCdkMohAxx2appQxgx9TnopnEv4rSuzvgrF9wikhdd0KKvOj2tvu/wuwnxI8+s8cz3m2nVmflw6Bi2wRfm3KQcHyeoM76T4zoy2BvSvYGCJwSl9ye4FufMGTjBwldv40Ll7n5qUyCYcTCSJNVH2hkRb/7maHIeh2KgM6mxvdN60/ydDnfuNkXE0AiJaR7hjFRVyPwjPJMhtvzN+p+cdLaHPGCje0lfIsaxCjFXLHqGSrIjPhYACPf1+WC2ywW1i9jeksFfATS0EGhE9vTl5sj3/mdoO+PU5wsmDCqlMd2AzvnGp0zs/Ys359p9jWen75+hUfxd/zZFavtblTZRSCEl1I+QpH5ZyAydGh1dEwSO4PBwBOEuIyNgk/yaqHnmGIkltbnpAhwT5LNqWZrnSuytJXAJoEU737I1fIMx3lnvs4i4BuCEBgt0R0ZqxhQEy/E+xrmNVZ4uS+uSVS0YzVqaJ/g0lSFZ7+bRIh0T2kydYh9QODXi7WqWYSkkI5xsiVeziyeRoWJd0v7bb0+RZAR3YpN4tilTEEsarx2nQk8C8c+QWZorDiZCn0gZ+8Ec= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c488c91-f80a-409b-e44f-08dad25c25c0 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:44.0130 (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: ykDOd7EDrmXoFetYWuu43ynh5LPKcPZ9mg+D/axNHBDvQNopxDWiJNjJzsQae4sDhuadQlKnIsnfnYk0tIKQgtE1ElX1RZ/hrfiCIfPUNYA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-ORIG-GUID: VufT3BYM0vTRovhzMkprFtWtqClY2Vd3 X-Proofpoint-GUID: VufT3BYM0vTRovhzMkprFtWtqClY2Vd3 ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762263; a=rsa-sha256; cv=pass; b=FH8iiTDi+IetHiI9/EgCsBHH2n6SedE94JRQEOMy1qQCyf0U8wLKYRh9yq4zl9fJDYmZoS v801W/IMiD0SVBfNt8k38jNKsWhb0vtjk0meWoW4UC7mBAtPFSf0FFsE91/bpRZEOThhCO Z2FyEBXbwVOb8uXsgmVpb56XWwqO6Vk= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=mq0c2fsL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=btFQdzpr; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762263; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=tGmuZTBNbre96NHUK8JjH0uovdu0VRYw1Si/RwfIyuI=; b=6yGuwaI26SX40Uzdpqi2D6aMdGPZMDPRY3cMdpfxQnephYyXFL477mUFKp1rWpOpp1nvk9 /A2Y7fF6bRveuqXifz2e19QkGnc4pKT7LAWFI3NnrtT7m8FY1JWbvWhd5/4bsggX2/qJi5 Y81TliKu4DMBN1gOm3zIIBPAFIsAN78= X-Rspamd-Queue-Id: 2F4C116000F X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=mq0c2fsL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=btFQdzpr; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspamd-Server: rspam09 X-Stat-Signature: nj3ybnsxytjgeep3wbuobz3x9ufj6z7c X-HE-Tag: 1669762262-562574 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Add folio equivalents for set_compound_order() and set_compound_page_dtor(). Also remove extra new-lines introduced by mm/hugetlb: convert move_hugetlb_state() to folios and mm/hugetlb_cgroup: convert hugetlb_cgroup_uncharge_page() to folios. Suggested-by: Mike Kravetz Suggested-by: Muchun Song Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/mm.h | 16 ++++++++++++++++ mm/hugetlb.c | 4 +--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index a48c5ad16a5e..2bdef8a5298a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -972,6 +972,13 @@ static inline void set_compound_page_dtor(struct page *page, page[1].compound_dtor = compound_dtor; } +static inline void folio_set_compound_dtor(struct folio *folio, + enum compound_dtor_id compound_dtor) +{ + VM_BUG_ON_FOLIO(compound_dtor >= NR_COMPOUND_DTORS, folio); + folio->_folio_dtor = compound_dtor; +} + void destroy_large_folio(struct folio *folio); static inline int head_compound_pincount(struct page *head) @@ -987,6 +994,15 @@ static inline void set_compound_order(struct page *page, unsigned int order) #endif } +static inline void folio_set_compound_order(struct folio *folio, + unsigned int order) +{ + folio->_folio_order = order; +#ifdef CONFIG_64BIT + folio->_folio_nr_pages = order ? 1U << order : 0; +#endif +} + /* Returns the number of pages in this potentially compound page. */ static inline unsigned long compound_nr(struct page *page) { diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4c2fe7fec475..6390de8975c5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1780,7 +1780,7 @@ static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) { hugetlb_vmemmap_optimize(h, &folio->page); INIT_LIST_HEAD(&folio->lru); - folio->_folio_dtor = HUGETLB_PAGE_DTOR; + folio_set_compound_dtor(folio, HUGETLB_PAGE_DTOR); hugetlb_set_folio_subpool(folio, NULL); set_hugetlb_cgroup(folio, NULL); set_hugetlb_cgroup_rsvd(folio, NULL); @@ -2938,7 +2938,6 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, * a reservation exists for the allocation. */ page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg); - if (!page) { spin_unlock_irq(&hugetlb_lock); page = alloc_buddy_huge_page_with_mpol(h, vma, addr); @@ -7351,7 +7350,6 @@ void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int re int old_nid = folio_nid(old_folio); int new_nid = folio_nid(new_folio); - folio_set_hugetlb_temporary(old_folio); folio_clear_hugetlb_temporary(new_folio); From patchwork Tue Nov 29 22:50:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059278 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA1AC4321E for ; Tue, 29 Nov 2022 22:51:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 413746B0075; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C4376B0074; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1DE236B0074; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 0DD296B0072 for ; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id D0CFDC0262 for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) X-FDA: 80187976848.22.698DC59 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf30.hostedemail.com (Postfix) with ESMTP id 64FFA8000E for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATMDZ9W028263; Tue, 29 Nov 2022 22:50:49 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=RHKiiVc28hJsMCo6RKUzQfHyZDcgMk6bAgu3H8/3i84=; b=r9w3dbG7TSR6TN2fb/vclzw35RakdaIy4611qheWx9441QKyjPMeaPrR/LeQM+oMkLoT G4r58/W5ps/K0U+fguXW8DelfdHxwJ78Uv8X/unLBGLdmPoxQWK/SV8iFIPwz54rYhjh PpLa0JM7lVi80OXQWCe4eWqwnSHX2MPxZ1+ThA1/zmWfUxSBoqyK5QgssHqkCRfgcd70 26SnJavydXt6gb+tkc0jMGhAOmm/xh0sfDAjQHB53qrjNk6PK44XP/QUbyqAhi7M7Fyw T/jOXCzfDLNmbBpUiJHwG6eZh8xiIUK/WZ49flDMG9vg8BApgGmZ/09lYLtUBTXmTK41 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 3m39k2rh7x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:48 +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 2ATLsMgu026761; Tue, 29 Nov 2022 22:50:48 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m3c1w6781-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:48 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F8unrmBFWsO7tmLUWe6b4AoRtv8rnUOfYFnZeUM7MhPRS0MadDp130GZ8ZzdByqBDeGeprX17gbXTYCdRV1Hinn4Mh3jICNInxSbzDWyNbltss1QDe5VO1PxSpkyXgvlcT465kPbt9L+bgnn0Oa9L+R1KJbZqAFKAg/+sHuWdW2FUP+/EdAfYPaLllbqGSHtYA6FQ7oj7lYo2SEgjcuYJgUV8kRJLDpX3BiympAQxXLnvue/7HDO0gKtdXoCT4J6Qfb7Npy7LOUdV3Fkx38R2uczIlCogGjV1BvLjprLuSrWQhFlK63TeiYRegnlLxCcjlqMq/ERKuRITmUADTAbtQ== 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=RHKiiVc28hJsMCo6RKUzQfHyZDcgMk6bAgu3H8/3i84=; b=eknpWuFzjTFYdCk+wJBcsKdzM4BOLtoveu5JMCwqDjtj1wsM184VZo73SPn6Tce+2kHDRlSyev7N10C9lB8igKIso9lynxBygpjzCZqhvew3Idw1fRzed8IGDMPnGLYh3IDEatcUnU46hp+iVCauZ19L+BRlAiRURV0342mCFBUsQMcMaAovyOcFEu5KqZolGohGCEKnd0X7WAtJwW1uo73mEBIYWWwaQF4GFZi63fcvusXIdiFpWnIhS8ZhFxF7v0iZ2KQpcBfn7POqEWiI/8ZH755XR5cFBzXeeSCQ4w6bchsu3RS2C7To80sUzONpgSJqPhaBdEKdbDJmyaorBg== 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=RHKiiVc28hJsMCo6RKUzQfHyZDcgMk6bAgu3H8/3i84=; b=OohiyS2oUOOC5NoC8LxmlyASspANHmnoiDbJOXfyCwUzSzh1HM2XpBuKdNSuPAOnR9wIuH6D4plxqVyqgY9R/zlroLKKTXk+qWrTeaLiOTV94Og6JLlcDJGmIDAtX4Pm/sLXOFnJmLssKO2UMWtdQ84trEEqHrXRjNA6XcpjS6U= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:45 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50: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, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 02/10] mm/hugetlb: convert destroy_compound_gigantic_page() to folios Date: Tue, 29 Nov 2022 14:50:31 -0800 Message-Id: <20221129225039.82257-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR11CA0027.namprd11.prod.outlook.com (2603:10b6:610:54::37) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: dc35281e-6164-4698-3f7b-08dad25c2682 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wOIcUtWIJX3MsRm8fNEE6PdjTj6JLOMkZffp2k9N0DHxVdhQtgZ7aaLRtX/qY2W41CTO9DOidzkAb/FQSa237mBAVA1leKkXfn4ca6Ex3OFij4XpU8Oeu6UgOlrZX5qPP/b8W5eCYSvnOqnCd2pL/ADq7J/BtVUDeJ/snfW88ptjoWS5PtV2OJyKjnNKpf5wFj36NllfnutXvIWr/7moEU3/HwmGbGY6wmQV+K5EwXts7keWikc/A0qJ7WaDglEaDxHB8i4SgDYqOW45LRwv/hqxR6l7f7bhGyBkQIrBjpVmvFuZJu7R6j8CZpLwdwqPB9/56vm5pDEjuVnDBSELLSUPvNty+ln9OBCYAbjfvXKZ+Az4MutiBXAwMMAX027G4YzQ3fQVo3Ckf0wrQ7zD2WlcY4ZkAtFxXmeh/vFtYp14MpBrJkidAE1Dpep/R4KNQWx+03WK6oI6SNoDbzwlwoRvZcoZMZvChjEGsKlYA4D3efDSe9hGNFtiSZ0RSMB2L2en4A3k+ILKDO7lCZfTR67TplfXlnm3Uv7Xj1Dok14P2ZepXN+XV7ZdOAPtbraT2HpH6sDwIDuxtWkeei2gknZLtnlYaTnOTiAm/d4flEIK7ihEHAjIRJqjDXbSrcmd X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3ek11STNTtbVMFqmcR/u5D8IaLcFZHYMt8cyrUfi7crct5GKPtqh6DT8cD9DHIqZgr8GI3s4TgAjWj+QPybra60J4YhQxhF2heE/gLV6HWg7XgMbw1TQFy8zQFYLG6RqBp/wnG9X9YZ9lGtEr5ubTKrHVzIlMVX09jyFT/ClFZB7kFQ7hcZ1rBDZY3TvBGXet3iGA8ZQI5MtwMRHiRKCdn6de0qMTHdSgU/NNyqxz8MfJ7FooSsT341atIb66UfpectN+xwxhaAtaoJQ8p9BtmpP9Wu5KGcq2HD+jR4u+46eyOPZdZ3zNAGQTEGDpEa2nf3RhET5zY231huiICFYZwPG55YWs0daVTwRdcg5Y56vpTgdgl9ffgDOVAF+YvY0CzCvODEJ/35qfDwj4K41qXAkNWOafNV/G6NSokMzSqjGFptISoMWSxgjufBlfZw0dBQujQcIT+wAkfjFWyQBoeSYPUrQZAKaheiQQYEKM9o/d0rtF27UKoLO86UwPtNN3EEi1/LB6xYwCfsfM6MsXNmPVF/i2JY34lrre0ZGw7J1UDRYEp5NqOSsXGDNb3qZZY6sg+JV1eaGBoNeaTwC3ttqkw0u+/rfu4FVPRZ0Bwoq8pPO5V/AxV4uF5EYiZcDDvrReOuKel44Z8MJoXL1SEg2vjrDNiQU8Be7nH7u23EYAIzEbNtu4GG0/ITB/FQlLFCR7IZjZKB6AnKZdSDakNpVowdI2DD1zrlJhhvyFe82I3J9FK1CplEOpC54xN+oHenf3IajPGkybObFbwCp8XK0jnMiOUEB3ddOfzIY+roDmd/V49eTZmIxdP37kffr4IBzcSsSxsOKffu0Vbz0JfXHR1bjAkKKCD6SLHGZi62YUWYD0s8ZVR1ONuxtfXrzuaGFn6bWvfBz7kqq/R/ssJKkQL4zC8tru1uidJKLPYhzkcDbS3N4uvbtK7TkHC1BEK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kc59RScgvre9bY/iQQ/TvUIPSUHtyX1rYxvO4us5jkbJm5hoami1b8ScL9Y+COQvhcs9rKqSvj+pFTIdPRrnhiDIVhwm8eRl971+t8CmtQrgc8PNJbUcDsKernBgCbTF9R/P3YnF8mEZnvhsoc3ID6vHVt+lznWqRf/akbGyqQFF79WmYTNNRjj8KdQf1SHRf4AeMzpoGVOVI16JmNwiB4og1Hx0RkSEoOGzNTnOaNJjAKuKfq1BUS2CIt7MypKmK3dCA3GE4lJAxZVbumj3LrZLTJEuWeNJxloRl0zvVuX7Jjqhg/FIo1yqAozhyhK5pn8EIMGHCMjUyLDq9nAtKsiQXdkoSaNA+2zEPCGUoXFgKhiQu4zoe/aYoc2FMoqL5GR5yfpdIRykg/i5U5DrXzdsrkHgBV/JW5N4uUM8ooEzoGk69ybKH6/hOR1OxSEi32yctA0t3WhLOTVcViunFhBuaTHf2YPgEtbfQoWg6wAOnO2BJQtPSSvB7wROtyWWBrvbQ+PJDTOnhQi0jFOLT5gP+yerbj/oO8Bfeq/FIZ+iPdfQivCNKoYwj8+bLb5mrWuroiXEPuUccow2fjlVtmrMtsBGZkmq8HhkrlHIuEbGaIHgqAU/VrdrjONKwo0f1y+cUnYc5pXqOg9HvO2BJsiiSgejG56lidofIXMLlKg4EC1lBnTo6Bln+4fWWn4de16gVMr7B8XBA3kbS/JsRA7wghh81JYLJsYJF3tJVQZKSZLcVll1mwVa1SNNg0rqxaqso1LWCHCmUhW6r5q9+6nWvL1s= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc35281e-6164-4698-3f7b-08dad25c2682 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:45.3887 (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: XncKkNa/2ATXoXYBUnGmRKfgZhbTNGW75JoxAGfeRe0f2epD+0saNwSyURySTUFPnluKlGZRSKkU5pHZtIanGbyt7kGzkpxjrCB0LWn04FE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: 1eo6L1hS93cB-ftH5VCKollboVXuz5gg X-Proofpoint-ORIG-GUID: 1eo6L1hS93cB-ftH5VCKollboVXuz5gg ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762264; a=rsa-sha256; cv=pass; b=xU7yvDl8lJqiEnLU5bRmeoB4PSHWUYvGZgr4SGrUnvztSaG/KG0bGTZjSJUGQvRc0IkHdH AUXJb7p0CTJ3t5J7wguWWcqF9qvczV5iAbC3mj/anvrR36ytwMVSzb2liUJ0k7Kuoh2tYu bgFtX7RFCtWyvpV25tPD8Wce+G0eR3c= ARC-Authentication-Results: i=2; imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=r9w3dbG7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OohiyS2o; spf=pass (imf30.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762264; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=RHKiiVc28hJsMCo6RKUzQfHyZDcgMk6bAgu3H8/3i84=; b=PubAj2DPJrnm6Y0maczf4rH8f0K99v61mad2PHsAs5sAkd8gwejf7fwAAJSSd1EOCjazO1 0lTOb3VyzhfVJhVTZVJAfqnS+UpfLUUIEka/Re9xeoQVHdx4teXBrtOTbGBpDvjAW/+nyU oaWPV/i4MS3N6FJofNeCiZ0bELG+x5A= X-Stat-Signature: 3xji7y8idperi989ymrq8ducfkq3eddr X-Rspamd-Queue-Id: 64FFA8000E X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=r9w3dbG7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OohiyS2o; spf=pass (imf30.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam05 X-HE-Tag: 1669762264-583736 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert page operations within __destroy_compound_gigantic_page() to the corresponding folio operations. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 6390de8975c5..f6f791675c38 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1325,43 +1325,40 @@ static int hstate_next_node_to_free(struct hstate *h, nodemask_t *nodes_allowed) nr_nodes--) /* used to demote non-gigantic_huge pages as well */ -static void __destroy_compound_gigantic_page(struct page *page, +static void __destroy_compound_gigantic_folio(struct folio *folio, unsigned int order, bool demote) { int i; int nr_pages = 1 << order; struct page *p; - atomic_set(compound_mapcount_ptr(page), 0); - atomic_set(subpages_mapcount_ptr(page), 0); - atomic_set(compound_pincount_ptr(page), 0); + atomic_set(folio_mapcount_ptr(folio), 0); + atomic_set(folio_subpages_mapcount_ptr(folio), 0); + atomic_set(folio_pincount_ptr(folio), 0); for (i = 1; i < nr_pages; i++) { - p = nth_page(page, i); + p = folio_page(folio, i); p->mapping = NULL; clear_compound_head(p); if (!demote) set_page_refcounted(p); } - set_compound_order(page, 0); -#ifdef CONFIG_64BIT - page[1].compound_nr = 0; -#endif - __ClearPageHead(page); + folio_set_compound_order(folio, 0); + __folio_clear_head(folio); } -static void destroy_compound_hugetlb_page_for_demote(struct page *page, +static void destroy_compound_hugetlb_folio_for_demote(struct folio *folio, unsigned int order) { - __destroy_compound_gigantic_page(page, order, true); + __destroy_compound_gigantic_folio(folio, order, true); } #ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE -static void destroy_compound_gigantic_page(struct page *page, +static void destroy_compound_gigantic_folio(struct folio *folio, unsigned int order) { - __destroy_compound_gigantic_page(page, order, false); + __destroy_compound_gigantic_folio(folio, order, false); } static void free_gigantic_page(struct page *page, unsigned int order) @@ -1430,7 +1427,7 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, return NULL; } static inline void free_gigantic_page(struct page *page, unsigned int order) { } -static inline void destroy_compound_gigantic_page(struct page *page, +static inline void destroy_compound_gigantic_folio(struct folio *folio, unsigned int order) { } #endif @@ -1477,8 +1474,8 @@ static void __remove_hugetlb_page(struct hstate *h, struct page *page, * * For gigantic pages set the destructor to the null dtor. This * destructor will never be called. Before freeing the gigantic - * page destroy_compound_gigantic_page will turn the compound page - * into a simple group of pages. After this the destructor does not + * page destroy_compound_gigantic_folio will turn the folio into a + * simple group of pages. After this the destructor does not * apply. * * This handles the case where more than one ref is held when and @@ -1559,6 +1556,7 @@ static void add_hugetlb_page(struct hstate *h, struct page *page, static void __update_and_free_page(struct hstate *h, struct page *page) { int i; + struct folio *folio = page_folio(page); struct page *subpage; if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) @@ -1587,8 +1585,8 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * Move PageHWPoison flag from head page to the raw error pages, * which makes any healthy subpages reusable. */ - if (unlikely(PageHWPoison(page))) - hugetlb_clear_page_hwpoison(page); + if (unlikely(folio_test_hwpoison(folio))) + hugetlb_clear_page_hwpoison(&folio->page); for (i = 0; i < pages_per_huge_page(h); i++) { subpage = nth_page(page, i); @@ -1604,7 +1602,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) */ if (hstate_is_gigantic(h) || hugetlb_cma_page(page, huge_page_order(h))) { - destroy_compound_gigantic_page(page, huge_page_order(h)); + destroy_compound_gigantic_folio(folio, huge_page_order(h)); free_gigantic_page(page, huge_page_order(h)); } else { __free_pages(page, huge_page_order(h)); @@ -3437,6 +3435,7 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) { int i, nid = page_to_nid(page); struct hstate *target_hstate; + struct folio *folio = page_folio(page); struct page *subpage; int rc = 0; @@ -3455,10 +3454,10 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) } /* - * Use destroy_compound_hugetlb_page_for_demote for all huge page + * Use destroy_compound_hugetlb_folio_for_demote for all huge page * sizes as it will not ref count pages. */ - destroy_compound_hugetlb_page_for_demote(page, huge_page_order(h)); + destroy_compound_hugetlb_folio_for_demote(folio, huge_page_order(h)); /* * Taking target hstate mutex synchronizes with set_max_huge_pages. From patchwork Tue Nov 29 22:50:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059281 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 128C8C433FE for ; Tue, 29 Nov 2022 22:51:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B587A8E0002; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AB87C6B007D; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D1F66B0072; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 512F16B0073 for ; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1E4901C68F0 for ; Tue, 29 Nov 2022 22:51:05 +0000 (UTC) X-FDA: 80187976890.23.3693F2B Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf03.hostedemail.com (Postfix) with ESMTP id 614662000D for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) 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 2ATMDtFM003623; Tue, 29 Nov 2022 22:50:50 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=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=MEzXMj+e2rAJwiq41FwXHk/3oOGxSQqXGozWRenMSmvN2nSMI9Bf5988AVZ10dEoQqvd va7IInA5xi6+NK/DUfbVD4IqBeAv94hdin05AC9URt5V2AjmZhbuaPoqytRPLgwBDOTA R6LpKly7Jct61Nikvqtw6fnZMlD2mm3q35YPeXKyej0g2gOjfBvyHHro6CN/F5XYBHM+ EU3QPXscRRnW5e+hLcv9TmYuVFGVyTPaZ67l4ikACRcXNun0nYUPEykFJ3TFZ2IiSTb/ PsKddk/N10N/3Fxyw8VLva5O1ut0iidCf4KidGiZxUrik30nlca+9B69erZs0eMLegsG JQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m40y3yddk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:50 +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 2ATLsMgw026761; Tue, 29 Nov 2022 22:50:49 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m3c1w6781-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cP/SeJ5uo5D6E9ZvfdzS6acOrQkOLBfyDHLssIFtNPPH/c0Vfcoe+wj/XYZjbRWqHRjmwVga35x004lYXmvZxT5UBlV3dyA3wMSAnKzY7SV83eRX/sMODpnfR3CV5WZJ3g/BIFYIzusGN8CNdJxcUvvax946IvfLEiz8EfYtlPaSgP0D+CyWmaaIpdDhz4FANnqh1bxz86THZ5bt86Luh/C66lI7BIZgBGX0OwWu7n1nqEbByFBvnwxcBgWCCJd672NPZsTk1Nx4qBwWG7bOjn+20SNeqfsfG7tkQD3kNNmNp2XyVESQPg57REno/J/uVKzYiwrXXOMMhX1h4Dj+yg== 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=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=oJX2gp+6Z2XrrzqyQzpX9JP0faIhCWo0K1iUOBLAkK5qpptyrHST1rA9zXbV1FnG4NN/829wNvGYIBCEpIJPMx0N7hcEhuEg1fjAHl35iMFS2RquUlHgnCXRI1DbSZo8rnxL0tYJbisMBQjYIH9CDAdrd6MQ8aP11F+sqDYTueJ3ojZHrk5u7C+uYtqCZE89b72DL5i7N6FQVgaBuuRyV/c1R+8H2Dgwdjq8ZS44o2LQZG2ege7b6ER9TzSXTMMzf7xWyOxIFaupk9Gc5pfmdCZGvnp3nSh799++iUZHMMpCAqAw88ZN2X2Cg0EIrtzNCROe/CtXkpKhLmncZ+w/OA== 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=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=JSMSZ/+FW1M4X1VHktpKk96qLwm97+9EorCe+baCvrDvTHoAMwQTJT721V08GLA9JbXYhfQE8I3tgUkq6wZtDP46lHyfc9mSLtm3iu0JCROK+hcILNuk0DyqWvA1IUP1/F9WxeECXVvLZtSZpqtjZxZJ+BkB5Ozw1JedOA6hEe8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:47 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:47 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 03/10] mm/hugetlb: convert dissolve_free_huge_page() to folios Date: Tue, 29 Nov 2022 14:50:32 -0800 Message-Id: <20221129225039.82257-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR03CA0415.namprd03.prod.outlook.com (2603:10b6:610:11b::26) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 6cf304ed-02ae-45e8-bcdc-08dad25c27a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AObkcQOxBh/yPRut/BZvZPBsV99NP9vvz6bBWZPh2AsdsweHHtjLgf/rLJKkcTtDeeaZitgO8f3ZPXPD637oBtzuUPLXrUlb1TdEdzd29OZQT9Nqr6x7qMzvOHQfqQYGDztYUJUOh4kNkysRN4aj5z/G6AN44hEaIXv7RUTxjf5dugb822prpnPhYXxiCa/MlJFhHfVJZ1RbYrrbQxWastzb7XMyFcxCWTL+hauZDUOOKd3/bZ9OiX/OHPd4JT2EsVrOXZqulILbvtkTF7st6ndstmuHSB/UXIb1LqkSRMietOhegq/p7s0stmug0kuIYeOJKJPO4tjkhuWwUB+qrUbpbr6Upw6jG8nNbL7mqLqi0/Q6YehMbxCVuwlLZjwvYFDZ3F6o62N8R/n1QUvXvPDoLqANYdj0tq9udc+sREZCuZaF6FAMOink6L8dm2XZqKEvd+E/Xp03U8FQTmHVWSNIzEs9pqMbqVF0lYQCYdsn8hswRYMTgR5YUiz71nyshlYvfwPqe3I6Zdo7NqeuGOYR/2egTiEj+cgPEVfudjGAca/sqlIGsIVwsjk9oyyzswUJYKe6GzBIo7UQ1KcIwKjCcjQYeO07JI8xvvIhaBE5k5rgqDYfKKb/XxLp5E3s2l8fXXMELfkrEbYzMVIbL+7UCPTD9jrQY8a/cs+ESj+o2/82NaXY8IvlpxGv35D4 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002)(14583001);DIR:OUT;SFP:1101; X-MS-Ex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XOfDwYuMa3bbUFk5rqhXKeDJ0ipe3F7BjHP+WTaBFOfBpvsu/mnFZn7d26YHdsJ+Y5Ws62lQaLY9NMyWn+RF27kLWXzNLx/YDwU4iurWnrCCKjhS5XD4lCUMDKLNdmHiOqQ4+tVGnLf4oM1BmOQiE1MekG4B8ULL/j26niR2hUy0jILUxmeltiXBP+6A18A8Drgmh0nOed95qm/a3KqrK9ffgGT1t+tLufTi1ustE4sVquq5weAe7pxTkEl6lGamM9Kgt4bMHKjIxHVao0LryFy/mBwYgFrWe16lCI9UYbp8ABDkDEPfT7g1WHFxzxqA7NH0Se9Uoauj9r2bT4a5D2qGzDGNsHWUM7sCt5NLRRmqqyUtSIzEpIzKb/wNDMSkyxfI1Gb8HeaF3O7g4SGslyZ1Btm1GbwsmuZvYRjcLBg1sbJmQO2l50w2S2I31W6WbYg7OXdxzp72axS/hjvirG7OZHp4qlGZfkHGEP8k0aotAeSC99vHeEnxCg0rXFQYmdlVzGRoZ9SMHl03L5nDw+PmmJuNjshx0YxLqOq0oesXV/bQ4cu1y1U0WUvZU5w+//R1SQLJtzUNUv0yXX7AGrcuzdvpwrf+l/qEGgbNgTo96lsSWevypHhwffsnL7bPUbyvwJWN2Z8mg8W2zXMz0hkA1K1ZhD01Du6sDFbDy6LwEk+C9L+UABXJYaWR8apNV7YwnAmGYt5AdhgWeQHsUkDIpJFfyTJvjENCU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6cf304ed-02ae-45e8-bcdc-08dad25c27a2 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:47.1709 (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: c5Z3Cgo6oQSmF2bdmQ1SBCtVIDKuWixSUKKf4Qs/k7dY0UR9Jlyk7axBuAJyIq52apsKeP54I/cCw2wndLB2M6A8d5gXwmhkkrvmTLnJw7w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: sUO7fuynA6dTTnH-9Ia3zAJch81AtlSr X-Proofpoint-ORIG-GUID: sUO7fuynA6dTTnH-9Ia3zAJch81AtlSr ARC-Authentication-Results: i=2; imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=MEzXMj+e; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="JSMSZ/+F"; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762264; a=rsa-sha256; cv=pass; b=1dRY+7vNqsudqIo596ywa90DWRzKZHNXyygAMS2QP0317InvZiinBEMoQ36h5swP7Prd2h UCri4/cIIUGzMf39k7RcIc8MlkP8bIH0zDEEsfSN01Td2BoR4LipCicklGwfbel2ML9hL+ utmeuU4HjalTtoh/IbRn+KPcAaMVL90= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762264; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=41NsoJ4o2oqWcaqkV/bF829aaUMi6RclrIsMH9Q0ko8=; b=pp4GMioMftLUYbvIrZ4CaTn1Y5wgoLUI0YUjtJdYdv5N1/1GNYMY6RO7xygyNeBH7jFpFH FF5jWXtTIUSzUnUyiyrKaPVxFhUjcv4nnkrA23LHe0qtExSNqsCCpRi5D1PwBYbXDdsUE/ cbnH7HVb67x+VPuA0Y58++hQsCQhPVs= X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 614662000D Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=MEzXMj+e; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="JSMSZ/+F"; spf=pass (imf03.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: i8jndzpxneq7forfies1enquyjnfzgtd X-HE-Tag: 1669762264-834506 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Removes compound_head() call by using a folio rather than a head page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f6f791675c38..d0acabbf3025 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2128,21 +2128,21 @@ static struct page *remove_pool_huge_page(struct hstate *h, int dissolve_free_huge_page(struct page *page) { int rc = -EBUSY; + struct folio *folio = page_folio(page); retry: /* Not to disrupt normal path by vainly holding hugetlb_lock */ - if (!PageHuge(page)) + if (!folio_test_hugetlb(folio)) return 0; spin_lock_irq(&hugetlb_lock); - if (!PageHuge(page)) { + if (!folio_test_hugetlb(folio)) { rc = 0; goto out; } - if (!page_count(page)) { - struct page *head = compound_head(page); - struct hstate *h = page_hstate(head); + if (!folio_ref_count(folio)) { + struct hstate *h = folio_hstate(folio); if (!available_huge_pages(h)) goto out; @@ -2150,7 +2150,7 @@ int dissolve_free_huge_page(struct page *page) * We should make sure that the page is already on the free list * when it is dissolved. */ - if (unlikely(!HPageFreed(head))) { + if (unlikely(!folio_test_hugetlb_freed(folio))) { spin_unlock_irq(&hugetlb_lock); cond_resched(); @@ -2165,7 +2165,7 @@ int dissolve_free_huge_page(struct page *page) goto retry; } - remove_hugetlb_page(h, head, false); + remove_hugetlb_page(h, &folio->page, false); h->max_huge_pages--; spin_unlock_irq(&hugetlb_lock); @@ -2177,12 +2177,12 @@ int dissolve_free_huge_page(struct page *page) * Attempt to allocate vmemmmap here so that we can take * appropriate action on failure. */ - rc = hugetlb_vmemmap_restore(h, head); + rc = hugetlb_vmemmap_restore(h, &folio->page); if (!rc) { - update_and_free_page(h, head, false); + update_and_free_page(h, &folio->page, false); } else { spin_lock_irq(&hugetlb_lock); - add_hugetlb_page(h, head, false); + add_hugetlb_page(h, &folio->page, false); h->max_huge_pages++; spin_unlock_irq(&hugetlb_lock); } From patchwork Tue Nov 29 22:50:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059284 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E742C4321E for ; Tue, 29 Nov 2022 22:51:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90B556B0073; Tue, 29 Nov 2022 17:51:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8962B6B007D; Tue, 29 Nov 2022 17:51:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C4306B007B; Tue, 29 Nov 2022 17:51:07 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 341116B0073 for ; Tue, 29 Nov 2022 17:51:07 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0720C1C6899 for ; Tue, 29 Nov 2022 22:51:07 +0000 (UTC) X-FDA: 80187976974.02.CC33327 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 6AEEE40015 for ; Tue, 29 Nov 2022 22:51:06 +0000 (UTC) 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 2ATMDsRB003558; Tue, 29 Nov 2022 22:50:52 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=b3PQObH1nF66pRxTQNIQTkBEH8mytBqt2q8Yl3YFS+0=; b=Nin72qJYi6Zk9IHrWlVZXZs8hKIcY7DM8sVvtdIq7tclso4UZYzEaslguWgt98S5hMu3 QchTKhzj9RWkOidkKahkXgg3Acp9nqSRDh70TpB/ButHR+FsfjgCygXy7LWrVuD+d7mY UuMa62GeMMVeDLEebG8/Dmf5dRKpwC3W7XGBIN4IjEAFvywdAa/l6xdf5V+SOGK1IdoA zErOdnYTSz0whM3m8LtWKquK0J6Aefb+9BizttmSg8AaH2t2+2J19YrJGQbStY0IZE/K tDvr514V2xZWinAxxS3Z3XdwW619vXsJet9Wm+fJhhiYnfVJMvvHjhwJ4fZGYJMokqnP yQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m40y3yddn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:51 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2ATMJiCC011526; Tue, 29 Nov 2022 22:50:50 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2168.outbound.protection.outlook.com [104.47.57.168]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m398ebb3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jUKSxc4qdn8/OL/zAbOAJxIEUyqx4YIc8pdOQmbGMXGeu9uUbNjV6LI66PR/I5egfxxVJs7XSMfSPc7oZTVbf+6rO/DmGvzrzoTJPi/NviQbtAKa6pPefxRi3kHFPFQqXy5mpFRpwjDmBJuk5fSf1qWHAuosm2UGEaoCZ5lWZQrNMobpLMnCpTgET1kSPVnpFhCafxgnHQmfRwN5CpyIPxtIQeoQzUo1Od1fk7MqVTRTkEYs0U2drcIzVjkWfbcioLD2PdU5qOd2yRT8b3dXr6BkXzZl6mMxq54YHEyKECAukiwEV1LgOiFwx9OAbGzKAaKDRshAniU4B3tiROqPcw== 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=b3PQObH1nF66pRxTQNIQTkBEH8mytBqt2q8Yl3YFS+0=; b=ey+mGLqXHEtcDf8ezyDnibsL+D9I45bAvNgOuOwK+i1FV5loHBfcp98BSDl0eHjVyTHwwbIXPewPlhltaWIAsvXTNYCA8jiM22BTvUrgsCYj6AdhfdPFrnFsi6/PmBGRBrjA5MUBqDiMB97Ewf6q5PBvl95Tzs601K/BxcT76Y9z5pI47MtqjMbvzjGiFpC9JJFHgpwelcpf/vVSIxNjjHaEMH4W7JKXbFKwhE0BPbAX09KdofQcBk58lCnGrsl9uQzxglbuPFYX1/KYyH2mMCLqUTCiNmCe7L2WsWDicmdUeoR+gQLqMlPhRrJLAv++FXSqvgkq2hTGINdfJT10Hg== 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=b3PQObH1nF66pRxTQNIQTkBEH8mytBqt2q8Yl3YFS+0=; b=CQZivqSlQkhq7RBWt46iNvbkmqem9N8bHNgRJ5dd89nCLmolLLvn01kq1EwprPV3xbDMuA9MXfNVJNNGESP6G7Mv8+eV2KPQpZ0JgAF7tn2hclGBNPq4nX1YPWEWPfITD9quXTWV2e8jFtKdmYI3mydvZPjgnepqIRf5rw0l/xw= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:48 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50: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, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 04/10] mm/hugetlb: convert remove_hugetlb_page() to folios Date: Tue, 29 Nov 2022 14:50:33 -0800 Message-Id: <20221129225039.82257-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR11CA0003.namprd11.prod.outlook.com (2603:10b6:610:54::13) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 847f9a5b-08d0-4de4-cd6f-08dad25c2868 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: na2VxpQ2zzAMPMeVaVbT30tbkHMqjyZkyvDOg4FzZ8Xqnwm2CSfasiRCeLgqF+w5VsW6rAlPZmsLVBLUMjHFe2FCM1k6rLiQuQ0zGh6INriinLLnQM05SEWPLPsAmN0LCrZBq8DgwgnVOKUPX5GOuI8oOxRMvP7f+b2Y4DexNbSzVpxpppejdpi743GEM8+hXkNLGTSAj2mCY2p+LCaSC1ttfcNWm0xdNkof4v1EkI2l1+DXVKZr0A2sxmJm3EGcaQZ9c5wuPB+COMP1cQXUQB68Sj+vQlAfO9Aw5Rv0JkkoUoDh/lcbbbtEsrZwpuJokj+0hk3q3emPOs8mXqMWXbgJo5pp/uww+Fs2QqlZq/QF5ILoJJPy4A123QH8WNgyisWmRdYqvGfUdVrMaAPQ2IqrwjpsJaxLAPMI7wi74oDR0ViKI9fP8SRibssgVbwSH5o1kSEGhRiS61c0GJdTKCVY7CF6g4QNYq3NObesbn92Jrrqx12OKHAnBrY2pYBbxDJ05YMsn0aNJb3VDzwSFLi2/S+DciNeliVLP1ER83pkhEM61VBkYtIyJuyFSNA7lL9U1qlI4G1P8qLvL36V4AsvssQiwavssk5v4VdBTxAlnZvDuMK8p43Xt/MODVuUOAz367k5942tNr+rv3vhIA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KOFypu8SK4Ua8Hp9MGiUqhr9cbBV0N/ulDZQwH3OLUuwWg+bSQDgGBpmbqf+OThA420pZw9OAyj98JsclY3VEPL+6DHlfsLcdjY45hN+3g4kiOTOSk6saLkMyyOH0eVwuBUM1SyH6vNtXxos9YP+Uc5AsRMIyVpxjOpk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5RLNrkfUZDLvRorm0qUgfFI46jk8htMdCKS7//UmCr6BphtwpJ9HHjidSiRh/Y1Ld6oJ6PpenGX6R2b56ZV0vBefyBx7jCp4Di5jiadsWpY8mAjqj8/auDynx5+OZS/Ct1m7+nLidih5+SltAzOcZrpckCn7rZ1mseBF7Yml+/fKC3pajf0CH+TSd9ARizlfX1U3HmOz8p3x6L1cyeG/qbQEGcC9JO5t2CDFaSvXEIOReOXCXWsr+fxiFAPQdBzxh0+WtSBptR29yu4AYHntLt7fIZhDJe6xIcYmz/pUxjNoqVyoFIp2zXUyUwI893fgTLByJd1nwlS98c/5GNMVQ+PvBmgq+/ud3uVD0cwn4gPTae1vqMvKz4qHwvYI4qj2SD5mWfCEtj6V30g2q56Pimz9a9qU4WO0wVt9Ky0D8OZ8XOLro3rQdVI4L+YPwoGIEDL2NOCEAKhGfKpKtPWvGi8Tl2/mzsToklASpYJJ8FKkOn9VVrTZ2xA8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 847f9a5b-08d0-4de4-cd6f-08dad25c2868 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:48.3752 (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: SQI7h5A5vQlTBqVm0YNWaWo3khSu8PqwN45mgYJ0P6NTlIunhRZpB7ykoQbqX5a0ENxP4kQE71bIJU1QPamF9PYoRRymFpa2nfVUPwwT0zs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 phishscore=0 suspectscore=0 bulkscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: qxSd9BZT_RFKiDg5F6SuYd686uunYFpE X-Proofpoint-ORIG-GUID: qxSd9BZT_RFKiDg5F6SuYd686uunYFpE ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762266; a=rsa-sha256; cv=pass; b=MC5HaoFDeLPNC+xk3TmVfj35DNXJIZKePAYwj3nyM8gEgyCwg8w2sQvVWY+FG0yAIdV4Ns 0zeGH6hpMQ5tDrSPh1Ql9lweb2tFAZXJ3kYL5W+NwPydIaye6FbIL/hamhe133bFhqS8D0 TkByCtspKPhDKW32jbeZtsUvRboNZgE= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=Nin72qJY; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CQZivqSl; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762266; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=b3PQObH1nF66pRxTQNIQTkBEH8mytBqt2q8Yl3YFS+0=; b=TufniDN5N2T0/5OKyHAIvIpsjjMU2D39J5HU2smsc+DpbYewXMVCJsfhMAZbQX+0vjIkkx idlOx4Z8wPF/eXH+hT1N2TODNwj2dJoR+W/w3rsZqzwLUNI0eU3HqI+yEodQ/FTtis7PRg 2BovEbFXq3P/VJ4GQOs3L3jj96pKKPE= X-Rspamd-Queue-Id: 6AEEE40015 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=Nin72qJY; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CQZivqSl; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspamd-Server: rspam09 X-Stat-Signature: 6bcnqo57f8u613jdgibbnrie4qb7sdtt X-HE-Tag: 1669762266-87986 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Removes page_folio() call by converting callers to directly pass a folio into __remove_hugetlb_page(). Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d0acabbf3025..90ba01a76f87 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1432,19 +1432,18 @@ static inline void destroy_compound_gigantic_folio(struct folio *folio, #endif /* - * Remove hugetlb page from lists, and update dtor so that page appears + * Remove hugetlb folio from lists, and update dtor so that the folio appears * as just a compound page. * - * A reference is held on the page, except in the case of demote. + * A reference is held on the folio, except in the case of demote. * * Must be called with hugetlb lock held. */ -static void __remove_hugetlb_page(struct hstate *h, struct page *page, +static void __remove_hugetlb_folio(struct hstate *h, struct folio *folio, bool adjust_surplus, bool demote) { - int nid = page_to_nid(page); - struct folio *folio = page_folio(page); + int nid = folio_nid(folio); VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio(folio), folio); VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio_rsvd(folio), folio); @@ -1453,9 +1452,9 @@ static void __remove_hugetlb_page(struct hstate *h, struct page *page, if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) return; - list_del(&page->lru); + list_del(&folio->lru); - if (HPageFreed(page)) { + if (folio_test_hugetlb_freed(folio)) { h->free_huge_pages--; h->free_huge_pages_node[nid]--; } @@ -1485,26 +1484,26 @@ static void __remove_hugetlb_page(struct hstate *h, struct page *page, * be turned into a page of smaller size. */ if (!demote) - set_page_refcounted(page); + folio_ref_unfreeze(folio, 1); if (hstate_is_gigantic(h)) - set_compound_page_dtor(page, NULL_COMPOUND_DTOR); + folio_set_compound_dtor(folio, NULL_COMPOUND_DTOR); else - set_compound_page_dtor(page, COMPOUND_PAGE_DTOR); + folio_set_compound_dtor(folio, COMPOUND_PAGE_DTOR); h->nr_huge_pages--; h->nr_huge_pages_node[nid]--; } -static void remove_hugetlb_page(struct hstate *h, struct page *page, +static void remove_hugetlb_folio(struct hstate *h, struct folio *folio, bool adjust_surplus) { - __remove_hugetlb_page(h, page, adjust_surplus, false); + __remove_hugetlb_folio(h, folio, adjust_surplus, false); } -static void remove_hugetlb_page_for_demote(struct hstate *h, struct page *page, +static void remove_hugetlb_folio_for_demote(struct hstate *h, struct folio *folio, bool adjust_surplus) { - __remove_hugetlb_page(h, page, adjust_surplus, true); + __remove_hugetlb_folio(h, folio, adjust_surplus, true); } static void add_hugetlb_page(struct hstate *h, struct page *page, @@ -1639,8 +1638,9 @@ static void free_hpage_workfn(struct work_struct *work) /* * The VM_BUG_ON_PAGE(!PageHuge(page), page) in page_hstate() * is going to trigger because a previous call to - * remove_hugetlb_page() will set_compound_page_dtor(page, - * NULL_COMPOUND_DTOR), so do not use page_hstate() directly. + * remove_hugetlb_folio() will call folio_set_compound_dtor + * (folio, NULL_COMPOUND_DTOR), so do not use page_hstate() + * directly. */ h = size_to_hstate(page_size(page)); @@ -1749,12 +1749,12 @@ void free_huge_page(struct page *page) h->resv_huge_pages++; if (folio_test_hugetlb_temporary(folio)) { - remove_hugetlb_page(h, page, false); + remove_hugetlb_folio(h, folio, false); spin_unlock_irqrestore(&hugetlb_lock, flags); update_and_free_page(h, page, true); } else if (h->surplus_huge_pages_node[nid]) { /* remove the page from active list */ - remove_hugetlb_page(h, page, true); + remove_hugetlb_folio(h, folio, true); spin_unlock_irqrestore(&hugetlb_lock, flags); update_and_free_page(h, page, true); } else { @@ -2092,6 +2092,7 @@ static struct page *remove_pool_huge_page(struct hstate *h, { int nr_nodes, node; struct page *page = NULL; + struct folio *folio; lockdep_assert_held(&hugetlb_lock); for_each_node_mask_to_free(h, nr_nodes, node, nodes_allowed) { @@ -2103,7 +2104,8 @@ static struct page *remove_pool_huge_page(struct hstate *h, !list_empty(&h->hugepage_freelists[node])) { page = list_entry(h->hugepage_freelists[node].next, struct page, lru); - remove_hugetlb_page(h, page, acct_surplus); + folio = page_folio(page); + remove_hugetlb_folio(h, folio, acct_surplus); break; } } @@ -2165,7 +2167,7 @@ int dissolve_free_huge_page(struct page *page) goto retry; } - remove_hugetlb_page(h, &folio->page, false); + remove_hugetlb_folio(h, folio, false); h->max_huge_pages--; spin_unlock_irq(&hugetlb_lock); @@ -2803,7 +2805,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * and enqueue_huge_page() for new_page. The counters will remain * stable since this happens under the lock. */ - remove_hugetlb_page(h, old_page, false); + remove_hugetlb_folio(h, old_folio, false); /* * Ref count on new page is already zero as it was dropped @@ -3230,7 +3232,7 @@ static void try_to_free_low(struct hstate *h, unsigned long count, goto out; if (PageHighMem(page)) continue; - remove_hugetlb_page(h, page, false); + remove_hugetlb_folio(h, page_folio(page), false); list_add(&page->lru, &page_list); } } @@ -3441,7 +3443,7 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) target_hstate = size_to_hstate(PAGE_SIZE << h->demote_order); - remove_hugetlb_page_for_demote(h, page, false); + remove_hugetlb_folio_for_demote(h, folio, false); spin_unlock_irq(&hugetlb_lock); rc = hugetlb_vmemmap_restore(h, page); From patchwork Tue Nov 29 22:50:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059280 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7989EC4167B for ; Tue, 29 Nov 2022 22:51:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D6916B0074; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 732668E0001; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F0E76B007B; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 377976B0073 for ; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id EDDF71405C3 for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) X-FDA: 80187976848.21.027DBC0 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 6638440009 for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2ATMDZrP028271; Tue, 29 Nov 2022 22:50: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=y8+A3q3OU7z0MZTrGwpnM52Q3PMm64WXjLUV67OQZgM=; b=tAzCtDgmycQQei0gR4i3Ln31fzYcu5p7V2mp7KlUosOqbJHO+/vbR5jL7hpwNXzUPnIo TvmWA9o+sV9H003iLyWh4wuSkvJIgcwNbA4NPAohpgQ4F06zF4GruxPzvNMKD46RhWrs 11XAYj247LVefUCEqI8CxdwQmxatxtL/W9fTRvRnv7zV2PTxov9dJpQ9f0kFNRPwWco6 UiXRLDlmwHaQVd2K9LW1rky3fPqO6YnLmnHMhTYfZ/0N7rk1IO6XyXXM24Sd+P+77vLE 0WfJbfrYT7PPxjJMSBbg8HjZHaaj1jphWziaROts7jvy+PWWKMWAlWh971wbyooFyQbf fQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m39k2rh7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50: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 2ATMUMvI027897; Tue, 29 Nov 2022 22:50:52 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3m4a2hp9tm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HPNoLGk0VTxXj4BJ1xZtDpleFhzeyy02s7orktl4ShhagS/prMOzsj62NyrZB73JUzAnP/6EW9T4T6KsQflzxMD3ZsE8XtX3C//Z9ZzON295cRLtSDFtyinS8Nt2xEqR5MsMgI0srlBXJJq/WVAPWmYlO8AijmZGgUWAauSmBEgWDIggK8E3OUtMnSrKhpHaiCgopkLWaYhbIGkmmZKRZ8YzwhrrvAS0yJ+JZyscCBMR/cyNWPovJMhA3U5PubRaOWDD5BfV1F5CXZtW4gyS3KGM/KWr43rBVnEeUFAfbw7ZRnpnkrsbOhE+6CXBCB//kej1oki5nBy4mNBkT3/hAA== 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=y8+A3q3OU7z0MZTrGwpnM52Q3PMm64WXjLUV67OQZgM=; b=BYYlaTbq4sfBYnjhhqYPamkrWzeg16xO8Vrf/noe7LeQeXzIcFKT3uuPeFwVf2Au6UJxYm/zu99ywnjN8eL6uOqnBZbjSP1z/K7WIqn9+hhPjYSPT6Ojs5GchXdTSheVBgPlEON/Y2ZI4QgXuV4laHs2asIjphTysVj6Yjnc3SI2/przmuDTGPc4w7mTAqRXU+L0m8n4h1e81Icr7zEW+Ze3VA+oIfYSNSdWW7BvjNMFn7branW0J65isR/IhJPIxi1dVk900+1DHFwmIgL8D5z2g142GRxQiMG/YJbwmiC4NVRIQ26ngqT/esYXqOpy86s8oTzvtqv2bBXmPLIajQ== 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=y8+A3q3OU7z0MZTrGwpnM52Q3PMm64WXjLUV67OQZgM=; b=wCn6i8rkAvTKWXkotHpeAQaDlcJtd2d0q0dlmnSvqZE5YLo1mvYb8Iix/uv/z2Kn/92nv+go4Re7brHz42G+M1o+crnYlr2fDeyZgQg47HdK5bUIR7L91P9EJjAXCyJIx8IlNbqfv5FDXql4O/r+fht3F+M5NEibfm7AbcQ2wzo= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:50 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:50 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 05/10] mm/hugetlb: convert update_and_free_page() to folios Date: Tue, 29 Nov 2022 14:50:34 -0800 Message-Id: <20221129225039.82257-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR11CA0030.namprd11.prod.outlook.com (2603:10b6:610:54::40) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 923a941b-32c1-48ea-a991-08dad25c292e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N6XJOlgCLzzqDQC7Le423cIE/7oqbcNMN/OWFxnXLIJZnyNBa1jAg/GA6QnPcdPi09XtOhpvgXQ0oG4pH3fkayg05SBBc8rfcRLPOuF0g9lP3KJphMS6RJA5aBm263JFvbzW3AdjmAgm8sK+Yll4SKVLJUIo6vXruwydgjTVplw3B+zJwlgUDitaGf8wguN5eOWOJ/agB892pm0DjogMGVgeelTk7yOczLjhwi9rlee8qHpO8CbRHUc2c0f8AuG9ydDb5zz1QXIfUHHnPJVY6hol8wpdOkU155jcaFKoxCm8tOXy4CqdPO8vqQm9Bivkqpckh6Q4uWCfII8iC6bpCJNm0fMmeYk4Bj+Ih4ApWlGOAWEwWTiI1uO904exLAcjLUKXV0/ibfCPX9QV63wJnNew2Ha8xm9gzZPDLi1YwSJ/2+JbvkhWQ8iio5mOpTe0RBUpq1h+1scupAYxqEg0s7s7EmI/vltakV/r6siQE8lbnjPjHNsWLtMvWEIfIHYsrWAvlgH7+3XGKtiOSXK2pqS2G8bdeJTKwD7qMXJDGr7ohTBCdcvtyRhSrD6vp5iCjGUcwkMEVGlU/VCxawLhhEtpGD3nwx/YyrLUkIgKlvdUDXwT6qzyChe33thNurZS1NCG26Cad/sLI8BwT23TdA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(15650500001)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4VE+sPk/nhewN62ki+pzizJfVk5mw2EjMhVOf9f+JGpa1VmdzBwPyjjtmBnHg0av+ppFyu4rFHGuf8Qwa6QtHBWBw8SPYh/EFRfTNHLqWXregseOVJ6FBEauuBwx3hAUm8K1NMRD8fJk4QvuwRM/E3lrj3KBx/ZRAKobg/p/D9MmHTVKCfaJMfRpL2OaO8SiYNTScxDhXKk4vaKjkZDKao5FNwswcD5dXOUA06tukOcK1T2gA/7ulQfmIQ2u/P+xfR1FivPP+kdRDKPLvVZW2wjo7vy1leGAkc1gCGFxvcCR8naoI2k0FzZVUzRcVsCbobLCAW6DQZ0g75NA+EFvTfgSjZJnZYocyx4bVMOgXEY3bXbctTIq1O4woJhidy6c80dKW9/pHZ2xJYwrKalaJAg0aRGZNGl4YLPyuchDQQ4we9h9T+NKViDBi1VKawub5K5QMsr0cWWrkGkkXubcYEobwKY8JiqLRIQBiIxIns8DxmFNb9kBCx7yYhIL4xbodw3eTVStdveA3bvAZlA/G3O/Xtl9K/evtOmqwNiKwikar7DrASqwFbNGDsSHZU6dFDZ+jIEQBkrDQmfwOUaljPWCQe4C82VzsKboavrcMSo9YeDlQcWIXsr+CjrCs1UxkTsNcPojJiewYLRszzpZ85Z0tcyZj3c8Z6LG7K3QZ4pA4z/i4/eVipmtYnrXD5T+9NE/Z8Wk6hHjkzcGPaDNJQhxJdPePpatW58fw0w0zcUH2XEfLGh3qy3okJDVp3Uk+ub4p1QtxcOhYWNC6K7pc9LbxLjiRpqDPUYRpODinLwZ7R54zkjwOZ3JqFQyNJQlZkvuL382f58j686FRb970qg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FoEyS1E7rmVulPah3G4eCZ2egJLky3xTJ90Laa+7gFWeRXqPXBogtnpmVYTHNBjPDojzCEauDSxH7ZM0M212ochABMGH9imhEnAaNyxWPQV5Z+Z6qHgis+WBKuw/zzx67KOY6zhAbselJCdNrU/NvZUAd8azPHNl0yynTWbsxlmOoKPIlNGUFDpTS5V5eOKHkzv18rw1tMpJD5l+0qR3hT2C9rPuor8HjW6rwMKJMQx1MeaKA40me/y+OSj/7uAErrIReGi2T7F9F4mQiH6NjznoC5zo2W+8qKw1mBkXgvoFG7pJc4B2xHWLAk3bxlqajY1tr8Je+FYntThWhAkI9A37vRLVOd//9Lk0zcpfNqYRNdfkN5kb+b+H+z8idDCRmjcamCcLn0izWNf8JsMVBhHtWLKHYBWHcqNBy9J419NG0NM0WupaFNrjVPcjPDyYBojuesXz/LTEiMPPTdQxSR4x30umxwtwx0/uhkTf19lcKkL/2Lmk3/06MbFmHnUEL6bkj/uQxhbureqymNDhlc1MLEpHuPjLsSbeJ5jX8gU4Aww+fYVxhqzdoBW3JXDvNOfWSQOkudqoaH8Oe0lMRwKokzyQ6x1kuJtgULZddb9HpaiF0RgjC9pPyLnZO9pNjm33NiqcarxgY8oDnWrJv5Zzo0M8UjaX4p+UdBrSCrHrSCinrNx6NewRM7xvAbW0TZC4JN0uQ6gBtf/SYl7topgINRkPd4VkZaw/XFzRLHe7AaTkMN014yY0zGrhLyWRYT4L86F3JlyOV7SbPwXdfWHxOE/c8p8gDwBHiHs84EGmfBUbT3tM85JzXoo88CnIxJsDwADb0FTgQspal6SdBhkYlOLOT9bzDg8hCUKowpzEsljgYIE47g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 923a941b-32c1-48ea-a991-08dad25c292e X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:50.1405 (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: csn6WYul6NfqAr9CXNnHyWuaHmNbuNO1bGehdbzBcypPFDvGJH08C2whlGHXU4j/UvV3fwH4r+NCQP7c689daHbVvBw4AskhyHLYM/UMXpI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: yQXmKFIDwUELylECXPH4Tt3IGGWoX5Zk X-Proofpoint-ORIG-GUID: yQXmKFIDwUELylECXPH4Tt3IGGWoX5Zk ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762264; a=rsa-sha256; cv=pass; b=SxADeHmgRIAzYXkH90M0KPmg7Lx97vKM+syfakCB5QNngDsDQgcHvyZBZtQSsBmbUwKRGh lkSIMJPGu04OLznmkFCfLmXS4kmlEu9STv9g0Iz4Tr2W4vvYtrNHH5iJv0Sfg0YOQ+19Wq +wTCmVEN7+ERAeyeB7EC5M7bKUb4yPA= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=tAzCtDgm; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wCn6i8rk; spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762264; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=y8+A3q3OU7z0MZTrGwpnM52Q3PMm64WXjLUV67OQZgM=; b=S7wpPbBWqRORSq290rpv7fZhtSPNsyXzITThrkAVFegCxBBINJfuiTYPePwAwr2HV8LgBM CIIgvESCsFS7BFJ+40M6uufCg6IX33VNW0r2tDH1t88I1vI05c25xT+BnhrPqBgwnufbuS Ysv4oH9VmXatxnDDfnEgS2StV1j8M7c= X-Stat-Signature: c6t8riokyhm15pa5eie444brq1kfqaug X-Rspamd-Queue-Id: 6638440009 X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=tAzCtDgm; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=wCn6i8rk; spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam05 X-HE-Tag: 1669762264-334597 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Make more progress on converting the free_huge_page() destructor to operate on folios by converting update_and_free_page() to folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 90ba01a76f87..83777d1ccbf3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1478,7 +1478,7 @@ static void __remove_hugetlb_folio(struct hstate *h, struct folio *folio, * apply. * * This handles the case where more than one ref is held when and - * after update_and_free_page is called. + * after update_and_free_hugetlb_folio is called. * * In the case of demote we do not ref count the page as it will soon * be turned into a page of smaller size. @@ -1609,7 +1609,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) } /* - * As update_and_free_page() can be called under any context, so we cannot + * As update_and_free_hugetlb_folio() can be called under any context, so we cannot * use GFP_KERNEL to allocate vmemmap pages. However, we can defer the * actual freeing in a workqueue to prevent from using GFP_ATOMIC to allocate * the vmemmap pages. @@ -1657,11 +1657,11 @@ static inline void flush_free_hpage_work(struct hstate *h) flush_work(&free_hpage_work); } -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, bool atomic) { - if (!HPageVmemmapOptimized(page) || !atomic) { - __update_and_free_page(h, page); + if (!folio_test_hugetlb_vmemmap_optimized(folio) || !atomic) { + __update_and_free_page(h, &folio->page); return; } @@ -1672,16 +1672,18 @@ static void update_and_free_page(struct hstate *h, struct page *page, * empty. Otherwise, schedule_work() had been called but the workfn * hasn't retrieved the list yet. */ - if (llist_add((struct llist_node *)&page->mapping, &hpage_freelist)) + if (llist_add((struct llist_node *)&folio->mapping, &hpage_freelist)) schedule_work(&free_hpage_work); } static void update_and_free_pages_bulk(struct hstate *h, struct list_head *list) { struct page *page, *t_page; + struct folio *folio; list_for_each_entry_safe(page, t_page, list, lru) { - update_and_free_page(h, page, false); + folio = page_folio(page); + update_and_free_hugetlb_folio(h, folio, false); cond_resched(); } } @@ -1751,12 +1753,12 @@ void free_huge_page(struct page *page) if (folio_test_hugetlb_temporary(folio)) { remove_hugetlb_folio(h, folio, false); spin_unlock_irqrestore(&hugetlb_lock, flags); - update_and_free_page(h, page, true); + update_and_free_hugetlb_folio(h, folio, true); } else if (h->surplus_huge_pages_node[nid]) { /* remove the page from active list */ remove_hugetlb_folio(h, folio, true); spin_unlock_irqrestore(&hugetlb_lock, flags); - update_and_free_page(h, page, true); + update_and_free_hugetlb_folio(h, folio, true); } else { arch_clear_hugepage_flags(page); enqueue_huge_page(h, page); @@ -2172,8 +2174,8 @@ int dissolve_free_huge_page(struct page *page) spin_unlock_irq(&hugetlb_lock); /* - * Normally update_and_free_page will allocate required vmemmmap - * before freeing the page. update_and_free_page will fail to + * Normally update_and_free_hugtlb_folio will allocate required vmemmmap + * before freeing the page. update_and_free_hugtlb_folio will fail to * free the page if it can not allocate required vmemmap. We * need to adjust max_huge_pages if the page is not freed. * Attempt to allocate vmemmmap here so that we can take @@ -2181,7 +2183,7 @@ int dissolve_free_huge_page(struct page *page) */ rc = hugetlb_vmemmap_restore(h, &folio->page); if (!rc) { - update_and_free_page(h, &folio->page, false); + update_and_free_hugetlb_folio(h, folio, false); } else { spin_lock_irq(&hugetlb_lock); add_hugetlb_page(h, &folio->page, false); @@ -2818,7 +2820,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * Pages have been replaced, we can safely free the old one. */ spin_unlock_irq(&hugetlb_lock); - update_and_free_page(h, old_page, false); + update_and_free_hugetlb_folio(h, old_folio, false); } return ret; @@ -2827,7 +2829,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, spin_unlock_irq(&hugetlb_lock); /* Page has a zero ref count, but needs a ref to be freed */ folio_ref_unfreeze(new_folio, 1); - update_and_free_page(h, new_page, false); + update_and_free_hugetlb_folio(h, new_folio, false); return ret; } From patchwork Tue Nov 29 22:50:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059282 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 808C1C4321E for ; Tue, 29 Nov 2022 22:51:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EB30E6B0072; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E146B6B0073; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B53F38E0001; Tue, 29 Nov 2022 17:51:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9D2BF6B0073 for ; Tue, 29 Nov 2022 17:51:05 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 769C7140696 for ; Tue, 29 Nov 2022 22:51:05 +0000 (UTC) X-FDA: 80187976890.16.D2060E0 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf15.hostedemail.com (Postfix) with ESMTP id D35F4A000B for ; Tue, 29 Nov 2022 22:51:04 +0000 (UTC) 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 2ATMDtFO003623; Tue, 29 Nov 2022 22:50: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=ai5Z6340XBgifuzZvDQVr3i58Mz9Y04P69MGCD2WahQ=; b=ljtBORoCPoUwok5poqHUnGhHdMSbdI9laWPDBkFK8+/oIU01VNLrkOEGFx3hAbngMaRw 7jET0Moc41Bi5xfWfRWgrQ9rvgoETyN4D9tOCamdZZPw/EOvJJe2aVY7xG/+0k5gfgM8 ZuXytuCPLf8GD4qOWUN7AUYzSMKvBeS56gT7ekuXBi4U9rgEWQeSnHIVCeJoIfkjxYeE isGHiTRNTZJ89CesXiy+No6VAMLWtuP4HXacVDzKXKpTPjDo9tGeNWa7hOBRWRgjKfke EWdII8bnweeo6n6TuqP782hicD2tMehgrYfh09WJZvY1wO+FrpXynXOfgPleYbMWEpmJ eg== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m40y3yddr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50: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 2ATMUMvJ027897; Tue, 29 Nov 2022 22:50:52 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3m4a2hp9tm-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:52 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AsNMcn2G1tED7y6Md5E58oZ4jXr57LE1V5Afps9f5MgVZ42FulxW6ZV4bkpp5+ccRut4zgpAEQ53Pw1GPHrnLPa8Es9G1dxTwHQqS8H7Q/kuk8mzuwhcbRwKF3XaKHyj3of6HIkHDTKKZtHuhWlXhSI9phlnJS96845oRdv+hFTXFvltCKNNzraKKMz98j0slQRcEyesklrqZ4KB1THINlkk0CXXLekZwtKE5KZf+4g2xfF9FvaGgpfy5gO4CvfcW0Yy9T+fV8ijMp1dCky3YufMsMrw1WWnYMWfFE3rH8sLdj+fCkjBbPXvDgqJAFF179duw9tfZehB+DoHV0X2BQ== 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=ai5Z6340XBgifuzZvDQVr3i58Mz9Y04P69MGCD2WahQ=; b=Mb3DD6EHPvUzawmCG88AjWEgOH9SbF6FPWwLrDo/ie66PjRNBqZE5R+EiD6S+uEt9uArbmqjkZUWRyh45cZXqxj9ao+ZY0bonPInXrMX/wSIjUhrGh8EyrleESv1V8qTbuvjTqYmjNcLov/weH1GKpcjg1pepNaPu5Wi8mvBRauaBMQmHUNYgbWtGak+SoRhjs0GqL+bxWiyw+nnbCfy0fc4hmZFnNIWaXEUIY3KCRGjzIzTzF6ssRqeogu9SIi+tYYuumxe2qHo+aJ5LXbRPl+QqTDxRl1xzPKASpdHMnlyiEUA2yjpAOv8vzhy1R29DMy3S4WkgvG/2bX7NpDvaw== 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=ai5Z6340XBgifuzZvDQVr3i58Mz9Y04P69MGCD2WahQ=; b=znguAmYxZZVWyB/j9/96YsMWoy6eq6KYmrcy61cdP5kTYupVeBb/pYoAHYtZCsLfNtTNU1eQADkDQxY1t6IA/Q4zVWRh4FIUSvPtYkejdUC3DZIMs2VTVNgHMSlEjMYARecGLU1NKghEX6bbQ/9DlfWaXOmnrXXibHIGdo/FxUE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:51 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50: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, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 06/10] mm/hugetlb: convert add_hugetlb_page() to folios and add hugetlb_cma_folio() Date: Tue, 29 Nov 2022 14:50:35 -0800 Message-Id: <20221129225039.82257-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR04CA0021.namprd04.prod.outlook.com (2603:10b6:610:76::26) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: f13fc6f3-9c9f-43ab-3a7b-08dad25c2a05 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Ap0ockxtQf4Uwqk65oepW9uKYxzZlH8iSgCVRuuGt4iowEwfa3t8AzPnUjnHMGv2KHLUOXzd6Ug30j/CdU7Wz0pNMHzbbVGSE6U1EvnONCf0+jOq58/K4l06ihMopUGdqrgrI7MSz4vPHNRAsYeUXU9I+hG84qHTNr3OIRDo0OKe99AO4o5W+SjFqq1RsRDcc2JSrllzWoZxfDKxBahgBhr4o2BdJHRzGwO+k2/fcOCMKuvXuKzRczxoecBczXyQDPavqr5BvfpRkmbLN/ewacI78wIbPzj/u4w1DRRn4NaXwLosn6HR51BSHjBVAwVztTVWxBsr5u5HBf10uCKAcSEIfNn9s1IlIYeGTgD/G+BRkEx0Ie97GK5AKjnvmI3souHMd8tNbgjaVVIf56eoEmk4BbCRLFMbR9u7G5oF6geI55KtrR6Q6A2PLJzvQeJmJt6tw5mBN760cKzoqcLaVLN6nvpzzux7zPs1gn6Oh0mPq4GldeKXGjftjCyKNkAaikq7ew4/uh/ksIKPbiA75MGlZsQu3YOfHGhcJmTpqv5m9XDDZ2nShE1LblC43vnZTSYR4pNtJKORO/ktDrA/IJx8uNjouN5so0bMvP4PK8i5kI8OYmsNG4UVIzscGEMmTPX9wyRDFsVKeVmbjghzg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: i6snq8mzXAQ6RFTpYGY/Aj8MhP7/aQ1T4CJghyiqna6jG4CELLuZ4fcToSGwcCoGnBcDkrdA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3M0OJumOqWcfHeD64hvfE9bqsC47f0s+gbTi5GqkIbp1Rz7JTpjHoWA6OzjNKNftNeCYa68s/YllBvKKbiYI1nW7IRy2LSGuooUwoW+vLB728Ogj42rb4gLK3VhsoB/xsYlFg9KKsxWVPoU4khIggRdZRsmGVZ/0/dxp2z6NG/TatFMz5rK7ETpmPDpQt3sYxDUqiL9cnIvd/z1sffCZNlHPrq5zHHT0AXHt3h8qWU8dKSvI8Bh35ed82zhVR0L6WD6JMfQ3urqxIMtKFyA9B2GkkvA1erHCoCG9Wj5deMpd9zGO0L/9+WNurhyKuAyU/VmfclMNbmCEfM2RL+GZcHhgvaG9K75QqlcSpkxhpcD+pa/CTjDazklka/+GV81dc7fboGPEbX08iPNoe4S5ZCAiwhZ7AzbT2SCNdivFyInro8QXF3+5W1y4xLYaHbfkInpo6xuOlwOUpcDPrK9ZFAKL3AQr8e9odkoDUB2/KAn0VsabdJfGYFoR/U31AE8PtnCf4qazdWBEX8vSn9aqBQjrhBE3u9X62isH61XP0z8+QXokKeZG3AdF7wiJuoSASSMn3rl+UlRuAPwk48yieSn3WQbr2g5z2/RdwI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f13fc6f3-9c9f-43ab-3a7b-08dad25c2a05 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:51.1718 (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: UkwzMWTuwj8VTm9CbGqAu0XgCis/h+lo8YKQ+PB5fdgm27hFjb9OfSfd+yHTJI/FjhOwOBp0DqjaW7TfVuCBkMK33npWrKh4bLNEFEbovQA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 mlxlogscore=999 spamscore=0 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: kQFLTrPF5a3ENu3o33otRaTLELTzFIe0 X-Proofpoint-ORIG-GUID: kQFLTrPF5a3ENu3o33otRaTLELTzFIe0 ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762265; a=rsa-sha256; cv=pass; b=etqCrHt/WyM2Yp307W4eGFi9Xe24G5XQ7MdJ2FbI610CfzlpQ1owJpDjVEePFc3F3MI3R9 BUkFbPqq9WptJXOpFWVCzvc8i7fazeNysf88UQ6/zdr+8wmtoxnMFo8Qp+ugHoVyGiIOW2 WAdW2vKUVuLVH8UhU2KfyYzwqQVeJwY= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=ljtBORoC; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=znguAmYx; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf15.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762265; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ai5Z6340XBgifuzZvDQVr3i58Mz9Y04P69MGCD2WahQ=; b=GVmyPIpRBhCrMphhTOrdA/pA1/XvMBd359kp3jorb3Hn7KpOpKam9RyArs7rUFYHvtEhFW VfeZKQTnIDh18TXP1Jqk2S/3+zX3RQkk0NVAVL2sr2CX0Pv4Zb+svOVXfyvvhHQF72MKvK IKHqeNWg9i5wiumKgNIADvjv9E5VhSI= X-Rspamd-Queue-Id: D35F4A000B Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=ljtBORoC; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=znguAmYx; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf15.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspamd-Server: rspam12 X-Rspam-User: X-Stat-Signature: 4p3ubm8kzkkquyshqpewm9migw8uoxhw X-HE-Tag: 1669762264-873407 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert add_hugetlb_page() to take in a folio, also convert hugetlb_cma_page() to take in a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 83777d1ccbf3..57909a0e7157 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -54,13 +54,13 @@ struct hstate hstates[HUGE_MAX_HSTATE]; #ifdef CONFIG_CMA static struct cma *hugetlb_cma[MAX_NUMNODES]; static unsigned long hugetlb_cma_size_in_node[MAX_NUMNODES] __initdata; -static bool hugetlb_cma_page(struct page *page, unsigned int order) +static bool hugetlb_cma_folio(struct folio *folio, unsigned int order) { - return cma_pages_valid(hugetlb_cma[page_to_nid(page)], page, + return cma_pages_valid(hugetlb_cma[folio_nid(folio)], &folio->page, 1 << order); } #else -static bool hugetlb_cma_page(struct page *page, unsigned int order) +static bool hugetlb_cma_folio(struct folio *folio, unsigned int order) { return false; } @@ -1506,17 +1506,17 @@ static void remove_hugetlb_folio_for_demote(struct hstate *h, struct folio *foli __remove_hugetlb_folio(h, folio, adjust_surplus, true); } -static void add_hugetlb_page(struct hstate *h, struct page *page, +static void add_hugetlb_folio(struct hstate *h, struct folio *folio, bool adjust_surplus) { int zeroed; - int nid = page_to_nid(page); + int nid = folio_nid(folio); - VM_BUG_ON_PAGE(!HPageVmemmapOptimized(page), page); + VM_BUG_ON_FOLIO(!folio_test_hugetlb_vmemmap_optimized(folio), folio); lockdep_assert_held(&hugetlb_lock); - INIT_LIST_HEAD(&page->lru); + INIT_LIST_HEAD(&folio->lru); h->nr_huge_pages++; h->nr_huge_pages_node[nid]++; @@ -1525,21 +1525,21 @@ static void add_hugetlb_page(struct hstate *h, struct page *page, h->surplus_huge_pages_node[nid]++; } - set_compound_page_dtor(page, HUGETLB_PAGE_DTOR); - set_page_private(page, 0); + folio_set_compound_dtor(folio, HUGETLB_PAGE_DTOR); + folio_change_private(folio, NULL); /* - * We have to set HPageVmemmapOptimized again as above - * set_page_private(page, 0) cleared it. + * We have to set hugetlb_vmemmap_optimized again as above + * folio_change_private(folio, NULL) cleared it. */ - SetHPageVmemmapOptimized(page); + folio_set_hugetlb_vmemmap_optimized(folio); /* - * This page is about to be managed by the hugetlb allocator and + * This folio is about to be managed by the hugetlb allocator and * should have no users. Drop our reference, and check for others * just in case. */ - zeroed = put_page_testzero(page); - if (!zeroed) + zeroed = folio_put_testzero(folio); + if (unlikely(!zeroed)) /* * It is VERY unlikely soneone else has taken a ref on * the page. In this case, we simply return as the @@ -1548,8 +1548,8 @@ static void add_hugetlb_page(struct hstate *h, struct page *page, */ return; - arch_clear_hugepage_flags(page); - enqueue_huge_page(h, page); + arch_clear_hugepage_flags(&folio->page); + enqueue_huge_page(h, &folio->page); } static void __update_and_free_page(struct hstate *h, struct page *page) @@ -1575,7 +1575,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * page and put the page back on the hugetlb free list and treat * as a surplus page. */ - add_hugetlb_page(h, page, true); + add_hugetlb_folio(h, page_folio(page), true); spin_unlock_irq(&hugetlb_lock); return; } @@ -1600,7 +1600,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * need to be given back to CMA in free_gigantic_page. */ if (hstate_is_gigantic(h) || - hugetlb_cma_page(page, huge_page_order(h))) { + hugetlb_cma_folio(folio, huge_page_order(h))) { destroy_compound_gigantic_folio(folio, huge_page_order(h)); free_gigantic_page(page, huge_page_order(h)); } else { @@ -2186,7 +2186,7 @@ int dissolve_free_huge_page(struct page *page) update_and_free_hugetlb_folio(h, folio, false); } else { spin_lock_irq(&hugetlb_lock); - add_hugetlb_page(h, &folio->page, false); + add_hugetlb_folio(h, folio, false); h->max_huge_pages++; spin_unlock_irq(&hugetlb_lock); } @@ -3453,7 +3453,7 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) /* Allocation of vmemmmap failed, we can not demote page */ spin_lock_irq(&hugetlb_lock); set_page_refcounted(page); - add_hugetlb_page(h, page, false); + add_hugetlb_folio(h, page_folio(page), false); return rc; } From patchwork Tue Nov 29 22:50:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059285 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 818ACC433FE for ; Tue, 29 Nov 2022 22:51:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B4596B007B; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 365F28E0001; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 142D86B007E; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0675F6B007B for ; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A6846120175 for ; Tue, 29 Nov 2022 22:51:07 +0000 (UTC) X-FDA: 80187976974.26.E58FB03 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 284BB4000B for ; Tue, 29 Nov 2022 22:51:06 +0000 (UTC) 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 2ATMECvT020355; Tue, 29 Nov 2022 22:50: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=5+i5cFJ8kWF6G8sf4E5wI57dFP15IxoGxTJ3putGXAY=; b=GJTXJmuxlEvTuttYDr2jx4fLe6X9hNNqJdcWgCkhnuegcjHMoQrDmPeMu9ybStJVYTuS v/NGVvYlfC/IpQtOA+fFN7Ys3EnRNaOLSg+GEIAEiIrv/SLPWHEEgrgS3d8IQimNyB39 +9yQNZO1kLB/O/1sqjhIsCnSmi2FiNYzZIDyTEhBamUp5wpaNLL+OoNBnl3E2CmmVesf 4aaWnuUACCU9S+SK9qz9ybKc0Fjhfhckn1gnWTVRzsfVeNvCQGIW3Legx+N5xLkxbwIA uBHRLvduLkQM1nhaNtSCk/s4SXGVKREd9v9FpfRsJVL3j26XAoRFpsRO1H5dHFApxUx0 IA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m3xht7m1v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50: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 2ATMbKGT026751; Tue, 29 Nov 2022 22:50:54 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2174.outbound.protection.outlook.com [104.47.57.174]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m3c1w67b7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GGouup2fAid1VzYimwHOcwh0/ij7aJkfC68b/VAcilxTbUz9mULlR808zBbS5J/efcLPh02L727AXh6aUbAOikXKbR58/qOKEUJS/9lrs23MYOj1RdFnezDORYU7aZireHmAtn2pUDptqXkbfCRcE/CnuGSjlbSJlk/sUdfxFNmlsQUSsFtWM9C9eYFRQ9sjZ5jdbW7bgYQzt4HoS/WJMn/8t5vYkmH3GsQXY/EkNmYNe3GYRtSaAwgPfR6fp01yakYLZSS+9evpvKmaKXypeGYPTKvGKWFS/KokPfsOgG87RnwGO/tEG5V31ur8Bw19IR7dzyIY2Tmz3DgDv8W05w== 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=5+i5cFJ8kWF6G8sf4E5wI57dFP15IxoGxTJ3putGXAY=; b=YvaTNfpZIbfLqQhRiMmert7DACcpdY5AmLcwUyLL9xCXzDi0zo4lhCTWwHZLmZjM3z9Sc7uHsMpWrF8JIX5EVL+kojy7+sPH6Kd6Uj/nKEQ4oho/IDxVNl2qDbRBseAQmmTFUAyHfVGVCP7jBvp6xx85UlLZmJL/EoOe6hP9vQKoq2m50KqqS+Wy90LGKbMBGWJmJGu/zUjSAheCni1wETpG6vRiWsuXpsouUpwrCvMasOZqYmazRi6jnDmUi51VBFffzXSzuwIXCpLqE1ATeHVFcdC/zHS4NZZ9z8hij3PTcbUhG6DvlOD7tZ0chESbTP+ndsRMenl4rt3dPJ0j+Q== 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=5+i5cFJ8kWF6G8sf4E5wI57dFP15IxoGxTJ3putGXAY=; b=GcYcZq4ja7zi9nPHD+pb2rMJfyC427m//ep0Y88pc+vos5fjIbPPADM8NxKdOajYckhBjmqbtlqxbHtOFxk7rgPINvki/m9u3jB2UuO89o6G1YgIlaQG39EoMnWExznCR8b9B+gwTDs3lzVSCQFJBxBk//QalHupOcpgPFu6sc8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:52 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:52 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 07/10] mm/hugetlb: convert enqueue_huge_page() to folios Date: Tue, 29 Nov 2022 14:50:36 -0800 Message-Id: <20221129225039.82257-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0P223CA0011.NAMP223.PROD.OUTLOOK.COM (2603:10b6:610:116::26) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: fccaf2cc-c035-4088-110b-08dad25c2ad5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AE0AK+qYqiz6a3qPWEmKAHmLA6htAxb8oNoo4I5CGZ4GkqtFi6MdFT+88ROFXmJn+WdgAA8r5H9rHI41cKLqkPSQhC1reVIvPaHoMhv+x5phD87bUeFSWzpVyZgE+96VTwY/nfC4GRPNoZ/xgYXPiWYamcY0Sry3G8a+F/Q7sycy3lXJQPqOcA+3skdZJrMk1GLb+OQNu+8sQycEMUwrhC9jcSHFqMI9KErPaXXLJkBFC25Kv8x/1XWWjQizfYJ6Z6qt9GSPTx2KAGhQjyrZ5Tf3og5Piv6MrVsXh1flDaQpOD5vrNkdpYmzTR34S8IKhfWDPz1R6kvgzJshovA59QrilLldEb8MmfMv/N+uI/9gSEkXZL2fZSPgSzp3UPVl2iIdfSDdf/3sHKmbiHqFipuqwU0HYxJyYjgKDlPJGJPGwqiAhzTgBvMrD59jABq3BoFLZp3dkUBwyRB9ttHjJ1ZCGsorrTfuH13ZPUixk/fBf7RSnsIEG0dJXGcGXzDPgfB0KftdsnOdtIglUfBy1Ukn655e4DGWaaXoPaK6eh780/tb37axNiPHXhDuwZHIOYMjEbjvAtEl7bwq19pbkh28jVO7mOHW2P9IYBVKKFwZ7ZTwpbOjKKTRC9T5ETM2O6g8PL6oZqZTlrphrw3JX2UvyrshG0r0IQmiyYmXQ+cgE+j6FWs+kC9EcJ6MnOrH X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: BTRBQb7Owkh6FM7LAhC93iL6Q43wKVPfs5M/morIqekFctCBUipL+uaQB7Ez9K/2kq0LfFMufNnLlRQyZ1DIC45r7rRIIaljx0wnIIbxAhAP2cwXb12s/DE6vA+wy0Imz4G7Ljtrv7qKy9YT39UOKtGlveVmCnUqvqGwS1C1O+Nr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VNEy5SwcDtoyp4Q0Fx0upVWG9TSqEIziSa9W0YnXPcHgE9yOqwMr6ApDTWvjHTTifzHaV7eH8Hrn3wGAQOkefALpGi1zpFVfDw4+6JOqZXtPQ+ANGwuzlUw7ZtPAuuaLeK9D8mRA9n5G4KR6XHnyYkIQrRyyb8jpWWccRoiJtT8Q8GgYQTTsCY1LHQvTvMfKCwmisGjBiBnOylqb1fIGy9wBPmtvgRAiFDgYPTeVvPLJhNmMFzNC3+TOaIP1Ky8EOSMckTHO4KWI3+i4yi+z65qlpAPndTatGrsDn6A6J9yw29FMnb1natGxZY+3+oU11keDIz9FdSo5y5+mqlI5ywM+gCMCgyzvVsWx4XBsh/9lwf+hr8AMxpaxHKePE7pvJol0mOfmP+qaSDSNf3dZtpwnToENOOUBTyDYp8zNQaQS7K2ltQ7PHO1yX4HvuE/e16OiR+W1+SOAHmUhWto7kd0pPkLMZxDRhCv6yTU= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fccaf2cc-c035-4088-110b-08dad25c2ad5 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:52.4558 (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: mimBSlHJQjMHi47JATmhwfHw88LRLBwqdaswpel7FDWS1iaFWUkTfhY3fhYsaDh3Ljzh0d7uFF/nF4AyD/ewF0C5JMiPVWPEyRczSDQENzs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: zoup_tALKEOz5kMrv6Cwwv0OJ8OjBQg- X-Proofpoint-ORIG-GUID: zoup_tALKEOz5kMrv6Cwwv0OJ8OjBQg- ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=GJTXJmux; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GcYcZq4j; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762267; a=rsa-sha256; cv=pass; b=r/Kqembttj2q75riffAatARUqq7hnqV2eYfrxWBlEm93xEZI8pEHGYGWIPmrvdzG5eawbW OYfgDvGP2TUlFVVcoQecFtTYqOAfqSX368PWv/RoOYpnrIcl+Lgcx8C+dxm83hGK/SHNCl mbb1vAByntVVgPnjKZQ15zEzsd7TuPg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762267; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=5+i5cFJ8kWF6G8sf4E5wI57dFP15IxoGxTJ3putGXAY=; b=QhoxEPP10SUq3e0zmVWurrowkSwqBmzcL1pdpclCTgBOCLcE986d1EGCL5IT7abZPDuaHJ 2yTpsp93An1wcxZPKQpuTHll1CBaHW8MTdOvar5cNj5agmupSX1i0NnSWmDUPU/iPnoy+K UFMu74yO/os7tjMf8kzKzGkJT0BbS2c= Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=GJTXJmux; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=GcYcZq4j; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam01 X-Stat-Signature: zfj9udiasogx87y677fmqobmipu4nbz7 X-Rspamd-Queue-Id: 284BB4000B X-Rspam-User: X-HE-Tag: 1669762266-790089 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert callers of enqueue_huge_page() to pass in a folio, function is renamed to enqueue_hugetlb_folio(). Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 57909a0e7157..c889593d5053 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1127,17 +1127,17 @@ static bool vma_has_reserves(struct vm_area_struct *vma, long chg) return false; } -static void enqueue_huge_page(struct hstate *h, struct page *page) +static void enqueue_hugetlb_folio(struct hstate *h, struct folio *folio) { - int nid = page_to_nid(page); + int nid = folio_nid(folio); lockdep_assert_held(&hugetlb_lock); - VM_BUG_ON_PAGE(page_count(page), page); + VM_BUG_ON_FOLIO(folio_ref_count(folio), folio); - list_move(&page->lru, &h->hugepage_freelists[nid]); + list_move(&folio->lru, &h->hugepage_freelists[nid]); h->free_huge_pages++; h->free_huge_pages_node[nid]++; - SetHPageFreed(page); + folio_set_hugetlb_freed(folio); } static struct page *dequeue_huge_page_node_exact(struct hstate *h, int nid) @@ -1549,7 +1549,7 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, return; arch_clear_hugepage_flags(&folio->page); - enqueue_huge_page(h, &folio->page); + enqueue_hugetlb_folio(h, folio); } static void __update_and_free_page(struct hstate *h, struct page *page) @@ -1761,7 +1761,7 @@ void free_huge_page(struct page *page) update_and_free_hugetlb_folio(h, folio, true); } else { arch_clear_hugepage_flags(page); - enqueue_huge_page(h, page); + enqueue_hugetlb_folio(h, folio); spin_unlock_irqrestore(&hugetlb_lock, flags); } } @@ -2438,7 +2438,7 @@ static int gather_surplus_pages(struct hstate *h, long delta) if ((--needed) < 0) break; /* Add the page to the hugetlb allocator */ - enqueue_huge_page(h, page); + enqueue_hugetlb_folio(h, page_folio(page)); } free: spin_unlock_irq(&hugetlb_lock); @@ -2804,8 +2804,8 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * Ok, old_page is still a genuine free hugepage. Remove it from * the freelist and decrease the counters. These will be * incremented again when calling __prep_account_new_huge_page() - * and enqueue_huge_page() for new_page. The counters will remain - * stable since this happens under the lock. + * and enqueue_hugetlb_folio() for new_folio. The counters will + * remain stable since this happens under the lock. */ remove_hugetlb_folio(h, old_folio, false); @@ -2814,7 +2814,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * earlier. It can be directly added to the pool free list. */ __prep_account_new_huge_page(h, nid); - enqueue_huge_page(h, new_page); + enqueue_hugetlb_folio(h, new_folio); /* * Pages have been replaced, we can safely free the old one. From patchwork Tue Nov 29 22:50:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059286 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1754C46467 for ; Tue, 29 Nov 2022 22:51:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F5FB6B007D; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 958636B007E; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AA366B0081; Tue, 29 Nov 2022 17:51:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 560026B007D for ; Tue, 29 Nov 2022 17:51:08 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 3106F160F4A for ; Tue, 29 Nov 2022 22:51:08 +0000 (UTC) X-FDA: 80187977016.25.FEF6AE2 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf08.hostedemail.com (Postfix) with ESMTP id B736C160008 for ; Tue, 29 Nov 2022 22:51:07 +0000 (UTC) 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 2ATMDrpT003552; Tue, 29 Nov 2022 22:50:58 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=rdUq6asB04bq4S+8JctIthM7n90/mFKk6Mh1v3Tykh4ji7X6OWUfg8Z9qJTdPlUR1QqP NqRfFZWEgzo00wziieQAdOgL5m2arsU1ObzGdXuxP1aPbJuVT1Wjf4m8qHXgohTDVzBe 09dmRB1VHYWXP8eklmh5C/s+0SMinsdnyDAbIjZ+b4KDTb7CiTkSyl7ZH+9Qm+G5Cn4C ET2+cuDXw33ZAaXKLpOe6mxoVYd6HeRnJp9wQ4B1UeWrW3WU3zrWb3z2ZXoRqkP8fvcu 38dMDcJZvcxijLG9LcFgU6/he/zRKE9Zh7E5vzQPsFpU826Qbem9XkyRaDhPLeSMRHQ+ Jg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m40y3yddv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:58 +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 2ATL9k2P019333; Tue, 29 Nov 2022 22:50:56 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m398eax7y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdaLa6CSEk2e2HLe4/TM6bUloAqoO/Vz3Y2sK1vlKj4WGmAfk0feavCxR6DC1aCpUF3kuuxlpBVH91rqEitz7k31yk1LtzAEWTiKCxWLc7B5uicqZYDAFoJG91wzgQELZuQm7DRXD6dpLCc/C0vsqYAfisuJWqHjf9LxdBxCSE+q3L1OXD/zWceXar7DjiX1YNgxj3ZeV7UwZ8YNhG0wVBUEvyjAZRZYTmF0vNcISLNk4yJmn6PHe5Xh4/FG19jxULAPRpj/oimTtJ0zPIgLD+UdsB2aBRzGP1RpqwDkErL2vK+uTdcsBgnZ24GC8joDu+2OGaSLuRhBlUlZygxydg== 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=ZNcKaLc5Ze9QaVVVSxa8PSHW9Ir+9hHw6BzrTivljrhrtskYBqhjyGE813rX4IusUQXiTMWabVQKqkMQEMYH+RaTcxce+YsT+d0KK8ktny9RIid9N0krvPsxOMOgISV0FKwi3NsRc7P1JbFBvjKwaRS/X409AqK9ZmqwNGktay1b6KFHi2tj3iHlwrEuwWnFdMj697N49hN7x+AKUj3n+WGk8VLG87PSiKBNGnz/OdRDvvAJPyIaDwFctTGXyuxMacLXeWfh1mO1x7MNu1RpF6/oVIVdlnXm+8caf0Z8EYDWlaazbEwlESnjZ9CJnkBFc1HMqAtKFJC/hAIvW53srw== 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=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=mmU3WTqaxSvSDSsUwNFrFT6Y5TE1/A1eRQGVgh5vEfSKMwomCrI84wqmGS6tjE1BCOv2j0czUccaXCspiuirgax5A4HFe6rHbwj53XRDoS78YTswOep78DHbLZXoDbfPJyphWR+eLjvheK3yq/P9xnCkhkTDPA7XcVIXnweu7bA= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:54 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:54 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 08/10] mm/hugetlb: convert free_gigantic_page() to folios Date: Tue, 29 Nov 2022 14:50:37 -0800 Message-Id: <20221129225039.82257-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR15CA0022.namprd15.prod.outlook.com (2603:10b6:610:51::32) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 02b3d9ad-0e28-4aad-49f1-08dad25c2bbc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SxxuUHRt4+B/KHMko0C/zo3Sq2M1RkjR+7W3eNBa/k+7fWKZNlB/u1dbAoLWSa9YJ6Nzk/3Dg93wdYIVjUwFblvAvjw/EEljQx9q/fKhBvT+QOKBfdQmBD9WjsOouDJ2Xs8UOs7XphO4djOrDmQyZ7d3vTFazTIR3cjjTczWFx8haqhmN1jr9ICRMtTaDKkxLWD258W8a4dgRscwXlwky1rvJ/s9Au6q+rZ385X7+56AgnvPZTUZzOr5wHFS3NrREte+qqtBF8VHxV1kOIyc8zR8lL7j/p0JmbqQgbpLmUxYO47oqLZzeSo4j5YX6f8b17Bfe2BLKkzcbReMKRdTIyecR02+RzqYcUliqd06c9eCF6ho3NcI4trgyNN4/qzE2UR/smZZ2vd+oO3GPbKE2vApVfOInCAh42bHCMtfkw9lAd4D7lbEWrNSMMGg5lzIKPbMKIqUcI7NDFnrw48Ukz1gE0GuxMX/J941U0SGgax49hM9YqFRwKRbMELoxaR7WDk4v73OfpajDc+ykS2nWiVjaFp+28l2Lf6lhnNf3WKFfXNrY+SC6DVphfVwOrEtzqIntcbxtlRi9k4mCJnsvTLbZDtII0n+c7JSufxDBExajFgZKZiplwKmg4y8T/cEmpI/rTmm0ufaukI45lo11g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bwR681NMFRJ4/akGQMeZ//uWJAXAGxSGfZGHGv8zU8vHTIX/llrYhciG79OHLTJsUnR011JUsV/TYGdpVS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FNKMSqti9G4X0HISEGDlvaNKNWTMG5c79YIe+PQRCJX5etV8H8MBjnkOG4LPCqaNX/j6291++CNv6SYosvxDbkNRmxr1yDWAcAGA8CVDUFGNqE04i2u8SN0mqCd036eNk3QiEo9+J6E6iZiA6jLCAIO/NqrLOopEdXhrFaiBjiRQKDADvFZITGFVOJXFjuSqiRipq2OjdxsroOllG0ob/Xr2vYUoN29p5RsGVvKZJBiu/jHweQYqckRsvBS1YxbiyxpkUGUdumCVLb/s04L5tTdV1qQaw4M6VM61XCvE8ns3s6niaFkmKOUrwUVTeKxGVWHlWLljEmb4msc6t8cIMeeV5lsxoOdT+hNN7JY2lXoqylLKbzUC3fa4bM8jlKg2jtvu53RFZ9dXD7HI/ttQ4Zh6prxYlYXPjqAH8+LPt9TiV6JMM+4ivX6CsZBrCFH3nMgjFIEufxDf4GNs7uv2G29cFGmezruVfMJ/Wg2Je5ZVbYsX7EUD+5u4oWGjemkg1GL5jUq51Nfl+gU/DBvuP1vRpqm947fsV0pxexi6jw/yRDECvG7eM5BgYIP23XITDgk9JM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02b3d9ad-0e28-4aad-49f1-08dad25c2bbc X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:54.4417 (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: HhXLrsLiKFd0IuWiYi3NTDIAct07rfrBhSEENQw9paVwimf/wKSCMITkdZO8BEObWJt2zkSPGVj1+ruNfKt/YORBFTC9b7lPl/iVDEnEDXk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: LyypGqLyMKerSw-r-tHOcNGzAUezfYBZ X-Proofpoint-ORIG-GUID: LyypGqLyMKerSw-r-tHOcNGzAUezfYBZ ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762267; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VEjluJMxaaae4AwJxe5SeRqJf5l90Dwnlg9eOn+TBrc=; b=TBZNOOYVYPHSKOqtMkkpmbXQCT2neqf4aHn1uXuXUb0E3vs5sd8P7NdPRg1ferapuankji sxMg/JUxU2fiCMW6g8zqb4xFKpDIMLzXEfeiGzLb1EBEFfSNSwJ725komZ1dEgwQlrrJGj qqETgf+yQb7+ExqrcsUfqNHIojFWwf0= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=rdUq6asB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mmU3WTqa; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762267; a=rsa-sha256; cv=pass; b=7jwsRPDZnrgN1OSHAJhI1DBLz9I7WBZ89HAFGGuNNs43L7ks+t+nwrA5VO8qOSilhZ7cZ3 ACEpquysBhw2NOrxuFSJ/ouLBNzwQCoNx0o3GrwwkW5VxrsiHgk5FJeOXq0Gm6rW3GJ4WX WTTuohDVjOkCBgDq66/CFI6+Na2XV1U= X-Stat-Signature: rcio5fbi1snxhk3a8kbnabow3ixs9iq3 X-Rspamd-Queue-Id: B736C160008 Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=rdUq6asB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=mmU3WTqa; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam06 X-Rspam-User: X-HE-Tag: 1669762267-961194 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert callers of free_gigantic_page() to use folios, function is then renamed to free_gigantic_folio(). Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index c889593d5053..5e580ab834c3 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1361,18 +1361,20 @@ static void destroy_compound_gigantic_folio(struct folio *folio, __destroy_compound_gigantic_folio(folio, order, false); } -static void free_gigantic_page(struct page *page, unsigned int order) +static void free_gigantic_folio(struct folio *folio, unsigned int order) { /* * If the page isn't allocated using the cma allocator, * cma_release() returns false. */ #ifdef CONFIG_CMA - if (cma_release(hugetlb_cma[page_to_nid(page)], page, 1 << order)) + int nid = folio_nid(folio); + + if (cma_release(hugetlb_cma[nid], &folio->page, 1 << order)) return; #endif - free_contig_range(page_to_pfn(page), 1 << order); + free_contig_range(folio_pfn(folio), 1 << order); } #ifdef CONFIG_CONTIG_ALLOC @@ -1426,7 +1428,8 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, { return NULL; } -static inline void free_gigantic_page(struct page *page, unsigned int order) { } +static inline void free_gigantic_folio(struct folio *folio, + unsigned int order) { } static inline void destroy_compound_gigantic_folio(struct folio *folio, unsigned int order) { } #endif @@ -1565,7 +1568,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * If we don't know which subpages are hwpoisoned, we can't free * the hugepage, so it's leaked intentionally. */ - if (HPageRawHwpUnreliable(page)) + if (folio_test_hugetlb_raw_hwp_unreliable(folio)) return; if (hugetlb_vmemmap_restore(h, page)) { @@ -1575,7 +1578,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) * page and put the page back on the hugetlb free list and treat * as a surplus page. */ - add_hugetlb_folio(h, page_folio(page), true); + add_hugetlb_folio(h, folio, true); spin_unlock_irq(&hugetlb_lock); return; } @@ -1588,7 +1591,7 @@ static void __update_and_free_page(struct hstate *h, struct page *page) hugetlb_clear_page_hwpoison(&folio->page); for (i = 0; i < pages_per_huge_page(h); i++) { - subpage = nth_page(page, i); + subpage = folio_page(folio, i); subpage->flags &= ~(1 << PG_locked | 1 << PG_error | 1 << PG_referenced | 1 << PG_dirty | 1 << PG_active | 1 << PG_private | @@ -1597,12 +1600,12 @@ static void __update_and_free_page(struct hstate *h, struct page *page) /* * Non-gigantic pages demoted from CMA allocated gigantic pages - * need to be given back to CMA in free_gigantic_page. + * need to be given back to CMA in free_gigantic_folio. */ if (hstate_is_gigantic(h) || hugetlb_cma_folio(folio, huge_page_order(h))) { destroy_compound_gigantic_folio(folio, huge_page_order(h)); - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); } else { __free_pages(page, huge_page_order(h)); } @@ -2025,6 +2028,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, nodemask_t *node_alloc_noretry) { struct page *page; + struct folio *folio; bool retry = false; retry: @@ -2035,14 +2039,14 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, nid, nmask, node_alloc_noretry); if (!page) return NULL; - + folio = page_folio(page); if (hstate_is_gigantic(h)) { if (!prep_compound_gigantic_page(page, huge_page_order(h))) { /* * Rare failure to convert pages to compound page. * Free pages and try again - ONCE! */ - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); if (!retry) { retry = true; goto retry; @@ -3050,6 +3054,7 @@ static void __init gather_bootmem_prealloc(void) list_for_each_entry(m, &huge_boot_pages, list) { struct page *page = virt_to_page(m); + struct folio *folio = page_folio(page); struct hstate *h = m->hstate; VM_BUG_ON(!hstate_is_gigantic(h)); @@ -3060,7 +3065,7 @@ static void __init gather_bootmem_prealloc(void) free_huge_page(page); /* add to the hugepage allocator */ } else { /* VERY unlikely inflated ref count on a tail page */ - free_gigantic_page(page, huge_page_order(h)); + free_gigantic_folio(folio, huge_page_order(h)); } /* From patchwork Tue Nov 29 22:50:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059287 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05A3AC433FE for ; Tue, 29 Nov 2022 22:51:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F5196B007E; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 97F886B0083; Tue, 29 Nov 2022 17:51:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 735F86B0082; Tue, 29 Nov 2022 17:51:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 5F0BD6B007E for ; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 2BF1FC0A45 for ; Tue, 29 Nov 2022 22:51:12 +0000 (UTC) X-FDA: 80187977184.19.CCF3B9C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf01.hostedemail.com (Postfix) with ESMTP id 6D8464000E for ; Tue, 29 Nov 2022 22:51:08 +0000 (UTC) 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 2ATMEBlq020338; Tue, 29 Nov 2022 22:50:59 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=wuU7XVHLL/UaHs+sBKQj7hY4L3mCo1hC7zE6ApTPLx7Jpp8D1ZLJ/+ESKM8Wbt4WpFNy J8egZH2I3UFNZgNVnCjymV1oU4zZkqIb2aIaHGZn7N5CV4BAlYA0MM45L0H9U1lTrSJN 0UHnin+P5gRU+BLj5JGU2UD6X6aSWQiF3ceYcVGdROYCIhPaqJWcn5coQB9UBML64KY3 zA+kQMpmTfwuaXV7rQxbEgL2zl1oTH6fPRkaWGQhrtTZ25D8AF9wOK2jSNv9jE5ReyjW n5UcZemxNt18KGEtJ0QV/wMG7c2AolxjfXqwbMvAtQOM89xX+vxbPUXb3bpqVyu6maKI fA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m3xht7m22-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:58 +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 2ATL9k2Q019333; Tue, 29 Nov 2022 22:50:57 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3m398eax7y-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cUU4x2mtmGUjc/4mmNN1YX52GDjamaXusDYCBH+UynivFZdev9PuQlb7JG2InxWQ1FeKSFsqTGL3KsF8LVFRVHH5NZ8xebw+7/pVNnbVpYDfNoFWlswS7SNAU5V27W1NStF+P9TJjIH1SDBnQxgTLA542G/vtmS04Gjn5IQ0a46iQzQ4eMCYN3IzZjbHT2qU6x8L4NMQAWLuFU6TMrgEZ8Gfg7M+uKfLg+VoBi5kJWat8+oCXSBc3CGuzoIprb486+BTb5HZUsDKjtlrYtVqDokXYoUABS1iJmXArz+X1CmM6mLJvucbdkBGQ6FsuZ/zRHUDpDSrkkogFN+OtUrQ4g== 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=RMN8IBxfBLNqVeLSXdG6CfCIpIjBd0/sMl/9GtOohx+TiYKEku5jUzF+RLY1notO3iuG1EEkYqTQdBY62IXY97mB5+jWHeU0c/OD3rPfNR6YWsFoOMPtyHtQLy5I6CJzeX+hYLeIMf8Z8EN8Ym/KVGiVXVjh3x0Dc2YgKnd4Fi7tGiL/qrTxVQzz6+yCIEXwgdlk9ADyV/2egQcNcQ/KivSVFJIPAbXXWvjn9MVij4eCirtRtNyh/Ar9f5sC+QvT5cN6Bql+57OZxgIJtfONj32evMp2BG3yPoYjOjpk0ShxaIpGd0K5trRc5zD0t93V3ptRM6eBWYaGE/WqRtgtrA== 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=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=YB6v5qE6JKhxDEcxHrZY85+ErjUMHuWzAm7uu5ug1yQyF83fqLIrCF4Tl4xm3v7XtZjCarZ/YGEd8uDcNP3HlY8GzJdfHsc+aNNB19BsyDYQsQilMXqRqJSzFCoWIOajN6FvvwPuf3hcnCOdkjNqvoflSc2rpj6+yjVMg44fdW8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:55 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:55 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar Subject: [PATCH mm-unstable v5 09/10] mm/hugetlb: convert hugetlb prep functions to folios Date: Tue, 29 Nov 2022 14:50:38 -0800 Message-Id: <20221129225039.82257-10-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR13CA0008.namprd13.prod.outlook.com (2603:10b6:610:b1::13) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d2240a9-8a8d-462c-fed5-08dad25c2cd7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 47H7Lo1fuqQNtpWt8KB+w0mfT7vdYbwbMypp2NufQjCnJwlgICkjAlxxJW3KbIq6IOfNoyJf2hjXLdp1plun3mETbw5fEKMRFqDCE9sq7rLP3ZTYZYPLAgvvtmIAl2UNCXVouKgUOwwftibwFymmVWgDX3FgI8PR4h7TJFEW+eXgHc0VXvCwSLjeTMmLLjjvoBzBaD1nz/reHpwOUBleZCCvG2ZCG87j9hDkgyNtlbIUQFEvMbgr+2x3KuWYQeMeiR1FcWZ4b+toOJjfjUZMXVA0VWZu/w7LcN4QwoGnalihUOpkzD5b7d8bRDIZ+TtqOnH1zHrKG4nj0IvKfTf64ZXjDLVVbNRdl77BPeHQUfwo2ZIlMJXuaoejMRBXShC1GclIWx6gFEAJxLgRcPcTIfQ/qqbCc3b9y3dLsFDwtxGW8hA+3thMMw+/mu95RlQGS9Ob9yuYnnDypPhPu9gFvS0tUktsW+XS+COFCHkXTYfPjA75iyLjcUHU1P0rslAIiA61vYBqsAnm34RIv1FfY+q+THMUYJbGgdqVUlY1EVaMjwjkMMF7H/gERzQgr3ZPSQ6EeTGeOtrcU5PeSa44NrO3xju32VgM7XePztWKLGrS/FwfkjYrgv9TAZyZl9nXm11qMP2GxRRwy7DoVIx5LA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(6666004)(107886003)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: eVl0Y/6s3rILMlkNq6kOSZsjbnnKWcz77ZWDuIQYqAGuL+/GEqHJCGuzq7+xdL7G8fSzVuo3T6Ci7oZh9PbvIaI8gg5GKAKms/PSIUX5h1bTSebc/UjZPqrYnCBNPl5CPPmJjA2ZoVNscMatdOpZpmAVNO4rQU2NIuvIhn65gxAvUZpDdhjqrUZ5NrKgYJ9mmSPmSKVaG7nQ5aNYhlOU+Q5sxDH3AFuw8XGgwXb2O/ATXk9FgtTLzss2mRYqHKfM5kb7PProNftYrQE6VmSDmnA+WYBqhJOdS97PZf/K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38ltsRQR3o1EJhfCgqGOQni97VZcYR3qJocgySoQhVRbxictR0nm5aFfUtQmozHoAeTPgqCYuhbf/KURSi+xfAENICjZV+ns7IvrWXvfHFmLve/4ybMHIt2NUvv/ASgDAgaowUs5KyP8IiHqWoNDdLUopQ7/wWkQ80Jfmy6bGVPI2lrTEZL6UMC5TK2UcBL45DQ8I3v7ANpJwSxp7IhcMzZG4vJz6geGRxluCLvyQx0ho6BBva2g+WToTG3AnxcNELnLa7ajIHVTAwh9MgNopV222QjU8NUDYKpt+xh9504lVLMRtLSGvpf606KnUbKGuGDGniwVHv6tcpfWZI5eQmCuUvJyVaW5JQUez+uVd0Q+ivRv6HCaGJhe4Fe4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d2240a9-8a8d-462c-fed5-08dad25c2cd7 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:55.8305 (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: bIUHTmcF5aJwYibkvhqX27rRYWxoSH7Dpk9KPC1j8ilSqqzKQPSvISenqi1ox9d+W5vxdZ1PtSS4AiBsOSIe6wRaqgOtCBKie1QikT4XfEY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-GUID: KKwCzWtllePi_eY3CNfopvafwq8qpcKh X-Proofpoint-ORIG-GUID: KKwCzWtllePi_eY3CNfopvafwq8qpcKh ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762268; a=rsa-sha256; cv=pass; b=Vyy07/atMB9WcolAoh9nhmfFHRhUQP4X1nf7BOgwLJq9AsIF/WTja8RduIVxNeWROVDL1/ 32gdfHB/xoj+cb+obzfE4uKLvRLEnNWeu3lQKGhrl3zQAVLvwxUdzBEbKzjQkfVbWCJdJm ci2B56nIq8BKLmmX6ZmZkwTfnJCtgO8= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wuU7XVHL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YB6v5qE6; spf=pass (imf01.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762268; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pFBt8VX6o2UZgtqtp0qKSqJojCjD0tv5Zao/WbVC1Xs=; b=av78Har9e58IkiZXTYZMzXgF9jOSzCMzNUrWhyUeL0qzKP6yCBkLMERaHnkqr3QvR1lWcs I66l+1vPReb1lbFiMQC5mh9s5zYxiBXf4ie7ib0suHuI3gCSN3Hth8dHlMp+BQJfzT3MJx 1Jhm8iCJrDp7jWS7prQJUyzvh/X0/Ts= X-Stat-Signature: r3sp51xk181or7oxri11toaspanmpnqz X-Rspamd-Queue-Id: 6D8464000E X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=wuU7XVHL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=YB6v5qE6; spf=pass (imf01.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam05 X-HE-Tag: 1669762268-956462 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert prep_new_huge_page() and __prep_compound_gigantic_page() to folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 63 +++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5e580ab834c3..f61b4eb58cde 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1789,29 +1789,27 @@ static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) set_hugetlb_cgroup_rsvd(folio, NULL); } -static void prep_new_huge_page(struct hstate *h, struct page *page, int nid) +static void prep_new_hugetlb_folio(struct hstate *h, struct folio *folio, int nid) { - struct folio *folio = page_folio(page); - __prep_new_hugetlb_folio(h, folio); spin_lock_irq(&hugetlb_lock); __prep_account_new_huge_page(h, nid); spin_unlock_irq(&hugetlb_lock); } -static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, - bool demote) +static bool __prep_compound_gigantic_folio(struct folio *folio, + unsigned int order, bool demote) { int i, j; int nr_pages = 1 << order; struct page *p; - /* we rely on prep_new_huge_page to set the destructor */ - set_compound_order(page, order); - __ClearPageReserved(page); - __SetPageHead(page); + /* we rely on prep_new_hugetlb_folio to set the destructor */ + folio_set_compound_order(folio, order); + __folio_clear_reserved(folio); + __folio_set_head(folio); for (i = 0; i < nr_pages; i++) { - p = nth_page(page, i); + p = folio_page(folio, i); /* * For gigantic hugepages allocated through bootmem at @@ -1853,43 +1851,41 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order, VM_BUG_ON_PAGE(page_count(p), p); } if (i != 0) - set_compound_head(p, page); + set_compound_head(p, &folio->page); } - atomic_set(compound_mapcount_ptr(page), -1); - atomic_set(subpages_mapcount_ptr(page), 0); - atomic_set(compound_pincount_ptr(page), 0); + atomic_set(folio_mapcount_ptr(folio), -1); + atomic_set(folio_subpages_mapcount_ptr(folio), 0); + atomic_set(folio_pincount_ptr(folio), 0); return true; out_error: /* undo page modifications made above */ for (j = 0; j < i; j++) { - p = nth_page(page, j); + p = folio_page(folio, j); if (j != 0) clear_compound_head(p); set_page_refcounted(p); } /* need to clear PG_reserved on remaining tail pages */ for (; j < nr_pages; j++) { - p = nth_page(page, j); + p = folio_page(folio, j); __ClearPageReserved(p); } - set_compound_order(page, 0); -#ifdef CONFIG_64BIT - page[1].compound_nr = 0; -#endif - __ClearPageHead(page); + folio_set_compound_order(folio, 0); + __folio_clear_head(folio); return false; } -static bool prep_compound_gigantic_page(struct page *page, unsigned int order) +static bool prep_compound_gigantic_folio(struct folio *folio, + unsigned int order) { - return __prep_compound_gigantic_page(page, order, false); + return __prep_compound_gigantic_folio(folio, order, false); } -static bool prep_compound_gigantic_page_for_demote(struct page *page, +static bool prep_compound_gigantic_folio_for_demote(struct folio *folio, unsigned int order) { - return __prep_compound_gigantic_page(page, order, true); + return __prep_compound_gigantic_folio(folio, order, true); } /* @@ -2041,7 +2037,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, return NULL; folio = page_folio(page); if (hstate_is_gigantic(h)) { - if (!prep_compound_gigantic_page(page, huge_page_order(h))) { + if (!prep_compound_gigantic_folio(folio, huge_page_order(h))) { /* * Rare failure to convert pages to compound page. * Free pages and try again - ONCE! @@ -2054,7 +2050,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, return NULL; } } - prep_new_huge_page(h, page, page_to_nid(page)); + prep_new_hugetlb_folio(h, folio, folio_nid(folio)); return page; } @@ -3058,10 +3054,10 @@ static void __init gather_bootmem_prealloc(void) struct hstate *h = m->hstate; VM_BUG_ON(!hstate_is_gigantic(h)); - WARN_ON(page_count(page) != 1); - if (prep_compound_gigantic_page(page, huge_page_order(h))) { - WARN_ON(PageReserved(page)); - prep_new_huge_page(h, page, page_to_nid(page)); + WARN_ON(folio_ref_count(folio) != 1); + if (prep_compound_gigantic_folio(folio, huge_page_order(h))) { + WARN_ON(folio_test_reserved(folio)); + prep_new_hugetlb_folio(h, folio, folio_nid(folio)); free_huge_page(page); /* add to the hugepage allocator */ } else { /* VERY unlikely inflated ref count on a tail page */ @@ -3480,13 +3476,14 @@ static int demote_free_huge_page(struct hstate *h, struct page *page) 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); if (hstate_is_gigantic(target_hstate)) - prep_compound_gigantic_page_for_demote(subpage, + prep_compound_gigantic_folio_for_demote(folio, target_hstate->order); else prep_compound_page(subpage, target_hstate->order); set_page_private(subpage, 0); - prep_new_huge_page(target_hstate, subpage, nid); + prep_new_hugetlb_folio(target_hstate, folio, nid); free_huge_page(subpage); } mutex_unlock(&target_hstate->resize_lock); From patchwork Tue Nov 29 22:50:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13059288 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 443B3C4321E for ; Tue, 29 Nov 2022 22:51:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DED5E6B0081; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D770A6B0082; Tue, 29 Nov 2022 17:51:12 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B51F68E0001; Tue, 29 Nov 2022 17:51:12 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 8B9996B0081 for ; Tue, 29 Nov 2022 17:51:12 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5BDC4160816 for ; Tue, 29 Nov 2022 22:51:12 +0000 (UTC) X-FDA: 80187977184.19.570B150 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf01.hostedemail.com (Postfix) with ESMTP id CCB4D40002 for ; Tue, 29 Nov 2022 22:51:08 +0000 (UTC) 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 2ATMDeUa030099; Tue, 29 Nov 2022 22:51:00 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=/nyUBV653HdMfEXofdg4opZvn8EmjMhZwLoDr0pH2UQ=; b=KU0B0UMhy+EZfFttGJw2vZjbMTx/WL4K/1XtkdPMohUdEp0Mj9XGB8rFWWSPpsGDg5d3 aU7BMg4Je802/FmKwyozBPv2PJraHgO+Nz+d7GsrFEfpK/0+lh1qTVOlZeIT3DiG8deI IgtbLVlftGLdKseEfkX/z1W20FdgeMMDKsEt4FPeUg1LAw4GbhvayoBDH93ySsnIx553 Y3wLEupPr/UuyPBQGDPFB3SDbV0vTqKq/ALDbtCft812DtXlbXUKoOl3yhHZBX0gdwQK 7iP+vC67hAXQzrcqRSCPLZWKDOG99LxIjdGrvd7WfdyfGypVchbB3yytwOaVJqp5dzZg WQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3m3adt8g2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:51:00 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2ATLIULN028067; Tue, 29 Nov 2022 22:50:59 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3m39881gw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 29 Nov 2022 22:50:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JAOfcyI/6DEduTw9JaSEPlqDy8jaXkeD3OAJzcjFmyhya1RNyLxD4piWnR0tOyFnUB6ZR+yInsR7AVLL25SXMXw4Lutu86ukwL8V3WDP1SVofJIRiQl6uRKXNIUHWox6tr/8Md0Hqvi2FUVfqVgdVlcGrMzi02jNRorHpzXRP9f/CRG1MyGhT6Yx8rw230b1a3bJfuhbnfbKhfhWtM6i0CPiVlQSPYKMs6/VEt5zplczmbAQwe+wwzVmvrvCXwYiUD8AvjlD9bDPCM3UfSUPIJaC7Snjo4iIAQmHsz5hIIqssRgUuBozLGMxAXV6GIor22/ZRJxeEBYvhxt5apjpZA== 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=/nyUBV653HdMfEXofdg4opZvn8EmjMhZwLoDr0pH2UQ=; b=gtxPqGR1YcNtxIllcaDoIxMK1Yi8WgSzjIZS3V2SVXL7iGIehszcUHwKke2iQCxvKwjNkN8uY+U/Fmf/m82XvMR7A/CugG+/GhaynqcATXuV5a84sHD5vkVpI9uXrfE4tguJvhsBiofuKBXhM8v86+UA0r6oR5mNGFfefIPp0pxbuLmZQ9jpOX3RClvSrieYJ56fu8csbe9bMlxiI3uX7PjdtqEjeR0JO4QlS5GwX+uzwVWW2AE9nutDJdWtXXRfSjDbYrPe3g10Pij380+s3GLCNPxBz0790BHQJ3BMWRm0CNR2ih8S6lEiCYQO5U0eudqf7wlGBugPSAJXrIkIeQ== 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=/nyUBV653HdMfEXofdg4opZvn8EmjMhZwLoDr0pH2UQ=; b=yJmcZByX+oSHbbAu6uSlkcapXnp1AwWaJy7MN7B1HnaSw37ksB4a8Z7DGoI2qKmBVoHJQ9HtvRHGlm4PooZ248lCpwrnBLVaLHcSGT/BohVIkGHVcOqqkuAZTk8DUlG96NEygtMf+wgXqLl/Qhux0PnH7o3lf36FNsBEQzfSlBU= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by CO6PR10MB5586.namprd10.prod.outlook.com (2603:10b6:303:145::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 22:50:57 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::3702:7db0:8917:9954%5]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 22:50:57 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, hughd@google.com, tsahu@linux.ibm.com, jhubbard@nvidia.com, david@redhat.com, Sidhartha Kumar , Wei Chen , Rasmus Villemoes Subject: [PATCH mm-unstable v5 10/10] mm/hugetlb: change hugetlb allocation functions to return a folio Date: Tue, 29 Nov 2022 14:50:39 -0800 Message-Id: <20221129225039.82257-11-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221129225039.82257-1-sidhartha.kumar@oracle.com> References: <20221129225039.82257-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR04CA0078.namprd04.prod.outlook.com (2603:10b6:610:74::23) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|CO6PR10MB5586:EE_ X-MS-Office365-Filtering-Correlation-Id: 456aa78b-29ea-4205-c064-08dad25c2d8f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: twHrm7wf0jDnu/x5iGDnpf0YoZC9HBdjCAJqKIces/7QCrm2GHRl5aHXyebdC3aBJMGhvF081fkLpg+QyGIDTsTX9bp1ThbJCY8zQmQ9kgxMnTTap3ysXMa0rGi5lDuNBF1NVMpPFA2darBlrC7xiHmu/eu1SEbNznvil+6JReyTdMJ9Cx2MrbGpk9HjFEuosXBvr8vWZwPxtJqx42IAeSwBSI82CtbQCQW3NcUtgMk2q7bUE9EuSzqXG0pk7m0EoD4vKt+ycu8h+Pc/RVEb3zrcRyvckAP+/2hhZaDkgwUKlygnAMwv7N+XO4ouady1bfMxdYbUBeauhCFG1PvEyW6GbASjtei1bb3262ntJZBz0Jo80QW99qnPKYn69ACRrxDsKnQWY4t4V5+Vx5zvmhTSbAQk3Tfu04TkhQammdC9kR+g7bZ4P62Qd+CiBZFj3rlQLGX/QVB1qQlLbM8ome2+cm7W22uF6u8youhe6UzBkA0FRgYUuWymj2BwwR5hnQuFPbiN4DwTmaDWs3SHsuiavpgJAueAN9Z22OZJPhAbcVS8nurnWOm/CK04VNvbVDOF1CsrAVW1BZsxMv0pqpwx41ayCdXQTLaiH188iDS1cKqpOa/FEQmATV+2U+kdEYC2CNpm1T3aVS4ay/Gy2g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(346002)(366004)(39860400002)(136003)(396003)(451199015)(2906002)(30864003)(2616005)(6486002)(186003)(41300700001)(1076003)(478600001)(36756003)(6512007)(86362001)(26005)(7416002)(83380400001)(38100700002)(6506007)(8676002)(66556008)(66476007)(4326008)(54906003)(6666004)(44832011)(316002)(66946007)(5660300002)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FSyG+LPhijQCO8iLthrdzP52zqx3Mi2OyFEI2prRNpi05JgFl5tzvS4fAgzKulT5lEo/Q+L+Za3XsSu6fpjkI21dzeRQ9X2GE8YkU/d50CqgxxztF5vr2HC5YCNkcH1g6S/eJVocFTy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ldYMJR8ffyw3nGxZD4CZslMH8iLBt7r9WARk0Gge/UbbADqtLU7Sqwer1fqswiioEzU/6yIYxjrHs5rA+LrNBQ6wLSV+vROurObOH/679sDaJTVK/2gob643XVZqDopS9hmtGI5Y76KKdQZEh+x1JaYTUnpMIqap5mKbWyCVdKnz8+0vDfamRpyg2x2mnsf3+YjVIkSJDFgvmyJXxTOOFuvh0dYibd88PxbWBiPcw2Oz2+s7jehYaMmI9zQrtINI0DeUT6+0LFrTJcEYy8WLyCkg8UacM0kGkQIm+8rZ56V5KR3/q056OglQm9Ze1WD7bFR1lBPoqPGF6e2gNACWqxsbHXaf1D88OxwMff7o893PqQPz0aalaoDdOepbFbgG3MwiPI0dHftuA9QK+s0BU9TeugWEZZcEkVSuZGSWcPvNSod4aa51kVbDvVrbS/fzH9Ftgb1wWR7ms9OTMogsBVZRUCGwWVKO5B1ZL5T5E3WW3tysiknNC+kjFIJ7aBB8Njrgx3pg+G05eD3gbmXGlopkVjT5ek+P48CZLj0U8FMjKi43E6UbvGWxFwocJmHEuGYAqMA19jnlCvkEwAgQoEhLjyaUKqIuESpVtWHtnWidTm/uZCs X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 456aa78b-29ea-4205-c064-08dad25c2d8f X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 22:50:57.0659 (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: l6qrMS49xHc/gPNLCWI7tv5r8t4/S+CvTAtuCpgZqq9+Dre4fGthvYVSYUI8U1LmJhBXmH7DWABk1SNy19w5EvIWCX0SMHJIgNg9QlK/hmY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR10MB5586 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-29_13,2022-11-29_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211290137 X-Proofpoint-ORIG-GUID: AIdDRBPvLcSbCh6jv90sP7bi71BmET4G X-Proofpoint-GUID: AIdDRBPvLcSbCh6jv90sP7bi71BmET4G ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1669762268; a=rsa-sha256; cv=pass; b=ZBVXBXIB2GKkLrem8ukc/AT17qr3MCGVt7yk8aJfvK2GJHzGeb7oiuOHdJ1ZbQxVa6Xdge CHha0KhNQQ5d+rY+UfWJ3Z8wzWfnWbhcJJD4lILQAmx5M5nhTt0N9fm7JN39AlJC5PQHku bxsE5h/b7b++C8J3CFkcquqA+lDaClA= ARC-Authentication-Results: i=2; imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=KU0B0UMh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=yJmcZByX; spf=pass (imf01.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669762268; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/nyUBV653HdMfEXofdg4opZvn8EmjMhZwLoDr0pH2UQ=; b=5ahR40EfmYsubFhErHEvQI+RIi2RlzUre2nX66+BHvE8dZ8ITvshGqPjO2pIaHFqxh86Br y8xT9OOfbSTGdMv6oxvTqivrK8TL1wuoy+IV4HceeLqm7eb4gwtjNZO2j+tlY1fyO93XTh agILG5HjeCau3X5CgNBnuO3iKDM7Wjo= X-Stat-Signature: b6wh7roqx3pte45uwcbfziswgkuqtjyp X-Rspamd-Queue-Id: CCB4D40002 X-Rspam-User: Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=KU0B0UMh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=yJmcZByX; spf=pass (imf01.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam05 X-HE-Tag: 1669762268-132134 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Many hugetlb allocation helper functions have now been converting to folios, update their higher level callers to be compatible with folios. alloc_pool_huge_page is reorganized to avoid a smatch warning reporting the folio variable is unintialized. Signed-off-by: Sidhartha Kumar Reported-by: Wei Chen Suggested-by: John Hubbard Suggested-by: Rasmus Villemoes Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 120 ++++++++++++++++++++++++--------------------------- 1 file changed, 57 insertions(+), 63 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f61b4eb58cde..944e1222ea7f 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1378,23 +1378,23 @@ static void free_gigantic_folio(struct folio *folio, unsigned int order) } #ifdef CONFIG_CONTIG_ALLOC -static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, +static struct folio *alloc_gigantic_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nodemask) { + struct page *page; unsigned long nr_pages = pages_per_huge_page(h); if (nid == NUMA_NO_NODE) nid = numa_mem_id(); #ifdef CONFIG_CMA { - struct page *page; int node; if (hugetlb_cma[nid]) { page = cma_alloc(hugetlb_cma[nid], nr_pages, huge_page_order(h), true); if (page) - return page; + return page_folio(page); } if (!(gfp_mask & __GFP_THISNODE)) { @@ -1405,17 +1405,18 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, page = cma_alloc(hugetlb_cma[node], nr_pages, huge_page_order(h), true); if (page) - return page; + return page_folio(page); } } } #endif - return alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask); + page = alloc_contig_pages(nr_pages, gfp_mask, nid, nodemask); + return page ? page_folio(page) : NULL; } #else /* !CONFIG_CONTIG_ALLOC */ -static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, +static struct folio *alloc_gigantic_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nodemask) { return NULL; @@ -1423,7 +1424,7 @@ static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, #endif /* CONFIG_CONTIG_ALLOC */ #else /* !CONFIG_ARCH_HAS_GIGANTIC_PAGE */ -static struct page *alloc_gigantic_page(struct hstate *h, gfp_t gfp_mask, +static struct folio *alloc_gigantic_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nodemask) { return NULL; @@ -1950,7 +1951,7 @@ pgoff_t hugetlb_basepage_index(struct page *page) return (index << compound_order(page_head)) + compound_idx; } -static struct page *alloc_buddy_huge_page(struct hstate *h, +static struct folio *alloc_buddy_hugetlb_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask, nodemask_t *node_alloc_noretry) { @@ -1988,11 +1989,6 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, page = NULL; } - if (page) - __count_vm_event(HTLB_BUDDY_PGALLOC); - else - __count_vm_event(HTLB_BUDDY_PGALLOC_FAIL); - /* * If we did not specify __GFP_RETRY_MAYFAIL, but still got a page this * indicates an overall state change. Clear bit so that we resume @@ -2009,7 +2005,13 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, if (node_alloc_noretry && !page && alloc_try_hard) node_set(nid, *node_alloc_noretry); - return page; + if (!page) { + __count_vm_event(HTLB_BUDDY_PGALLOC_FAIL); + return NULL; + } + + __count_vm_event(HTLB_BUDDY_PGALLOC); + return page_folio(page); } /* @@ -2019,23 +2021,21 @@ static struct page *alloc_buddy_huge_page(struct hstate *h, * Note that returned page is 'frozen': ref count of head page and all tail * pages is zero. */ -static struct page *alloc_fresh_huge_page(struct hstate *h, +static struct folio *alloc_fresh_hugetlb_folio(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask, nodemask_t *node_alloc_noretry) { - struct page *page; struct folio *folio; bool retry = false; retry: if (hstate_is_gigantic(h)) - page = alloc_gigantic_page(h, gfp_mask, nid, nmask); + folio = alloc_gigantic_folio(h, gfp_mask, nid, nmask); else - page = alloc_buddy_huge_page(h, gfp_mask, + folio = alloc_buddy_hugetlb_folio(h, gfp_mask, nid, nmask, node_alloc_noretry); - if (!page) + if (!folio) return NULL; - folio = page_folio(page); if (hstate_is_gigantic(h)) { if (!prep_compound_gigantic_folio(folio, huge_page_order(h))) { /* @@ -2052,7 +2052,7 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, } prep_new_hugetlb_folio(h, folio, folio_nid(folio)); - return page; + return folio; } /* @@ -2062,23 +2062,20 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, static int alloc_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed, nodemask_t *node_alloc_noretry) { - struct page *page; + struct folio *folio; int nr_nodes, node; gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { - page = alloc_fresh_huge_page(h, gfp_mask, node, nodes_allowed, - node_alloc_noretry); - if (page) - break; + folio = alloc_fresh_hugetlb_folio(h, gfp_mask, node, + nodes_allowed, node_alloc_noretry); + if (folio) { + free_huge_page(&folio->page); /* free it into the hugepage allocator */ + return 1; + } } - if (!page) - return 0; - - free_huge_page(page); /* free it into the hugepage allocator */ - - return 1; + return 0; } /* @@ -2237,7 +2234,7 @@ int dissolve_free_huge_pages(unsigned long start_pfn, unsigned long end_pfn) static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask) { - struct page *page = NULL; + struct folio *folio = NULL; if (hstate_is_gigantic(h)) return NULL; @@ -2247,8 +2244,8 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, goto out_unlock; spin_unlock_irq(&hugetlb_lock); - page = alloc_fresh_huge_page(h, gfp_mask, nid, nmask, NULL); - if (!page) + folio = alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, NULL); + if (!folio) return NULL; spin_lock_irq(&hugetlb_lock); @@ -2260,43 +2257,42 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, * codeflow */ if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) { - SetHPageTemporary(page); + folio_set_hugetlb_temporary(folio); spin_unlock_irq(&hugetlb_lock); - free_huge_page(page); + free_huge_page(&folio->page); return NULL; } h->surplus_huge_pages++; - h->surplus_huge_pages_node[page_to_nid(page)]++; + h->surplus_huge_pages_node[folio_nid(folio)]++; out_unlock: spin_unlock_irq(&hugetlb_lock); - return page; + return &folio->page; } static struct page *alloc_migrate_huge_page(struct hstate *h, gfp_t gfp_mask, int nid, nodemask_t *nmask) { - struct page *page; + struct folio *folio; if (hstate_is_gigantic(h)) return NULL; - page = alloc_fresh_huge_page(h, gfp_mask, nid, nmask, NULL); - if (!page) + folio = alloc_fresh_hugetlb_folio(h, gfp_mask, nid, nmask, NULL); + if (!folio) return NULL; /* fresh huge pages are frozen */ - set_page_refcounted(page); - + folio_ref_unfreeze(folio, 1); /* * We do not account these pages as surplus because they are only * temporary and will be released properly on the last reference */ - SetHPageTemporary(page); + folio_set_hugetlb_temporary(folio); - return page; + return &folio->page; } /* @@ -2745,19 +2741,18 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, } /* - * alloc_and_dissolve_huge_page - Allocate a new page and dissolve the old one + * alloc_and_dissolve_hugetlb_folio - Allocate a new folio and dissolve + * the old one * @h: struct hstate old page belongs to - * @old_page: Old page to dissolve + * @old_folio: Old folio to dissolve * @list: List to isolate the page in case we need to * Returns 0 on success, otherwise negated error. */ -static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, - struct list_head *list) +static int alloc_and_dissolve_hugetlb_folio(struct hstate *h, + struct folio *old_folio, struct list_head *list) { gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; - struct folio *old_folio = page_folio(old_page); int nid = folio_nid(old_folio); - struct page *new_page; struct folio *new_folio; int ret = 0; @@ -2768,26 +2763,25 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, * the pool. This simplifies and let us do most of the processing * under the lock. */ - new_page = alloc_buddy_huge_page(h, gfp_mask, nid, NULL, NULL); - if (!new_page) + new_folio = alloc_buddy_hugetlb_folio(h, gfp_mask, nid, NULL, NULL); + if (!new_folio) return -ENOMEM; - new_folio = page_folio(new_page); __prep_new_hugetlb_folio(h, new_folio); retry: spin_lock_irq(&hugetlb_lock); if (!folio_test_hugetlb(old_folio)) { /* - * Freed from under us. Drop new_page too. + * Freed from under us. Drop new_folio too. */ goto free_new; } else if (folio_ref_count(old_folio)) { /* - * Someone has grabbed the page, try to isolate it here. + * Someone has grabbed the folio, try to isolate it here. * Fail with -EBUSY if not possible. */ spin_unlock_irq(&hugetlb_lock); - ret = isolate_hugetlb(old_page, list); + ret = isolate_hugetlb(&old_folio->page, list); spin_lock_irq(&hugetlb_lock); goto free_new; } else if (!folio_test_hugetlb_freed(old_folio)) { @@ -2865,7 +2859,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) if (folio_ref_count(folio) && !isolate_hugetlb(&folio->page, list)) ret = 0; else if (!folio_ref_count(folio)) - ret = alloc_and_dissolve_huge_page(h, &folio->page, list); + ret = alloc_and_dissolve_hugetlb_folio(h, folio, list); return ret; } @@ -3083,14 +3077,14 @@ static void __init hugetlb_hstate_alloc_pages_onenode(struct hstate *h, int nid) if (!alloc_bootmem_huge_page(h, nid)) break; } else { - struct page *page; + struct folio *folio; gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; - page = alloc_fresh_huge_page(h, gfp_mask, nid, + folio = alloc_fresh_hugetlb_folio(h, gfp_mask, nid, &node_states[N_MEMORY], NULL); - if (!page) + if (!folio) break; - free_huge_page(page); /* free it into the hugepage allocator */ + free_huge_page(&folio->page); /* free it into the hugepage allocator */ } cond_resched(); }