From patchwork Wed Jan 25 17:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48220 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386326wrn; Wed, 25 Jan 2023 09:12:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXuRbwfXbV8mCNeOv0stIKwVFLK1ptDMp5fqvJ7+rhtwesharMQ8WjXlXqL/AMviGoV7bf9l X-Received: by 2002:a17:906:af94:b0:86d:bbf9:302 with SMTP id mj20-20020a170906af9400b0086dbbf90302mr33149181ejb.20.1674666747959; Wed, 25 Jan 2023 09:12:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666747; cv=pass; d=google.com; s=arc-20160816; b=N6a3ij+uIC4ircKRXwc5uIbZB8QQO4Y2mX0Y1BylppHV/uiiOPpdY3wLHjkEAuV1aK KpEXpE6PH7UNKUqtlh9d55l7Yxg4XuOWeGt2pyu1xoLh40FJJhEeSynvh7GXqQEqzZoW 9LwzT0rlsUeyGRPxZ5/ecVzGgeAK7etDgbVd+92oxKgRPSchcVCeD7iQn0tuZtFSi90j NNMVliIQ5JDXsLd3Z1A1HgLjIigSluIXgJg8dDQY0OfULoEHShQuF3lPEKEFEo8QnRS3 QMq87cyaH6zRp22mQKxFwVbeJ5EByInc74YRiA0jEFmbVEIrwUdQEdBQIAskQzA+nKP/ fEkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=FuKqU3tpaSnajZkNaRIGqAzKJKpT/btmBFjpJmZHAPkvANPPb9MaNww5dNNtu0aMzW ioUhAvVZ8cV7syRzVUn+AuuQypyeXOuwfMiCRBgv1l+mz/SzAKeZc+AsaU2jJf78dL1o nN8rU2OmRaCieM2xPLBVZ4E2cXaoRvy1iUXyB0olu932XslTNIY1O0SGYECIPfhtqGvz OPSAHKja2bbjU6cu4wiuSUAlPw3iVmr38H9Z5QV26jIshySgUyksJFodx8XtcB6A7MEk VG7bOpDbjsYEmoTPZzufTYzNFrLghgWC/4u2LzzBWqVK8tz9C5RXRcAlbGyxU5WXMGFA FqUg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=weBAscDq; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pdR7EP4Z; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d3-20020a17090692c300b00872baebe5ddsi6263932ejx.978.2023.01.25.09.12.03; Wed, 25 Jan 2023 09:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=weBAscDq; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pdR7EP4Z; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235996AbjAYRGT (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbjAYRGO (ORCPT ); Wed, 25 Jan 2023 12:06:14 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 343DF83CC for ; Wed, 25 Jan 2023 09:06:13 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNkq3030139; Wed, 25 Jan 2023 17:05: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=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=weBAscDqaZV/8NAMqJMNfZOp5wFLCjfImg8Dkcv7A64J1PUt1qQj2ITGpdaCJFyUS+PR aTNX/PfVx8/AbJrH56mIXvH6BqU6qTOrwLVHK6zpQAoiuflQbtIKDHnIfhjVHwycc23g ffXYldvMh2cMu4MyuCAlFaNFdmu4zfdkuWnjk3H/BW/jwNu0AqaGu21iZAWYvGO9aCkB nWaaGsxDyyqxYKkqzhDE8kmxRWNPHQ+c+MaD4wMEb5Zh1Lj0IiE2Zw76ocDpVNXhQ9ZP 9BWKwks2Q0Ry8fnLoKLaaGf/l5Y3KTMf9AqMw07hpcxpAXp4dgdWdhXyWh65jcSJWkmW lw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u30hmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:51 +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 30PGC4Ur025091; Wed, 25 Jan 2023 17:05:51 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gdnbf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fiRTkGqsWH51E5mo04DLC+Vj/7zYmwcQBme1+OeGjBU5C6QN2o0jx4kkH/zUu3thJqozKPrQFlt18uND5D88YflAPwOZW/1wGA/FpQEkRp60JcW3xA+gxOzJfqlms6fRERrxj+dgMzYaon/haqZ7C4EmChZR2ZPM8GGiXxQJIVBnEhWEcs5TU6lJLqDTlINUNTQZ2ECtkK0ONsLWt+5o/pyY2vofs6/nKm7gCumzzuhK60kYLcKdTBQi74bNJ4KHAjQvX9T3UHuit4/VQe7uaDLk2N4+CcoDIoecW4DA6um86SPYgAL0DAb7xfINRA26IwZm531SN1PxSxb/fm3tuQ== 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=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=iOnpOwVAMU2/R27Al7uTUaTjngv21mC8KTP5mnwXhutu0OpKn5gZOJRyayp9IrqiRcIjfSsPVXltyqphUo47fG6LgxVV+VcZVZ5M2lyKN2SJqe2Met2XhE9xUYnOZvjQFHJUksaDuC/uCYDxxZQGJHUvoqr772wKt2EqY5U0DklxNy/jv0dR2NjEv5qID/JrIKNRX0hqgnwrc9tM0nEpNfw00GbCeiwKZBqiwDFMl7Kj1KmEdqGowdf7fLgxNmNV2E6pbnUB9J5EMh4p9U/StzLWHSM/bYfx8gxLIf/7NPnwr37SMptH2jNHsVHPAcyy6vrp0h/r2boNlp4tAwkKmA== 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=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=pdR7EP4Z21NkbT+Nwx6V9q4hJFgneZBjGe3RNQ8FY0vpfZdZAHgD2/Bcl7W3LtdjAzD7J2Iyzo+eGPjp0Pbw7q6QARFCry+/slJctg0L9rTouH0B69/FcTE1ivxuyvZYkOGzegPvI53wNTBYQEvBn8fUoQCsV0BGWn8BTraBr8Q= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:49 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:49 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 1/8] mm/hugetlb: convert hugetlb_install_page to folios Date: Wed, 25 Jan 2023 09:05:30 -0800 Message-Id: <20230125170537.96973-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0007.namprd05.prod.outlook.com (2603:10b6:a03:254::12) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 612d9d1e-082b-47b2-160f-08dafef66831 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tVYIDJKxjxX1ITFVMbfPZh0tHM/gIPi/lSsQjnZv0N9QK+7SoPly57I4GlBNdf4yuYBM+Si6l33yv1UqdBQRaSLVvq7zuAgwsrN1mAAW/MAF9vFwc2ifEB7fTflmBHq+H8ZeGCBxRPPwkw974Q1R/gfKq89GCiuXKdiVlomQW0VHG1nHyYAP7TCccMHeAK4Nx/6ONG7MYYZ407/X0CHBEe1rd4MbMGecB6bSqrB8pB1q2Xih0Co5tbEaMmUruvPMRA8BC+dV4UEGdAA6hfObSBiUP9UfZA5N4r2UW74DN13gTWl6cSkims+APqK0p0wFz81YXqDFxTxfZJb45lbkSRhdN9wKq06bmAzd8Gu0I9M66XtRCJQGiY0Pr2FT+UiT/G+kse0C6SOS1ddRF974e0U/qLoeEoRek9diCk4/SWUC27QsQ+QmrQJxwtPrLCf59DUK90ES/m8XpNOjJxIu7HVAbmMnX2OOmZ9jzOtdzfaMyxEarBFCFQkYYGMRcrvezwdORmS9CIMhrtbqiD1EXrIelTc5p0cxVrL7yV9U5nTDOSDDpBa2dVHLBlcLBjn/sJJ3UMVQuYa1eR3gV+DLKT/Od1a8MVvE2f28PIvhAB9NdOE4ib4FfG9Y2eKIUIQuS9P2s/eqYvpR2C4Ka96gCA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zdYH2L9NW2lIHJSHRXOEz4gUWJ02FiE4oEtOent2Nb0F7blbmTpeZ5wMP8P4bvNulgS55AhZhWUTDcSMlZGQRiqXyzR/R/YqgJ47gw4RwkeQbc69JOFjMCnD5QSKu34NdEb8gMo+bNcGDReMM8QpEHSRx5dJ4f+ksk1Kn4ApV7I3EDlcYiX39lWOW0oYSMtP6+J7sap1rXZaCUjD88c7Rgum9h1hGd+X9tXQy54Ew8+XGOc7nx8eRNTEaFoig2VVkMy1sjRZiPZ4KHTq3RRn/iUPazeFgWU8nL7qkM2jZE/LfZgAWiBqsLGgHyNVGej2ZmCUEuCz/jWdZ4qOzhzAr9oppmtlwg7ZaoMc/51MdZbivW8CDDnR2vYItq30tH5Lr+uAyqilc8mwF0p8vwHb2yyKAnFqE3urJf9o2McbsUVHAZcO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dAchJ1nNu8OAjrD96R4i4jE46lDBvFn2XjNVywYhowL214CVOk8BdvB80fclqVtt5KJwjuhxcX4ZkB/gnJ+PFT2fx4uR5RhgPmrwyQsUOPQDsSWtSFfI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 612d9d1e-082b-47b2-160f-08dafef66831 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:49.1522 (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: pK9CZ+aXwKBidi7Tto+6eXjw9PldWKZTvLOI9WxmGcY5U6JmNpIcm5YxvscjczIz7yhjUiOVMNgFtvan8p130CzU+EGGu3K2dbjIMVv2vv4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: IcBZ1j0OaSwGt-kMqukEJkwn7--uYOsb X-Proofpoint-ORIG-GUID: IcBZ1j0OaSwGt-kMqukEJkwn7--uYOsb X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015359996135882?= X-GMAIL-MSGID: =?utf-8?q?1756015359996135882?= Change hugetlb_install_page() to hugetlb_install_folio(). This reduces one user of the Huge Page flag macros which take in a page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d20c8b09890e..849206e94742 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4946,14 +4946,14 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) } static void -hugetlb_install_page(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr, - struct page *new_page) +hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr, + struct folio *new_folio) { - __SetPageUptodate(new_page); - hugepage_add_new_anon_rmap(new_page, vma, addr); - set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, new_page, 1)); + __folio_mark_uptodate(new_folio); + hugepage_add_new_anon_rmap(&new_folio->page, vma, addr); + set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, &new_folio->page, 1)); hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm); - SetHPageMigratable(new_page); + folio_set_hugetlb_migratable(new_folio); } int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, @@ -5107,7 +5107,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, /* huge_ptep of dst_pte won't change as in child */ goto again; } - hugetlb_install_page(dst_vma, dst_pte, addr, new); + hugetlb_install_folio(dst_vma, dst_pte, addr, page_folio(new)); spin_unlock(src_ptl); spin_unlock(dst_ptl); continue; From patchwork Wed Jan 25 17:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48221 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386327wrn; Wed, 25 Jan 2023 09:12:28 -0800 (PST) X-Google-Smtp-Source: AMrXdXvxqLJigEN9394sklghB26uc35ztqL+ZBOtc68cB48COcihcVvtXSY8wwFPlKX0NCx0lewG X-Received: by 2002:a17:906:7185:b0:81b:fc79:be51 with SMTP id h5-20020a170906718500b0081bfc79be51mr33203225ejk.50.1674666747980; Wed, 25 Jan 2023 09:12:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666747; cv=pass; d=google.com; s=arc-20160816; b=tLgX3XUutYo/BxqYgiVFPMdGiNAv1MVTyKphhjDFT6bGakiygAOP4vo1cmqOn6vNGD av2nILC5ydbZB7KD+SEOKYDIFPZRlVgXjJ7KtBZDBIEE8C/uucfYbIaIhq2H00NC365n SqfZ4gZ/1KwqSjSrb8mfsMAq9slnr29yIZVAyNj7pxlbtLpsfPpzIQ6flAyJPfnDx2kE KMWVKPkz6xImyHDJBIoZjb90s1fJRmKzxXUwGNw7xr+iZkgEyHw7fFBhiKks3FsYEFxE VqfzuPiuX1scJC19zWMeO4kgfYIHHeq9dgpbrQn8JZkomRr9wJEBgkR8oQJGVsPM3tRc EOEA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=khtahNz7PT+trge+4vcrFELp8oQq7Cr8jA3S5OMG+nE7300nFyOr5fXWs65hgmwPMh EzrKjoHlSPiu2RC/zGr6oKGcuCj7nFHIrGoJZvODt5JNy6emZcfplFN/MWF5PA0iQd5C Jusc7paGfMr4P2dno+QRFFxBEYeGMx1uLOdaR6t3RH9iA5YniTwe8sKvpvuGi4zdbvj+ igrHwkibQ7McKHkOcQDLA/maU2qEwoLRlSEfAetI7eQrsbN0xupv3DJkB+7C1U+h4SuR B6ypRuwYjfOWc3HS7qO083Ec7GJStkdZwPBm5X2Ed3Mbf7FInDEqxF9atzrT/sGGfI4h ZUMQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a170906224f00b0084d4730001asi6764325ejr.89.2023.01.25.09.12.03; Wed, 25 Jan 2023 09:12:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235822AbjAYRG1 (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235859AbjAYRGX (ORCPT ); Wed, 25 Jan 2023 12:06:23 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 360DE59B4C for ; Wed, 25 Jan 2023 09:06:20 -0800 (PST) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFQ7nM029151; Wed, 25 Jan 2023 17:05:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=qqwDUn7pjd4SAw4vIsCzQGgdiTvQlp3SyfQUqV/vqJbb4t3+R027AzXFB/1Q6lfhh0eQ bezbtha+MC2vVrEdRa+/H2oKtJGlDFSkbdQ8TADa6rjQAOoqR+GBtozPWFLmNGxnxyYE Lw/Yg0us4RL6TtqIJVwgDFEd+X3Xq9/KsaVjN8HKS0OY8carToqA6M3+U/aXZOxnAApz HgHvc740n5UaACxM/sOdVdzRK/QWqLjp3J0hTdxIDclr1XHGEyRIEn/nrMbciNJT2ZVE Medouw399I6UpycrAF5bCuu6FXZv6HJE16+fuc+2PLMM5OxxDNczw96Q/MEqdRC7J/Xs BQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n88ku0dts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:54 +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 30PGGUXF034229; Wed, 25 Jan 2023 17:05:53 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6tsq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3E7m6wmbp2JkFAaDQyZowX8XHkUMpisMmHAk9kF/wXYM+i+EXDaPHjMNGKEy2n08AG/tCjfNAI4dWEHK52f35OIYWfr+//HqiWMbiladbx3ARVfzwX8bqap2e+qgeudrx1eUmjHngzoVbg+kDytMak6xaxA+pL59TQNvRtRslq0SIjCakV045xbjJWGAJ0MH2LxrRgdYZKDxlrtieTmfMX+8QIeGX25z/rLfVA00vC1DwLmQNYaRGwG9UxkW5vhimZjaD+b8jFvvkEVwhZ1CRNR2K9MUZ2Uxue3Vwb54JMSaXUXhI6S055uOdrMhFJqtYgs6fEyyTqLQ7UsP0OwJA== 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=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=P4tPLbC3Mux5ApNkCS+3ELHezme36v1vWGmu0IUcseb9ic3+yAOpMz2eedN8HTX0jo+SlD64ASt/NYsWk4qw3zSW3gMBKS+KeBY7GDgdD6Z2w7emQHkgpBEbEECkIUxifozfcC1fymNe54TlxNYrL1cIeBFeJIMyqu4rkYMF1lyfR/2+khCJODdt3o7BTByH/xcSUrD+LeeC908/wKReRe3EbMAjHBtvDbNtiSciqtd34jcMAGpHxHtSgyzSb+XNmQoOmoBaRnuEkIvAMqCxizXlVG9zAUAiu886Hw9BamYQXyzMwGa0cgu5iRO9DF7eOIOOdmXONk0yNxk4cEt3lw== 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=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=xfm7MMGkauoejhQzrGTMEBpiXF3gL2srrRapX2BS8oVQF1wJWGrGmn9Odhq/RU1KUmGKMcV/S8U2mqQQzfciTBFBxN0VMdOQB1LcV1RsIon7SjbYjgddT3lDyNWHsiDPr8n+Ej+DS942VmBRQN1d6khBvN93SSIVpqVaqRaJslA= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:51 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:51 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 2/8] mm/hugetlb: convert hugetlbfs_pagecache_present() to folios Date: Wed, 25 Jan 2023 09:05:31 -0800 Message-Id: <20230125170537.96973-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:254::34) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHh4HTrhPWV+gNp3KC1//UeEonEAbQoFsyQbNNelWonqzQaI3y2vJs0kavreh1hxfMd7k3giJA5Js3ApzHOhNwXbbCWtZfEQEAwe1B8RjbF2o7+30zNTmKT77moKyLto091VD+IU9TQMMABHc+u2e8tenMGZSYHkKpOzDKxvUWcMMB0dKwHw/QCCNG22SiZE9MADINwjuGErjNWzBQUUNVQjhTBq3ldjd7SxMLZ5rbfZ1iOoI7yKmW1to1RmdIzXjF4ng4e+u2SHKf2qZkZT51otWHvPm4Sv6UHn3//y6OT2hvLal+E2cRuvwlj9S09mU35MyUHSc8GsNMh1nZxh0/EvTiXgDqMf9MAfhWzP9m+mjCu6uAgJQEWxy6uioAUpA04TK8PJXqZQ/7nJZmscqKFmTyszd8wDTz0vR+jyijaFJ+V+F24z7S7OYkIRnq7kq4w1kVUkSVQm0cSXVMCkeMP10ecYukTT2L+/KaukCQRhEBB48I0f/bnC+FwJQbDgbzsz+V91QQhH4yTO5IJ93KhE7P11kdO1OePBRiBIJq3NMGJBZz8OvkWdl36LB2jOFNAI0rFbTh9IY8WGjkKFazto+Ja4dsFH54z2E7nsbuGIe1/UmJ3Ob7fgmSqgW1P+2TlkaxEpuqpnA92Nn2hVwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lRwKCDUhY0v5II7Rh8aU9MIVFsCZlkjnRuPHUnB5d2+j6oCriw7SNPOEuB8IM1+PR5VNCadMiNzmb4/9mMqTYDsKcUEwU2zGozew+ayGlH2rCmNpmg+pVgjFO5ud9zXymAlyC7jDAtPe+p+F7lI1Ai+VzeOxH90idp6368qxVmP5RHw8Q4PzvbMYZ3I5AnAr6CkjH5lMAZbxockFcgjeecWdaJSsnpLOxFEe3ZXo8NN1F0xZpXEeaayKK1TmyeQ/KXcElBwGFgUxO3SjOP+NodTorrYfDM4DxZeq1cyNw/pSt2mdMzu8WML1G6pdIoaitX1koZbLgg0suWVLkOziiXyipcVxaeTgcsNnltG/S283XqcX6QjnrUizL9Zd4J+UDXIXeOCpY5Js+MqxQV9mHg4Z+EC+OWYyCLEkHvzZGu1papAQ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KxAp8NVzATmbYCZfcbiOHeSNxiiQV1SAJBsiNFjIdHbKXskAriDfzPgt5AHYQSzPQJemIRThcC1+zHznvB1nZ+tnFIbDUUpkVVR3S/bHtq/qPju70LftAg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:51.5283 (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: ha5phOlvjnGgBhLAySqbvJNKXk915/EAvWTmRJYgAyInj0OhhpdeJsR+f1jG3SjvH8Yj871ueEUk6NAb6XKfPK0w0qmKfxcnxjb6uu8rmaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Proofpoint-ORIG-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015360312958258?= X-GMAIL-MSGID: =?utf-8?q?1756015360312958258?= Refactor hugetlbfs_pagecache_present() to avoid getting and dropping a refcount on a page. Use RCU and page_cache_next_miss() instead. Suggested-by: Matthew Wilcox Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 849206e94742..e506a46b7871 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5651,17 +5651,15 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { - struct address_space *mapping; - pgoff_t idx; - struct page *page; + struct address_space *mapping = vma->vm_file->f_mapping; + pgoff_t idx = vma_hugecache_offset(h, vma, address); + bool present; - mapping = vma->vm_file->f_mapping; - idx = vma_hugecache_offset(h, vma, address); + rcu_read_lock(); + present = page_cache_next_miss(mapping, idx, 1) != idx; + rcu_read_unlock(); - page = find_get_page(mapping, idx); - if (page) - put_page(page); - return page != NULL; + return present; } int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, From patchwork Wed Jan 25 17:05:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48218 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp385566wrn; Wed, 25 Jan 2023 09:11:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXvcfrgpwFcEikP9nKiXO55w7uxx2dl7JFUhcRf13vAe4Qm4Ynu59PwDtgF8w1Qz3gwPAwIs X-Received: by 2002:a05:6402:602:b0:49d:f448:878c with SMTP id n2-20020a056402060200b0049df448878cmr42491772edv.2.1674666671875; Wed, 25 Jan 2023 09:11:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666671; cv=pass; d=google.com; s=arc-20160816; b=LXSQY7Cqjhn0c9kjGHX7eeDqhnEUeE5nIvK5O+DdiRb15YvPjUHhZ2JDXoDPbIb4Km teS1qWX993vo1grslYUPMpHX/vQd0Tt7qpWCc1WguAthU0Oju6zbzRG/5cI/77DrHJoo 9DHrN7ACnpQrRmpO3wE5a65bO3+YDu1mi8V9Tj7E1VfuF4c5KGE5YBySzslXJsuaNsai GwPV4/rKnw/fxuiYVw0l3q0yw5BM3ujUsFZ0eknvQ3t+TW7Jssn1anIXaQCeMySrWvuX cf1MnBn5qdj2On41/fremjVwSzv2RdYje5U6r/eZDemmVKn6Aq5YG+HTsuXFndUsjsmG WQVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=FFRxg2Avr3csujvaK/lG1UEZF0NF0Ey8cuvPQaxXR/kOe7Oq99SOHAsh1r2Gr3MH22 2bkNXgAScEcsDh8y4tsMDUU1J6x4fU6+QgaUWdqmfIUC9nNSCVNQmxv/X/FzStUxYRcp JkwA3X4FPTbJspsxJfWRaXgrc9CCNbFnXl2AkcxSBhzGaCPmVEsnFopnJa3zX4j0TeEh BXf+4gfJ5Jp0Joy8rAtnbmfaDN7HAcxtqolWB97692gL6IrJr9rRqjrj7IIyoef3jRCT lwJoJ3Je50fNzOSBF4PUV5kRfDSyu2KLiPunDc9m4/O9vJlzWPcfoJUOLLIkYaXJVXq6 fyUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=hvMBVF+g; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=R4sxQCaG; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ba10-20020a0564021aca00b0049e4243bcc1si6731068edb.493.2023.01.25.09.10.32; Wed, 25 Jan 2023 09:11:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=hvMBVF+g; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=R4sxQCaG; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235992AbjAYRG3 (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235985AbjAYRGY (ORCPT ); Wed, 25 Jan 2023 12:06:24 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 361D859B4D for ; Wed, 25 Jan 2023 09:06:20 -0800 (PST) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNkKQ030134; Wed, 25 Jan 2023 17:05: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=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=hvMBVF+gs/A/eqnHZGDhEpbeXE6XoyMfgISh+MSjc/o9l6uMBPjxSJFzwXID8/D9cM+7 UUEmyN+GtiqowSMSj36bVsFJOLOSc/UP2OMGS8cADXmdkpQnNDK+7YK8iLjcEOZNfVIA gXW6FSDlSylEkg2NzTnxe+t0QQ9ldMQGQUGOAIFxyOjIXun4zb6n5E4ceq2mn09y449n E5Hb/iXoJazJEqcBluc4znqinoXcc19KG4ETQ7UszaoQ2+mym84m6Z23UnGLCBcaWm9w kVK/IZ2GUHz0Tw37fNBXybvgEGILe+BfoSrKodrYg9lbMhba2rZTB42nhElB5t5xoDgC bg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u30hn1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:57 +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 30PG6rc7009131; Wed, 25 Jan 2023 17:05:57 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g757dh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uz9q85aCf0xJUJKEksmbg5MAMo9M+DpZ7RhrT7bRg7/yqH/8lMceEcxQofQ7Vz1HbK6HGCk1oqX6E4LlRFRzWDpg/otVpSMDRzRLlMjIaKbnN3Ruf4sf25EUWAhrFAHKZFyL9t9imCqKHPfl9g6y3+UFu7VlDI01oeR+n6++/pvjq9cJYcmF8xC5J0Ryv5edOpsgG1hXbdUHJJaV8N4wL6tqRqKBtODB+dy1bk8ou944RzS9pyJZXH49TcLY07aCWibca4E0LDdmB5zjT6cYPK3TMsC+4fJm1q/naCBhri6ixpXwUrawDlOTyZ7uzrjwNsrr0RhvI1mi7EZXvahZLg== 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=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=UFSzzQWUxRWBuivB0uUMFtmSgwcyisUIfjXklqinpe5yV0pDOr8ETS5S9Y1IVZlTiNzzWvvdLb8dhMG7rtwTCptay3E/W8Ox371+jtg942/dUaxjdNiljZheWqFXuUyxLmitmk5NtmJDZ7wFCiKrdT6uiDOn1OPeuEjA1iRPh5S7AH567ONLSajf7/FkUlaTMQE6yHNIF5+TfLxjMry2i/Ng8r0rEuygg7PlvB+xF0tMVg9hycki7E82wFQmDPw8KdRJT7SLZoxs7ewYEUYPw3t5mSVO3mIEJ0vmk+IOSbtAfCSydNzTe63oLoHaS6aakVPf7M+yeyN9BDS+R0J8nw== 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=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=R4sxQCaGVFWqJoBZVaAb0uMOrpYTO/wK2d1IFItPXaTCJjw3x5cK20S44m4bHEPmoYLTRhe0jwueJJ8bl7nW3I/5BcfJR9+ufPAowQfcmtYY6rUcp/sde3KAicLnFF/ytPNr9CIxE1C+OXO4tGxmisXVgIcHRGQgjyflcqtzDUg= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:54 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05: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, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 3/8] mm/hugetlb: convert putback_active_hugepage to take in a folio Date: Wed, 25 Jan 2023 09:05:32 -0800 Message-Id: <20230125170537.96973-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0041.namprd17.prod.outlook.com (2603:10b6:a03:167::18) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: f89f6fde-83b6-4c7d-f006-08dafef66b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: viDzAjOblUKq7eIsGADRaM/lyXhKv7oOmyiD0pgt1+xyiRYZsGXDofdIiFq66DIAZnk2+aOOGD8b2Kx/gXHIFiawnVkJIx6Xb+QxRNFjLelPhN3WKMZ2CMJh1CwgBlfKL8CQjFmfd7oCugxG1P3jbmrxlewehbKHbOlyr1Ql7YbJR0lbICg2Et7ADiW/YzvU08+r77sN7DD5TqXKV/BfG4UoqTlCjCsqx8/NuS3tyERga9yS3O0Fo4a5tccDTbY/zdNtudLEZqS2P65OGND8/03CNhmbDwzMSY46W7RdzYk/Dx1D0G6GEAiguFpkId9QBD4bXAdgBwkJ98SNQDclgtT3viTMcJ75awPb2B86qUavSl/wQ3NIqd4wJ3G35fvl3O6Fo305imOonG2CBzuXVpufqLefPGn5A/WYJlFsND/84dJ3GNnov4m4yV4ZfemvkTlfKvDeBMO+39xCeLUSsfWbFoF9g2S4rCfShOi6oIZ99LKIb/P7flIMNAZ1koJWPq8PT9XO+shnJQujKymaV4KaOX8tep7dW5q5QlGdwOZu11j5X+EChoVBnuEssxY8Zar1M7x+f2ZXIzXyeEqfUw2jLo1/StleJPA9iXOnYyAPJK52zrVweOlMbZ9OdPdgX5Qh4rJPqVsRwUHU7JiTFw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9sgAYD3gdXxS2CRN9w2rlxC3xGPdd9uuYCRpvYkm6X5on0epumjmGR2ItwphYaBEeHffyb9/lBvqZCDrav/FRxncbMZ6vY1kRuxRDlSfhE8mAMSTWwgD8KspMTPXZmizufSmGc7l0X13+hIHj/KwT99MStWFj9F3LEMM9pnz1Tl9x11xQ8oCv7nyeY5y0LhKX69KRWXqcQvk3OXavNwvQesuZxTr1nUrmsravImCOtUu441AjlUcKVgILnIj+NuW+JXrlSz/cBsX3FcJ3aSFC32cHl+yA4ZbyMDgYFK2kSTEIFQUom3n33DW43Yg5iXBsla4lSbKLcu7tn/7obdBV4Uww1P1Wi2WytmvVc1aDm8OYyqYXoKo0tDmEyFi3e+zqYdiYZocIQBlm4j98Q27nVcUhCze0zio3TTTt08yUNlxkNX9YfU50zbdgVi2gWxafvKdFC2FRlpnMTkkWhNsuaHceFNJV73yQ7BC8gY//VQPV4hD1b4uteOdVtiSMCH1qy8rd7/7ZTF0uRcfMd062vGXWssOJKwIwyMTNBeKWJRqGjT9saEO3mYRWecZR2k6z20MzAdzJpelON0MOpBXJVJMQaMga1l3hZpGtE7yI/UgGxXeHMLyztak5uGR3GA/6QPr5MYehug11ISRYpyBC5imxDTrCpb2U7LdhCnW4LVn51U9NaRj6TPJTseG0WMlQsC8w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Od1+fjPiQZryRT18zkLZYuEtVXrFOEZ0zOpG4OCncr7wvfglq+GVu4kCw5mFvrd0j8oyUPHuvTLXEEyq8fWgvbs4WdMd3CXdj6usPGM9glooVd4k0xDaqEO+fuKLcrECAwprGcaBaBZLqusi661YxjFSfpdfxq22fNNtfBSN3VlebHMkIXLUTA9YrbbvOMztFzgCCuP9brIl+CPf+mI+6rs2t0emeis1wuIjFX93HVuFNlUZ1OMbeYjH9mZ6VYPW2f4OLjAtrx1qRLq4nYeWjdp7URK7Kor7xsHnQ5OgEbutZeCivx8ifDcRVNRTKOKIwd/c2a5j4tH2fYUIaWKfHgF5BG0pWTAcGfrrIf+RzV1ka0Fp4PxOKbMk2xriaPlHyKwUi24mCT2Ak4jAmFvlVQk8beVIxHtuhMtx2ayWadexx6mJioteTbUX7eEsrwj6BYXPchP6YUUwcMmxRYp8eF8An/zI/47AvnLa5inrdDSjb6c2NZC7YjJf6NgS7AXwtMLFiGNuSlDI2N6SBZOSKRjsRniRQhDb2oz655NPlsjpzVeQe8YX8TW0T5sX4Vt1hTdiUmZqzLvdX3o7GPE3mUIQhg6b9Uha9B1C2c7sojtkx2q37V904Q4LxfwlMcjaJnehFEi5naPK8C4VLiQ0REhGHcY4iSsbU9WCp4L/c9MJjjWWuMMdiZQ8D6y/qLFrg9uRIwEd2gHuTdZs3p53oYdSkDOhLVjGW3bI5kaTVMMlaZxiQ/wql2PkHTRpo+g/L83czSVZIxgIkEytIqWGSXRLisgV+Lom3RZ5rzHDbaVs5k3GGZw2j0Bm+PePtVaTms4bQPywK993TDYToRzb7mHqoAF05NHJ90M9njo8XfCcfrmURnxIRjMKbsXSXCljxCo1VR50CXM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f89f6fde-83b6-4c7d-f006-08dafef66b8d X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:54.7782 (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: +57xr/a8geWzW5upmnHPiDNri19ynodnV6mqQ+D5FFodrPPB/VBRIStU0wAC6g83cTbTjM31J/oRH6mzk3fCXhY+5R58Ix4fPoUmtc4QhNU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: P_ZwQ1rLJe-OcpQjGYuDE_1D7vSIqOLi X-Proofpoint-ORIG-GUID: P_ZwQ1rLJe-OcpQjGYuDE_1D7vSIqOLi X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015279913211877?= X-GMAIL-MSGID: =?utf-8?q?1756015279913211877?= Convert putback_active_hugepage() to folio_putback_active_hugetlb(), this removes one user of the Huge Page macros which take in a page. The callers in migrate.c are also cleaned up by being able to directly use the src and dst folio variables. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- The call to folio_putback_active_hugetlb(page_folio(page)); in putback_movable_pages() is being converted so that a folio can be passed directly. This patch has been sent by Vishal Moola and is currently under review. include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 8 ++++---- mm/migrate.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 06eb59711e4a..1170db8e7831 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -174,7 +174,7 @@ int isolate_hugetlb(struct folio *folio, struct list_head *list); int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison); int get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); -void putback_active_hugepage(struct page *page); +void folio_putback_active_hugetlb(struct folio *folio); void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason); void free_huge_page(struct page *page); void hugetlb_fix_reserve_counts(struct inode *inode); @@ -428,7 +428,7 @@ static inline int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return 0; } -static inline void putback_active_hugepage(struct page *page) +static inline void folio_putback_active_hugetlb(struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e506a46b7871..ded5fe790c79 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7300,13 +7300,13 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return ret; } -void putback_active_hugepage(struct page *page) +void folio_putback_active_hugetlb(struct folio *folio) { spin_lock_irq(&hugetlb_lock); - SetHPageMigratable(page); - list_move_tail(&page->lru, &(page_hstate(page))->hugepage_activelist); + folio_set_hugetlb_migratable(folio); + list_move_tail(&folio->lru, &(folio_hstate(folio))->hugepage_activelist); spin_unlock_irq(&hugetlb_lock); - put_page(page); + folio_put(folio); } void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason) diff --git a/mm/migrate.c b/mm/migrate.c index 92d53e0b609a..b971edbf32fc 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -151,7 +151,7 @@ void putback_movable_pages(struct list_head *l) list_for_each_entry_safe(page, page2, l, lru) { if (unlikely(PageHuge(page))) { - putback_active_hugepage(page); + folio_putback_active_hugetlb(page_folio(page)); continue; } list_del(&page->lru); @@ -1374,7 +1374,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, if (folio_ref_count(src) == 1) { /* page was freed from under us. So we are done. */ - putback_active_hugepage(hpage); + folio_putback_active_hugetlb(src); return MIGRATEPAGE_SUCCESS; } @@ -1459,7 +1459,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, folio_unlock(src); out: if (rc == MIGRATEPAGE_SUCCESS) - putback_active_hugepage(hpage); + folio_putback_active_hugetlb(src); else if (rc != -EAGAIN) list_move_tail(&src->lru, ret); @@ -1471,7 +1471,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, if (put_new_page) put_new_page(new_hpage, private); else - putback_active_hugepage(new_hpage); + folio_putback_active_hugetlb(dst); return rc; } From patchwork Wed Jan 25 17:05:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48222 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386345wrn; Wed, 25 Jan 2023 09:12:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXvtH6sEazlF3N13tDviCG8bJ+YTEXecpI8Hni9POAJamAT7D44v0xE6vkrw608ICnGVS7ep X-Received: by 2002:a17:906:230a:b0:86f:5375:9f63 with SMTP id l10-20020a170906230a00b0086f53759f63mr32841953eja.39.1674666750485; Wed, 25 Jan 2023 09:12:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666750; cv=pass; d=google.com; s=arc-20160816; b=Zrsat6teGBsQPCVWRY7CUp2GUOnGdzzXHCNdL9CRDRsRiToF/VWrXApR/vYl9zFoZk v88IPUDS6PbljfRJD1Cfmq0hNGsDtuU0AVumS1sXX6D+yCzrTmSdOMJmijyT5y2+0lxH /2Gl0KxrwCzT1rnIxWOxBae66LpiDjFmaDMDjispy3lys28HUzrw/0yhuZxAVuxLMJ8Q cCm+mJwdnXKf1aCTzPDJuJ93iLmb1rL1VTOJ8VBUUAOF3qt4ptxj+V+hSInc1kkFz/6K s6s49zsiGFL9Shu2TsYuN/siyDKMx7VVMqmTpU7I1bAQ6NRXyl5E7PJxyeR4kg4sSMhh odfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=bACITe0+HO6MHd/mryALUAUMTD928ewLELsD4xHw8V8UN2q8mCpT3Cj07P99QGbPAK P4OiDuVp8fP6rLAXlK9g7xfV4s3NO6dpHug5RPH+fMixN06JWMOeYJXS9Xy8ddmcVcw/ iuHZ3ynob3oeD9iIPMP5GFKqcwlRjwipvMErAE9FsUOjsg1pG4Y1sieocGZuC0Dlr0PY 4PX+MVDGNCU9KOU4gYuvESVLDTKgbcsELZfvvZugcb5ZytP4o6Ubg4lrpq8TkZc8ipSL s/iMWQl7YvmLWZ7LnYtUW6WTFAA/fUpoJykcsb2UZpvDb8tIFKzL+VHLqiSLWBILh+Sq HAeQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=ECGeHdce; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=T+mx9ZQj; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a170906519400b0084c7b0977b6si7749180ejk.852.2023.01.25.09.12.04; Wed, 25 Jan 2023 09:12:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=ECGeHdce; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=T+mx9ZQj; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235770AbjAYRGt (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236061AbjAYRGn (ORCPT ); Wed, 25 Jan 2023 12:06:43 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0A314C6EF for ; Wed, 25 Jan 2023 09:06:26 -0800 (PST) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFQCou018592; Wed, 25 Jan 2023 17:06:03 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=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=ECGeHdceuC0AOPOkhE0mG3KO9w7i75zRTJ/c8D/ibKLqUji5gOgctae2KgCdtE+zP1Yl 4XH2IqV5c3imG9hC9NXdbmv7rdKmHn2Ql0jDB7OgdldFJ5Kap4BXxfxWWBYl9mcj7AG0 Xf/We5e9Mm2wPrz79NrRoasjDnWZJvko+lkw77tvnztJFyq/S8azuo23UNlrWKITYCtJ 5vdl/HOYKbPxJpwrAd53WNP+Oj2QTkON8azhg2RnXfUicyhyNhQXqC7nWZ5jS3HlfvR4 iLXnjoEuyEQAK9AzdsgwIIwAKd3WipWRgRBvWg+koZ2k3jHwPa58XlHKJhGQNErA+ay1 ag== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86ybggha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:02 +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 30PGAI8v019113; Wed, 25 Jan 2023 17:06:01 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gd5hdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JojxX4xoAPdovAkofWLkGrDSWx1S1XOowMyCVJFE9oLbMvG7YJQs2yV3HMaLTcHiumwGjod2inLXkR5NXoC9RcUikHluDHrA57cWV2xIRuIbSkqWu3gS2bUy82F79eJbbrb2fRJOvxHgYt1fCPr/wSExPdWZLfN5nGug866hATJnT0YfPIpL1B234aruE8spaPkzrUtGJA6F/eLf5P4tuDaB9kyhRx9UPP8telvxkb1EV8qQnSE2KV3C1Nu0gMZQFroIKks2BXo8LFECH+ksTNOjAyvfCDejyAB/U2W0kG1SrVy/yn3jkUPqt2YjzPjcnNGySM4oINY8mqXraxC8oQ== 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=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=e8q2j89Z8rNyY5AHsbPLW1Yt8GmbqZZjRpmX/CGHZijHXR3LPCCf6IUSXJ2CDwN5Jr+/2mSMburZ5XvglQ2cD1Q7rIvXU299ZWd+fSXsCCm3XdhZ2X+8CqYL7aDlSM1vRFm7fLrvnFaDDc2V1/6MmaKv8Yx4oOlO0JEzep702bZOcrizsgMIfPKQn+AoaWWtqxyXZpirH7aBX3FYDXbN9/iRBmQ2dHh1Hy/K2/ktzXyFE4uVjflIKdFANSF+josXUeHz20LJo9Uv5KfJnDPFOxGYmWPOSs0zBxagzICsQ8p+SjI4mUC6nfBHXoULVjhfMlf7+FJ/qJ3/9c1HWisuDg== 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=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=T+mx9ZQjRzJKe8Qut8zD88J7rFGfdFPXrBOkFt3E9WjfisvjB4hn9RpPZ1gloKS3OS/18fgbvMoyERnkEyNHKOE8tJPydglb6gZNGhxJ6S8FaRCIC3eOe+xz0Q+hHbVvQLd4RG3tTNuE1v3JBE8eAu5nLHPSND/gR2VuFepaqZc= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:58 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:58 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar , kernel test robot Subject: [PATCH v2 4/8] mm/hugetlb: convert hugetlb fault paths to use alloc_hugetlb_folio() Date: Wed, 25 Jan 2023 09:05:33 -0800 Message-Id: <20230125170537.96973-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0037.namprd17.prod.outlook.com (2603:10b6:a03:167::14) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: c2fa5dd7-d744-496c-9e75-08dafef66d42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +s9eGb3d/uZ+MhhFG9PRCqWpl/kXQFJTFT80gcJRr2+KeGaWn0PMFX5lF0pux5V8eD+uMrnt+VXKa2bIVQeGEsAUEvouOeyuSqRyAO86B7Bmi3UI6eOLRmCYSa0NRxHTyd+nlAoAFCIQdfy/12erFksdGtCeofThbuqhgCyVvr/TlPiT9bLBH4Hmcu0iTg6iBhQ4+5M+HQYOGhgzye7yl7Ie0SX573oy1S6/x/2/796SS4YMmuu5F/1sP3u/ytP4S3ry9ZNGxK5xOy9iYPlOhzeeBf4HeG4/2MAHdVp5C6B5gf9qnvrLZrLYu/bB3QQQ/vVsJSvbIA4rRII91QJ6fMIkqCk3q7XssybLFHkm6q0NTAbdpuvDs2CtUUcp6RjR+RPmX1j7VpKGTJ1Kaa9wmyedcLyLDYXTRoL9H7TgQu37hDsOTyGeAVZ5LEn1M5r/JAlxfl0wReuqOCTvTiJ34vQjKV6FbiKqf8WUbVYiQSQ6eFWfVmwd5WlePg7bJY8TdIyKrbKY71j63x/stxRpAjc6cYcJ48yD5ZoyYmdsAbof2kXlG5YpzobKWr3x24z7GUwUpKuJBmePEHGAhdLo5WnRZ9ccWUXCLJBGAfcF/Rv2nLcR/Ut1aEBDJPt7sYYR2XY8FsbWFncNZqw5+OChlw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(30864003)(44832011)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1tr7GkweEPn6m2LC0T00DwUlLCicYEGPHsR8+x/dbhsfjK2U7ahS4x159AGX/NiizUktdcvk+Sh+hUmNC0WJxX/+D7bwI8RcW+9D0ZUZ6iXZtdTQYBb7gntJiFFHWI0q/dJ/zXiND4f57AlMN7Bm61DKARznBxp6ARxYtC2ESLjLnQJvSdUuwEqsME8vD4O4YALWP70/W2WcFmsWu1avHKLlLcn2h1dfkWDaB5eq6ghfIoooMPsqKAkAQ0ODtLXTVkkOyYPEN7Dh6U9NHPhYVdkH7b53/cUMfaT+4vupIKbhja0UcvKA2n6w3fhWrEh523qG/eWLan1Vm+Bt3T7+NKiDBSsOSyEodEK/BWLGL27httipOFKUmD93UiQWoWRhp9Qztm18ohN7zT+OTaS9cUtgEX29lktgyaOMafC9NXnZlxPQ3Uhum8OEfEjs0zZPeZn1hnsGvxlIim+EiaUWgW1/nuP/WVA02MZyOO9uBk/VIiS5GoravUvwKg6k7tzBv6be7co8SVQ79gtBIIilrGhivE16q9jIlqAz6TASVxUUlk64h2J2FPjycKQEjGRwZec3UZyDjZX6+uqKEBae+lmo4rAwXvaw2yKihEM80fArcJqlj+dmYGpmmv1t1i+6pecW36SizfsbJNmZW9MK3/EPxshoJenLti5mXR7Oe5QKg7YW0Z2zcdGJSYRblC3Vb+daeM+kxyT8fufpbvWaaXAFuKaB2cxctwoZQ8yFuMltkQYl8WgNGKryJwsReV7NviFfoss3AYolirke+a1pt+hpUnFp/LEdoLgoqRGuYYA9ui2fmPweQZBMv2AVzWcWijToGBz8ak1F6kEshRUt0Dx30VShIGl+99m6cvP+8HSuKsHrOtQKkUIjEM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RosY5dT4ujcZwtbmkSug7nzT/szycmIhUGYXjmDYonSRE8SO0T9cO/ndQRyy8HzK/AprwHNS6S31bO+ZySTzZ33hC6DnNaeJZcRC0vQySbIqaeMKUZDmrkAwVVUUgoEkJAzN4EIUZ3L/F48blP6vXImR69tyGVUUYrsZYuKSeS4qCthYf1VDF/Cpq582rD3RWmiinaMCV+66qF5VM8HWBSXMxnk670hCPjbxjrYTUQd4f9bMKjl7D00x9rADJIPsR517srkF7iEEN8IzzbTyK5di++jBTO6gpV019gZxpN89GgSY4P1fospatC9QW4dWxSIafDTCHhmbNtzkdc7jMgr0IBQJ9Hjku8wWPxxn1UiS7Mx5h0bOV2yWRT+l/ssTe/MUWRLL9b7GrurUp7s1sW7J3Qwx/n1zqOj+jcCBedRRImII0r90//lVnEsq++puEWpPEbFz2jKlI1gGvHfQ0oQMJgcO2OnmgwpjrregPVgUFp+Ps8RVwNklBqsuXBfuj87l+CA+tT+SSJqMqZ5nHlV1IHCM+CYzjsyVBQiNxTvmM850NzCRs+zB0bO58h8NgMKBTETkNCJLhOBsp6bvARDBVa2T6gFgyLjXDD6t5FYnX0J8XtaZfswDJjdSFmqCZ13ThItC/0YgrCxshKKPQPteCVhHVbNs2zl9rNOLSouB8Cvb2+sdk8F2/hzD4p0AfBDnGXu9PwNWpFpPVbdwPKGkGBf1NQKTKUHf4cEhJkM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2fa5dd7-d744-496c-9e75-08dafef66d42 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:58.6704 (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: axf2CwCC05RZyPJ+dAmn4wsI7MY9I5S/GIPZ6A+DXNe/XljiuiaC6Kh8V8IwjGsW2+W1jmFFpRFN4N4Yd55JItR0TmVegGCdGGIaMYGqmCQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: 0cUQtaBqS45hEWh9cKhVQokPEOI8jnEJ X-Proofpoint-ORIG-GUID: 0cUQtaBqS45hEWh9cKhVQokPEOI8jnEJ X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015362602364150?= X-GMAIL-MSGID: =?utf-8?q?1756015362602364150?= Change alloc_huge_page() to alloc_hugetlb_folio() by changing all callers to handle the now folio return type of the function. In this conversion, alloc_huge_page_vma() is also changed to alloc_hugetlb_folio_vma() and hugepage_add_new_anon_rmap() is changed to take in a folio directly. Many additions of '&folio->page' are cleaned up in subsequent patches. hugetlbfs_fallocate() is also refactored to use the RCU + page_cache_next_miss() API. Suggested-by: Mike Kravetz Reported-by: kernel test robot Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 40 ++++---- include/linux/hugetlb.h | 8 +- include/linux/rmap.h | 2 +- mm/hugetlb.c | 201 ++++++++++++++++++++-------------------- mm/mempolicy.c | 6 +- mm/rmap.c | 6 +- 6 files changed, 133 insertions(+), 130 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 48f1a8ad2243..ac16ada48f75 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -819,8 +819,9 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, * This is supposed to be the vaddr where the page is being * faulted in, but we have no vaddr here. */ - struct page *page; + struct folio *folio; unsigned long addr; + bool present; cond_resched(); @@ -844,48 +845,49 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, mutex_lock(&hugetlb_fault_mutex_table[hash]); /* See if already present in mapping to avoid alloc/free */ - page = find_get_page(mapping, index); - if (page) { - put_page(page); + rcu_read_lock(); + present = page_cache_next_miss(mapping, index, 1) != index; + rcu_read_unlock(); + if (present) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); hugetlb_drop_vma_policy(&pseudo_vma); continue; } /* - * Allocate page without setting the avoid_reserve argument. + * Allocate folio without setting the avoid_reserve argument. * There certainly are no reserves associated with the * pseudo_vma. However, there could be shared mappings with * reserves for the file at the inode level. If we fallocate - * pages in these areas, we need to consume the reserves + * folios in these areas, we need to consume the reserves * to keep reservation accounting consistent. */ - page = alloc_huge_page(&pseudo_vma, addr, 0); + folio = alloc_hugetlb_folio(&pseudo_vma, addr, 0); hugetlb_drop_vma_policy(&pseudo_vma); - if (IS_ERR(page)) { + if (IS_ERR(folio)) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); - error = PTR_ERR(page); + error = PTR_ERR(folio); goto out; } - clear_huge_page(page, addr, pages_per_huge_page(h)); - __SetPageUptodate(page); - error = hugetlb_add_to_page_cache(page, mapping, index); + clear_huge_page(&folio->page, addr, pages_per_huge_page(h)); + __folio_mark_uptodate(folio); + error = hugetlb_add_to_page_cache(&folio->page, mapping, index); if (unlikely(error)) { - restore_reserve_on_error(h, &pseudo_vma, addr, page); - put_page(page); + restore_reserve_on_error(h, &pseudo_vma, addr, &folio->page); + folio_put(folio); mutex_unlock(&hugetlb_fault_mutex_table[hash]); goto out; } mutex_unlock(&hugetlb_fault_mutex_table[hash]); - SetHPageMigratable(page); + folio_set_hugetlb_migratable(folio); /* - * unlock_page because locked by hugetlb_add_to_page_cache() - * put_page() due to reference from alloc_huge_page() + * folio_unlock because locked by hugetlb_add_to_page_cache() + * folio_put() due to reference from alloc_hugetlb_folio() */ - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); } if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 1170db8e7831..f6849e67ffef 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -716,11 +716,11 @@ struct huge_bootmem_page { }; int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list); -struct page *alloc_huge_page(struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve); struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); -struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, pgoff_t idx); @@ -1032,7 +1032,7 @@ static inline int isolate_or_dissolve_huge_page(struct page *page, return -ENOMEM; } -static inline struct page *alloc_huge_page(struct vm_area_struct *vma, +static inline struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) { @@ -1046,7 +1046,7 @@ alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, return NULL; } -static inline struct page *alloc_huge_page_vma(struct hstate *h, +static inline struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { diff --git a/include/linux/rmap.h b/include/linux/rmap.h index a6bd1f0a183d..a4570da03e58 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -203,7 +203,7 @@ void page_remove_rmap(struct page *, struct vm_area_struct *, void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long address, rmap_t flags); -void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *, +void hugepage_add_new_anon_rmap(struct folio *, struct vm_area_struct *, unsigned long address); static inline void __page_dup_rmap(struct page *page, bool compound) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ded5fe790c79..e104dba1e5ea 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2493,7 +2493,7 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, } /* mempolicy aware migration callback */ -struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { struct mempolicy *mpol; @@ -2507,7 +2507,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, folio = alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask); mpol_cond_put(mpol); - return &folio->page; + return folio; } /* @@ -2798,14 +2798,14 @@ static long vma_del_reservation(struct hstate *h, /* * This routine is called to restore reservation information on error paths. - * It should ONLY be called for pages allocated via alloc_huge_page(), and - * the hugetlb mutex should remain held when calling this routine. + * It should ONLY be called for folios allocated via alloc_hugetlb_folio(), + * and the hugetlb mutex should remain held when calling this routine. * * It handles two specific cases: * 1) A reservation was in place and the page consumed the reservation. * HPageRestoreReserve is set in the page. * 2) No reservation was in place for the page, so HPageRestoreReserve is - * not set. However, alloc_huge_page always updates the reserve map. + * not set. However, alloc_hugetlb_folio always updates the reserve map. * * In case 1, free_huge_page later in the error path will increment the * global reserve count. But, free_huge_page does not have enough context @@ -2814,7 +2814,7 @@ static long vma_del_reservation(struct hstate *h, * reserve count adjustments to be made by free_huge_page. Make sure the * reserve map indicates there is a reservation present. * - * In case 2, simply undo reserve map modifications done by alloc_huge_page. + * In case 2, simply undo reserve map modifications done by alloc_hugetlb_folio. */ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct page *page) @@ -2844,8 +2844,8 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, if (!rc) { /* * This indicates there is an entry in the reserve map - * not added by alloc_huge_page. We know it was added - * before the alloc_huge_page call, otherwise + * not added by alloc_hugetlb_folio. We know it was added + * before the alloc_hugetlb_folio call, otherwise * hugetlb_restore_reserve would be set on the folio. * Remove the entry so that a subsequent allocation * does not consume a reservation. @@ -3014,7 +3014,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) return ret; } -struct page *alloc_huge_page(struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) { struct hugepage_subpool *spool = subpool_vma(vma); @@ -3023,7 +3023,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, long map_chg, map_commit; long gbl_chg; int ret, idx; - struct hugetlb_cgroup *h_cg; + struct hugetlb_cgroup *h_cg = NULL; bool deferred_reserve; idx = hstate_index(h); @@ -3130,7 +3130,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), pages_per_huge_page(h), folio); } - return &folio->page; + return folio; out_uncharge_cgroup: hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); @@ -4950,7 +4950,7 @@ hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long add struct folio *new_folio) { __folio_mark_uptodate(new_folio); - hugepage_add_new_anon_rmap(&new_folio->page, vma, addr); + hugepage_add_new_anon_rmap(new_folio, vma, addr); set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, &new_folio->page, 1)); hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm); folio_set_hugetlb_migratable(new_folio); @@ -5080,34 +5080,34 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, } else if (page_try_dup_anon_rmap(ptepage, true, src_vma)) { pte_t src_pte_old = entry; - struct page *new; + struct folio *new_folio; spin_unlock(src_ptl); spin_unlock(dst_ptl); /* Do not use reserve as it's private owned */ - new = alloc_huge_page(dst_vma, addr, 1); - if (IS_ERR(new)) { + new_folio = alloc_hugetlb_folio(dst_vma, addr, 1); + if (IS_ERR(new_folio)) { put_page(ptepage); - ret = PTR_ERR(new); + ret = PTR_ERR(new_folio); break; } - copy_user_huge_page(new, ptepage, addr, dst_vma, + copy_user_huge_page(&new_folio->page, ptepage, addr, dst_vma, npages); put_page(ptepage); - /* Install the new huge page if src pte stable */ + /* Install the new hugetlb folio if src pte stable */ dst_ptl = huge_pte_lock(h, dst, dst_pte); src_ptl = huge_pte_lockptr(h, src, src_pte); spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); entry = huge_ptep_get(src_pte); if (!pte_same(src_pte_old, entry)) { restore_reserve_on_error(h, dst_vma, addr, - new); - put_page(new); + &new_folio->page); + folio_put(new_folio); /* huge_ptep of dst_pte won't change as in child */ goto again; } - hugetlb_install_folio(dst_vma, dst_pte, addr, page_folio(new)); + hugetlb_install_folio(dst_vma, dst_pte, addr, new_folio); spin_unlock(src_ptl); spin_unlock(dst_ptl); continue; @@ -5478,7 +5478,8 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, const bool unshare = flags & FAULT_FLAG_UNSHARE; pte_t pte; struct hstate *h = hstate_vma(vma); - struct page *old_page, *new_page; + struct page *old_page; + struct folio *new_folio; int outside_reserve = 0; vm_fault_t ret = 0; unsigned long haddr = address & huge_page_mask(h); @@ -5539,9 +5540,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * be acquired again before returning to the caller, as expected. */ spin_unlock(ptl); - new_page = alloc_huge_page(vma, haddr, outside_reserve); + new_folio = alloc_hugetlb_folio(vma, haddr, outside_reserve); - if (IS_ERR(new_page)) { + if (IS_ERR(new_folio)) { /* * If a process owning a MAP_PRIVATE mapping fails to COW, * it is due to references held by a child and an insufficient @@ -5586,7 +5587,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, return 0; } - ret = vmf_error(PTR_ERR(new_page)); + ret = vmf_error(PTR_ERR(new_folio)); goto out_release_old; } @@ -5599,9 +5600,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, goto out_release_all; } - copy_user_huge_page(new_page, old_page, address, vma, + copy_user_huge_page(&new_folio->page, old_page, address, vma, pages_per_huge_page(h)); - __SetPageUptodate(new_page); + __folio_mark_uptodate(new_folio); mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, haddr, haddr + huge_page_size(h)); @@ -5618,12 +5619,12 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, huge_ptep_clear_flush(vma, haddr, ptep); mmu_notifier_invalidate_range(mm, range.start, range.end); page_remove_rmap(old_page, vma, true); - hugepage_add_new_anon_rmap(new_page, vma, haddr); + hugepage_add_new_anon_rmap(new_folio, vma, haddr); set_huge_pte_at(mm, haddr, ptep, - make_huge_pte(vma, new_page, !unshare)); - SetHPageMigratable(new_page); + make_huge_pte(vma, &new_folio->page, !unshare)); + folio_set_hugetlb_migratable(new_folio); /* Make the old page be freed below */ - new_page = old_page; + new_folio = page_folio(old_page); } spin_unlock(ptl); mmu_notifier_invalidate_range_end(&range); @@ -5632,9 +5633,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * No restore in case of successful pagetable update (Break COW or * unshare) */ - if (new_page != old_page) - restore_reserve_on_error(h, vma, haddr, new_page); - put_page(new_page); + if (new_folio != page_folio(old_page)) + restore_reserve_on_error(h, vma, haddr, &new_folio->page); + folio_put(new_folio); out_release_old: put_page(old_page); @@ -5753,11 +5754,11 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, vm_fault_t ret = VM_FAULT_SIGBUS; int anon_rmap = 0; unsigned long size; - struct page *page; + struct folio *folio; pte_t new_pte; spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); - bool new_page, new_pagecache_page = false; + bool new_folio, new_pagecache_folio = false; u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* @@ -5776,9 +5777,9 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * Use page lock to guard against racing truncation * before we get page_table_lock. */ - new_page = false; - page = find_lock_page(mapping, idx); - if (!page) { + new_folio = false; + folio = filemap_lock_folio(mapping, idx); + if (!folio) { size = i_size_read(mapping->host) >> huge_page_shift(h); if (idx >= size) goto out; @@ -5811,8 +5812,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, VM_UFFD_MISSING); } - page = alloc_huge_page(vma, haddr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(vma, haddr, 0); + if (IS_ERR(folio)) { /* * Returning error will result in faulting task being * sent SIGBUS. The hugetlb fault mutex prevents two @@ -5826,17 +5827,17 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * sure there really is no pte entry. */ if (hugetlb_pte_stable(h, mm, ptep, old_pte)) - ret = vmf_error(PTR_ERR(page)); + ret = vmf_error(PTR_ERR(folio)); else ret = 0; goto out; } - clear_huge_page(page, address, pages_per_huge_page(h)); - __SetPageUptodate(page); - new_page = true; + clear_huge_page(&folio->page, address, pages_per_huge_page(h)); + __folio_mark_uptodate(folio); + new_folio = true; if (vma->vm_flags & VM_MAYSHARE) { - int err = hugetlb_add_to_page_cache(page, mapping, idx); + int err = hugetlb_add_to_page_cache(&folio->page, mapping, idx); if (err) { /* * err can't be -EEXIST which implies someone @@ -5845,13 +5846,13 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * to the page cache. So it's safe to call * restore_reserve_on_error() here. */ - restore_reserve_on_error(h, vma, haddr, page); - put_page(page); + restore_reserve_on_error(h, vma, haddr, &folio->page); + folio_put(folio); goto out; } - new_pagecache_page = true; + new_pagecache_folio = true; } else { - lock_page(page); + folio_lock(folio); if (unlikely(anon_vma_prepare(vma))) { ret = VM_FAULT_OOM; goto backout_unlocked; @@ -5864,7 +5865,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * don't have hwpoisoned swap entry for errored virtual address. * So we need to block hugepage fault by PG_hwpoison bit check. */ - if (unlikely(PageHWPoison(page))) { + if (unlikely(folio_test_hwpoison(folio))) { ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); goto backout_unlocked; @@ -5872,8 +5873,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, /* Check for page in userfault range. */ if (userfaultfd_minor(vma)) { - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); /* See comment in userfaultfd_missing() block above */ if (!hugetlb_pte_stable(h, mm, ptep, old_pte)) { ret = 0; @@ -5907,10 +5908,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, goto backout; if (anon_rmap) - hugepage_add_new_anon_rmap(page, vma, haddr); + hugepage_add_new_anon_rmap(folio, vma, haddr); else - page_dup_file_rmap(page, true); - new_pte = make_huge_pte(vma, page, ((vma->vm_flags & VM_WRITE) + page_dup_file_rmap(&folio->page, true); + new_pte = make_huge_pte(vma, &folio->page, ((vma->vm_flags & VM_WRITE) && (vma->vm_flags & VM_SHARED))); /* * If this pte was previously wr-protected, keep it wr-protected even @@ -5923,20 +5924,20 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, hugetlb_count_add(pages_per_huge_page(h), mm); if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { /* Optimization, do the COW without a second fault */ - ret = hugetlb_wp(mm, vma, address, ptep, flags, page, ptl); + ret = hugetlb_wp(mm, vma, address, ptep, flags, &folio->page, ptl); } spin_unlock(ptl); /* - * Only set HPageMigratable in newly allocated pages. Existing pages - * found in the pagecache may not have HPageMigratableset if they have + * Only set hugetlb_migratable in newly allocated pages. Existing pages + * found in the pagecache may not have hugetlb_migratable if they have * been isolated for migration. */ - if (new_page) - SetHPageMigratable(page); + if (new_folio) + folio_set_hugetlb_migratable(folio); - unlock_page(page); + folio_unlock(folio); out: hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -5945,11 +5946,11 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, backout: spin_unlock(ptl); backout_unlocked: - if (new_page && !new_pagecache_page) - restore_reserve_on_error(h, vma, haddr, page); + if (new_folio && !new_pagecache_folio) + restore_reserve_on_error(h, vma, haddr, &folio->page); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); goto out; } @@ -6173,16 +6174,16 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t _dst_pte; spinlock_t *ptl; int ret = -ENOMEM; - struct page *page; + struct folio *folio; int writable; - bool page_in_pagecache = false; + bool folio_in_pagecache = false; if (is_continue) { ret = -EFAULT; - page = find_lock_page(mapping, idx); - if (!page) + folio = filemap_lock_folio(mapping, idx); + if (!folio) goto out; - page_in_pagecache = true; + folio_in_pagecache = true; } else if (!*pagep) { /* If a page already exists, then it's UFFDIO_COPY for * a non-missing case. Return -EEXIST. @@ -6193,34 +6194,34 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, goto out; } - page = alloc_huge_page(dst_vma, dst_addr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(dst_vma, dst_addr, 0); + if (IS_ERR(folio)) { ret = -ENOMEM; goto out; } - ret = copy_huge_page_from_user(page, + ret = copy_huge_page_from_user(&folio->page, (const void __user *) src_addr, pages_per_huge_page(h), false); /* fallback to copy_from_user outside mmap_lock */ if (unlikely(ret)) { ret = -ENOENT; - /* Free the allocated page which may have + /* Free the allocated folio which may have * consumed a reservation. */ - restore_reserve_on_error(h, dst_vma, dst_addr, page); - put_page(page); + restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + folio_put(folio); - /* Allocate a temporary page to hold the copied + /* Allocate a temporary folio to hold the copied * contents. */ - page = alloc_huge_page_vma(h, dst_vma, dst_addr); - if (!page) { + folio = alloc_hugetlb_folio_vma(h, dst_vma, dst_addr); + if (!folio) { ret = -ENOMEM; goto out; } - *pagep = page; + *pagep = &folio->page; /* Set the outparam pagep and return to the caller to * copy the contents outside the lock. Don't free the * page. @@ -6236,25 +6237,25 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, goto out; } - page = alloc_huge_page(dst_vma, dst_addr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(dst_vma, dst_addr, 0); + if (IS_ERR(folio)) { put_page(*pagep); ret = -ENOMEM; *pagep = NULL; goto out; } - copy_user_huge_page(page, *pagep, dst_addr, dst_vma, + copy_user_huge_page(&folio->page, *pagep, dst_addr, dst_vma, pages_per_huge_page(h)); put_page(*pagep); *pagep = NULL; } /* - * The memory barrier inside __SetPageUptodate makes sure that + * The memory barrier inside __folio_mark_uptodate makes sure that * preceding stores to the page contents become visible before * the set_pte_at() write. */ - __SetPageUptodate(page); + __folio_mark_uptodate(folio); /* Add shared, newly allocated pages to the page cache. */ if (vm_shared && !is_continue) { @@ -6269,16 +6270,16 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, * hugetlb_fault_mutex_table that here must be hold by * the caller. */ - ret = hugetlb_add_to_page_cache(page, mapping, idx); + ret = hugetlb_add_to_page_cache(&folio->page, mapping, idx); if (ret) goto out_release_nounlock; - page_in_pagecache = true; + folio_in_pagecache = true; } ptl = huge_pte_lock(h, dst_mm, dst_pte); ret = -EIO; - if (PageHWPoison(page)) + if (folio_test_hwpoison(folio)) goto out_release_unlock; /* @@ -6290,10 +6291,10 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, if (!huge_pte_none_mostly(huge_ptep_get(dst_pte))) goto out_release_unlock; - if (page_in_pagecache) - page_dup_file_rmap(page, true); + if (folio_in_pagecache) + page_dup_file_rmap(&folio->page, true); else - hugepage_add_new_anon_rmap(page, dst_vma, dst_addr); + hugepage_add_new_anon_rmap(folio, dst_vma, dst_addr); /* * For either: (1) CONTINUE on a non-shared VMA, or (2) UFFDIO_COPY @@ -6304,7 +6305,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, else writable = dst_vma->vm_flags & VM_WRITE; - _dst_pte = make_huge_pte(dst_vma, page, writable); + _dst_pte = make_huge_pte(dst_vma, &folio->page, writable); /* * Always mark UFFDIO_COPY page dirty; note that this may not be * extremely important for hugetlbfs for now since swapping is not @@ -6326,20 +6327,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, spin_unlock(ptl); if (!is_continue) - SetHPageMigratable(page); + folio_set_hugetlb_migratable(folio); if (vm_shared || is_continue) - unlock_page(page); + folio_unlock(folio); ret = 0; out: return ret; out_release_unlock: spin_unlock(ptl); if (vm_shared || is_continue) - unlock_page(page); + folio_unlock(folio); out_release_nounlock: - if (!page_in_pagecache) - restore_reserve_on_error(h, dst_vma, dst_addr, page); - put_page(page); + if (!folio_in_pagecache) + restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + folio_put(folio); goto out; } #endif /* CONFIG_USERFAULTFD */ @@ -6871,7 +6872,7 @@ bool hugetlb_reserve_pages(struct inode *inode, /* * pages in this range were added to the reserve * map between region_chg and region_add. This - * indicates a race with alloc_huge_page. Adjust + * indicates a race with alloc_hugetlb_folio. Adjust * the subpool and reserve counts modified above * based on the difference. */ diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fd99d303e34f..945b41c245a5 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1218,9 +1218,11 @@ static struct page *new_page(struct page *page, unsigned long start) break; } - if (folio_test_hugetlb(src)) - return alloc_huge_page_vma(page_hstate(&src->page), + if (folio_test_hugetlb(src)) { + dst = alloc_hugetlb_folio_vma(folio_hstate(src), vma, address); + return &dst->page; + } if (folio_test_large(src)) gfp = GFP_TRANSHUGE; diff --git a/mm/rmap.c b/mm/rmap.c index 948ca17a96ad..e6d94bd19879 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2547,15 +2547,13 @@ void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma, !!(flags & RMAP_EXCLUSIVE)); } -void hugepage_add_new_anon_rmap(struct page *page, +void hugepage_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma, unsigned long address) { - struct folio *folio = page_folio(page); - BUG_ON(address < vma->vm_start || address >= vma->vm_end); /* increment count (starts at -1) */ atomic_set(&folio->_entire_mapcount, 0); folio_clear_hugetlb_restore_reserve(folio); - __page_set_anon_rmap(folio, page, vma, address, 1); + __page_set_anon_rmap(folio, &folio->page, vma, address, 1); } #endif /* CONFIG_HUGETLB_PAGE */ From patchwork Wed Jan 25 17:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386401wrn; Wed, 25 Jan 2023 09:12:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXuD6YSLs0PcwLxAthXu16eiE4J8bkYYtYF5uu2VbYZFdQymKEQDblcgf6zkPdiaS4LP4OjC X-Received: by 2002:a17:907:98b2:b0:83f:1e04:b776 with SMTP id ju18-20020a17090798b200b0083f1e04b776mr31997888ejc.40.1674666755326; Wed, 25 Jan 2023 09:12:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666755; cv=pass; d=google.com; s=arc-20160816; b=wuE1Po5iDt+bXm1LW0IYZpxj+NY3bT+a21SKImbZPCHwNI/v6zVDJh6bph9vFCX8H/ r2aaMn3dJR3DdAn1sNRgm2BSf1uceOtIvx0cPzm0gNcrJTkfW3U5uPIpjFHUgBQUMoKi xtC+/Kc8A6BVmSUvvVOHmdCEjU1AG9+ZyNft866BhTUFLPvFvGAEJ3EudoITK3kLNweF GcCzcj/egdoS48lpbARD9gryo/W5speArfBHStWJxy9JTjCPJ+oZSCUQvaGBHt8fPjDe HZ/8ey+zwPI2RX/NR9bNyOtMVA3FPmCqXJv9P/7PauNijuINLz4DLz58bvThDtuJC0oq Cfmw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=m6FV/OtknLpU0XbLjP3sj+MopRP2lo2C6a+NA34Ps9Wc+E/cLH5okYC0/bDDy02S9M sSMipUIO2jdJlZ0Bzot3yHPLT/SF5iu30g4xGiUYJfwbbEFOBiMcf3jk/XHlPiu/OzqH PSp/6pxTHe6vl8ExXlGCO4GFODgBgh2XVQrRhyrhTKmY1XrmM4XgFZDRBAySZZ3tLcDA yxyPa0+zgYmn82dEYb7tKlNCxev4IpYG7D1Np8KnG4U79DLK8uX2Dk09pmfa7QqoQuuL CYooWMMF165yI5GCwOLFRKXFlD95ArUeHrJ259fdwY0bkER9pw31AIpgpw5Peg29Q9YQ +vnQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=RFB+VXA2; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tK+jg2s1; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vs20-20020a170907139400b00871a4e8d7bfsi6753130ejb.230.2023.01.25.09.12.10; Wed, 25 Jan 2023 09:12:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=RFB+VXA2; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tK+jg2s1; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236043AbjAYRGf (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235770AbjAYRG3 (ORCPT ); Wed, 25 Jan 2023 12:06:29 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E69E5A36F for ; Wed, 25 Jan 2023 09:06:24 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNjsp009509; Wed, 25 Jan 2023 17:06:04 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=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=RFB+VXA2TsBgvars8j57xB7M/yosiF6dfuqWEakeOamZW54xJtSbdQb2O2g3F9BPQrsg BHniVwWuCtfD2oKOdbt46/oX0Lm5bBCzKldQONtj+1KZUrLqzyrFA7bEoSoRjuzHdKUl R/Aj84s5mwV37eVAbzGCJ7CapWJdj4rB5nH5FFTP4/kQpfTbi4nyJ0FJbR6B+DsHSf4E T5VkDgTlkBl55HiiCzA5Y11RMA6V6+kOHCtuKp6YvtwOwoiUwLRbiILZfqcB2OGtP/uZ ymjJbuGufnkQKZzGhcpHdOZBqLCKMTawXnCmyQu4jIP7Wd0iTLgVVenxPorYvdyZsbpO Vw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c8jex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:04 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGHiCQ031875; Wed, 25 Jan 2023 17:06:03 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6t5av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RozPcP14nkaIIKntLEpVvR0NbZwE65Q8KmLqpe7FzHlGi1JEuLmNCTphRoMPHtP8E/yIU7vJNVJxklPjTkxaqSvNnDoU0rrDQsMiIxgX0s4rdlOKFKi4EK9oIViQNsBoGUxPY2GwQCalaRP/UM7HfRb2daj/B8kTIaUlwTtwN3eWXD/3Xjj9Qtiu/NmVpWhgoX4gmRrqn4TZmpzOmgYYuEEOmF1u2AO3KIvC45HpaGbFgYuaHleCDN2i5OGC3LKIlUO8vjiIfD5nN6UE1un0bAfraE/aG4RuNZZbDSDBT62wLViIgeZMDTV3xtFZb3XA3Lyxf3mx7FN/w5SbKypCHA== 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=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=IMLwNDIaNL7LL+/yyCwKHi1DpfpsITtXqgOW1HA0HOBhJjOQJOtKMvfW5H/73otEdyVjsK6cnKa12FooMdM3axqO/adBxMEymuboIRR1IEQ1AfZJhUjPWxEFoRfQU9/37UxSjrMPcaM1rXUNRwTVGkHR93FzteYDPunYKyKDEt5kx5WtF4I09EZ9MNC6IF372nZ7aZgh3SJ/OBdz1IwvYT8+iEaGVgeSSz7dEs3xw5ScVewVUOV21LDlwDb9ICa7Hjcrl7ajVvjUiH6LbBhKBvMsQ9BaKA196ZMhUHRUjrsTYb/UoXxIdWHzaizV7nLxLejl4n752XNTMwvy65woaA== 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=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=tK+jg2s1Jy968/mkApRhUKzFSIqRp/4wv47U/4vwPPUV2HBNtQRXXa2CJyA038cA6YEDIF5KdyhtCXpBWzsuQ3tkS4fKBb7moqkEJuKG3TgcuMuoBpWVPuFvIQ2BFxWYdmaUbiOhyGDgSkglk4SOsHjHXVu+Qn89lhVwbTKRntk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:00 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:00 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 5/8] mm/hugetlb: convert restore_reserve_on_error to take in a folio Date: Wed, 25 Jan 2023 09:05:34 -0800 Message-Id: <20230125170537.96973-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0113.namprd03.prod.outlook.com (2603:10b6:a03:333::28) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: edb7cb53-3212-483b-b3ec-08dafef66efb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VoFzedH55IxCXfs994+vmKyLkCt/LlDNMQLY3tBZtJLSdUZPcp2x3O/TRH/28jq4ZpywmFHA2lCdK4Z9LXjL2KfYQ3XkMwLHHNkeKPIKelE9TOCC3GVOHQPmNEOcr6xsV7ZT7ehpbRlsCT/Vc0G+AOFN4Yolh0Gz1zuQZetM/6iXSCp9kdJmRjDAI2L8ZYkZAEH09tkQtQAnj9MzwC6duB4pltWubslUgt8g/5r8ukVyrm2a3LF/0V8ahRmmIPFoVbwIONx6SeFv3LcEV/RDHydPfeRAxeoG0fpmZ7JcwRxAbQPmJDpwOJ2E7FeoTdlnAMgYzdSuJkJMyBlfQFYnEpPOQ8boAiAao77COphlJ+2LkSU5oWMKAg2NBQq4NFKrQgn7i0fBs2s2ckEIGpZeD4Oxbb95RPb19ABFI7uyC8FbBAgYroDunMCVH8Yd5BrhdCVoSe3SX/LWkb8tc6IwgbfJ3NJWE1HiAXT9IxZPCB7PLwLs0XCv1a13+hzP7b3Qj/EIuyc9ybHymHr/iW96n0CBZiS8poBE7VmnA0qhCh7gunY8jmg8NsuR/bW7AgbGxcQMgz75yZZXeXvnKyuZeI6/uqBOSxJ4HTtn9HAIvSbl83ubfuo3P0ojE22/n1kwfozK/Z+4ZupiCbKDx6HWBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YPhLAf4DVUj1h4TmYkHSr8/shIEAgSHcEffxPtTP9ON5EHyGB7Id81zmPj9XBYVgb6AeBqj5qU/L9i/P9Bhwotn2UyxWOLDvgECPKg7ZgkdBzEKHD4RmseAyBhq9DllPLiOc0Ce6ZBcPVV+Qo8UTYFHLpjTuqCMLrvzxhpvW/KqT4qgu66fNjeKF4MfhDY+62BkAJQPfPGTvwd+ySAoMcq0IGBS8TjtOdpUtNG55sooyYvABzOAMxYHAzpapXMTH0zXRCmAu4xMSrTZ9V2Old4LaDlZWj2Ye5FWZuHne3qyXKh56ze4IbrREIY2tilANDtcGMTkKUTNkJ5We0PYx48fOnthCc7tPsJMchA0Tq2Us4xT8Kzh+uDYseT2etvRBIfNjh7rooItfaDQNDRyI/UKrRozX5uglYt6dqExS6yOszUgUC6u6P8r6GLg2pLtfsnT+ZiH4jBLwF75xzJJynVf7I2h6r+MrgsAH4L+PW1nU51CWqR7QPvucH2heJ3RcADGDCmCpRJLlut8f5K+YpHHu3vn7AlnAtTpdn33GZClG+0JpYe4bbcNI+6ySgA9JEyk6MtAAKPNjiF9nxeakdgBmhxphRq1RnJ9lHzLU4YALAqGhzV4sOyGNz0ijXgr/LnfXt26+pA0kV4MJVJrISNaSIYlNvwjtPnKhEVl3iinHeUr6OgVNHqzSV2p0mC2EYpJeZZpRPYmhCMpif2/bYQ3JT6erPYBMk0/3Y/zidpnAn7CIbVZMWe9MmXifOlI3xL2Cey3TRFf0zO/Cvh4ZwvMeW8Y0yLIMOOsJRIhQv1zY/hgODpycMhh8oX5rDPh/m6SoQGwm5HvN9MjPajx/3+qIOY6JOeBOP4XqBj+w249wlMeS2sYaKjyzmj8Z3V+MUT00iDVvCWkoxGorsB9QAto56VXOjx/6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n0b4kN9CXwECUS0o5zQTqZnfYXrTrKalYFyezpFiTDaz3Dldy7YG1JI7RVgBw5X3Je4uydP3iw+WGLBxVnRud1HEWAOtihWsX4NEgu7UbbV51c/0O/CMJcQis8ZCNCkWNe4NgHSg3ErmeN+zHhZ9T8i04U7sLU4+OBB7I4kRDdpLQxfs8qFFCsaSTDlP3QNcEz2OdOC2TltSPW4+PGYapz66FHqxwN4Ows0p0Po14f49RYT40y+GrpUlVaJ6fsz9vNLR5Ch5N2o2fTaREW+PR+ds0dKtwU625WmtTzwBvdDROFe29ROVBLPNrLu2QccjHqN0tt668t1aEtYALjCnmIKutQj2+XtC1w49wxv1lwA80BpFRVEQdq0MbUeI2ElKGW8m9N8eZAy+tvbT6mNkdWwGZf0f9EJpSO9jET/zr6Yvq6zk3+x4rQ8usiFZ/igEeqVACoak4hOAzetsvU/GnyFUT6TouvXC4PeQc5WdmAB/dYms6O/Uioh0CgGLk0j64KiZmwPcexUfLIL5PDMPSMOGyJ67gRxz8ShrWDZmbZaJ7tYdptOCiQJlSP8l6Dx6cpWXJz6OZHfBRopqoCRAUPPRMvS8uXlPfCCMwEvOq7Kk5BGyaN7OTuQWKX2f+nqq6n9LopGwrlDiJMPFmXU9UYRwePrwzL2sGC8I69fIXZ+8wBWf8QXvSwh1b4rbmr8k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: edb7cb53-3212-483b-b3ec-08dafef66efb X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:00.7182 (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: 9dUMvuj/ypICxdDliAPL+YEwgD0PWkwBOT++nF7AQQ4wz8NKVXv4xhft90E41J3eK2/2rZUmB19M7pTIBNrfrX40YeE1GHjtVwV16nUF6gY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: SVNEP9c7uXmuU6nQBfSepqD9lZtyfC34 X-Proofpoint-GUID: SVNEP9c7uXmuU6nQBfSepqD9lZtyfC34 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015367804692380?= X-GMAIL-MSGID: =?utf-8?q?1756015367804692380?= Every caller of restore_reserve_on_error() is now passing in &folio->page, change the function to take in a folio directly and clean up the call sites. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 2 +- include/linux/hugetlb.h | 2 +- mm/hugetlb.c | 21 ++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ac16ada48f75..e2b8a00696bd 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -873,7 +873,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, __folio_mark_uptodate(folio); error = hugetlb_add_to_page_cache(&folio->page, mapping, index); if (unlikely(error)) { - restore_reserve_on_error(h, &pseudo_vma, addr, &folio->page); + restore_reserve_on_error(h, &pseudo_vma, addr, folio); folio_put(folio); mutex_unlock(&hugetlb_fault_mutex_table[hash]); goto out; diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f6849e67ffef..d46f9db09a2c 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -725,7 +725,7 @@ struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *v int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, pgoff_t idx); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, - unsigned long address, struct page *page); + unsigned long address, struct folio *folio); /* arch callback */ int __init __alloc_bootmem_huge_page(struct hstate *h, int nid); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e104dba1e5ea..aad028706fbc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2802,9 +2802,9 @@ static long vma_del_reservation(struct hstate *h, * and the hugetlb mutex should remain held when calling this routine. * * It handles two specific cases: - * 1) A reservation was in place and the page consumed the reservation. - * HPageRestoreReserve is set in the page. - * 2) No reservation was in place for the page, so HPageRestoreReserve is + * 1) A reservation was in place and the folio consumed the reservation. + * hugetlb_restore_reserve is set in the folio. + * 2) No reservation was in place for the page, so hugetlb_restore_reserve is * not set. However, alloc_hugetlb_folio always updates the reserve map. * * In case 1, free_huge_page later in the error path will increment the @@ -2817,9 +2817,8 @@ static long vma_del_reservation(struct hstate *h, * In case 2, simply undo reserve map modifications done by alloc_hugetlb_folio. */ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, - unsigned long address, struct page *page) + unsigned long address, struct folio *folio) { - struct folio *folio = page_folio(page); long rc = vma_needs_reservation(h, vma, address); if (folio_test_hugetlb_restore_reserve(folio)) { @@ -5102,7 +5101,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, entry = huge_ptep_get(src_pte); if (!pte_same(src_pte_old, entry)) { restore_reserve_on_error(h, dst_vma, addr, - &new_folio->page); + new_folio); folio_put(new_folio); /* huge_ptep of dst_pte won't change as in child */ goto again; @@ -5634,7 +5633,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * unshare) */ if (new_folio != page_folio(old_page)) - restore_reserve_on_error(h, vma, haddr, &new_folio->page); + restore_reserve_on_error(h, vma, haddr, new_folio); folio_put(new_folio); out_release_old: put_page(old_page); @@ -5846,7 +5845,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * to the page cache. So it's safe to call * restore_reserve_on_error() here. */ - restore_reserve_on_error(h, vma, haddr, &folio->page); + restore_reserve_on_error(h, vma, haddr, folio); folio_put(folio); goto out; } @@ -5947,7 +5946,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, spin_unlock(ptl); backout_unlocked: if (new_folio && !new_pagecache_folio) - restore_reserve_on_error(h, vma, haddr, &folio->page); + restore_reserve_on_error(h, vma, haddr, folio); folio_unlock(folio); folio_put(folio); @@ -6210,7 +6209,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, /* Free the allocated folio which may have * consumed a reservation. */ - restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + restore_reserve_on_error(h, dst_vma, dst_addr, folio); folio_put(folio); /* Allocate a temporary folio to hold the copied @@ -6339,7 +6338,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, folio_unlock(folio); out_release_nounlock: if (!folio_in_pagecache) - restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + restore_reserve_on_error(h, dst_vma, dst_addr, folio); folio_put(folio); goto out; } From patchwork Wed Jan 25 17:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48224 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp386414wrn; Wed, 25 Jan 2023 09:12:36 -0800 (PST) X-Google-Smtp-Source: AK7set+6skwdaNXaGswchz8P4Zo1RQBdssNLfFpPqSQunyv9DZVzY4rySS+4R3FVRGm6zXVlnHEP X-Received: by 2002:a05:6402:5023:b0:4a0:8b2c:2055 with SMTP id p35-20020a056402502300b004a08b2c2055mr7278516eda.8.1674666756528; Wed, 25 Jan 2023 09:12:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666756; cv=pass; d=google.com; s=arc-20160816; b=egk8VLnq1jXuaqrkJ9mSJ4z1vHvdnjI2xZYPjXxJHcmXIfBC1v3SXM4SE7IUdEt6O7 Naa5e8fAmAWvbUZymXUEmg1bd5UAPShktf0ru/vx5Ih70VzViSwYnXh5HB4hbYbJjV1w Saf6iGsHZshwt3osejwOOzYg/dIYBPlpeKMB5jiwVEur8j1sAGulttOjurC9lsbXD8Ve BPhWT/2xMLZ6RFfIk/1Y1RZXY+hpCiGvPZNdaQvcq4IonSnE1u3fStbPhIxrRvEAG7Yi 8io05OkCE0Dk3uWsYGMqp6MTm0cQCkcLxuKGuGsZGn0M//TvfMI17QVua4iAoDfRt2x6 jpNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=ITAk1x2aa+Fw6wgrap505NpV9aZxWnrBjtSv+Stt1wj1+NDTjfioX8voiDqeWtKU3A NKI4wMBCbk1Pae5F1F5wEPxuM+XX720meFIBDjfsQbAWJanVZMmA7qLcPjkEWQKwIdJO SYJWN1e+xLSLSf2TEfubPDNKfriU4G99cwHmp7kmwL01x7HzP1edabjpyUcopbne/XUz LYmQoWlY84IKCwzzdQaPrAdis8JT/ezvvRpM3z2foFVQyGAmqqx768q8SaornaomRho0 WDfAVtPhaHPd/T1X9DvgydsrpeV5m1AJqapp3EXm1wSgwSUoYZT9lsPmChas/p4VXoA5 vdrQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=jKNrmtvh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MPejZRHM; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g3-20020a056402320300b004a0ad879b11si2537149eda.66.2023.01.25.09.12.11; Wed, 25 Jan 2023 09:12:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=jKNrmtvh; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MPejZRHM; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236062AbjAYRGr (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236050AbjAYRGm (ORCPT ); Wed, 25 Jan 2023 12:06:42 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CA4F59748 for ; Wed, 25 Jan 2023 09:06:26 -0800 (PST) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNnjV019596; Wed, 25 Jan 2023 17:06:06 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=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=jKNrmtvhKI9pKSkYgsTxuCi0xNesODe9k/r5RxlwbYpjnSg6gFkv5IvvIKdgccKN/2NO xiAWGkghNrpuw6ZS021KRlhdzMRzzxfOO19kLQ4bbWbmxGi4Zjd5Bks2RsrXgtUgxxs9 RwS2Fhcn7YzJ3BNQvpd9DtVwba5erh+z7hFf2EsVRg7dzb3c+gXYph3EWAlrGH6R5tD4 PkxOB/xsWTEMJ5WZDRoYNsaD2mayhdLWsOvr+IXNnRjIhQgaP9PCRV2cTkpiEHiVnfTa Z+DKoy3U9YymrBsQ+ksWWXgve6UkldRWEXAYQGJTpBC5L9ySojct381wB/TNEDojS3fV yg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87nt8h0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:06 +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 30PGIZOT034260; Wed, 25 Jan 2023 17:06:05 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6tt0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5MNpyII+s/ltFr/s1HrgfmZJfmFFdkx2sDc+9a7LFlTnQDmM2JHWTb7gyseSyiN5xS+88sThKfFq069vkbYQzvlOoJFlqzl1wpe0cOUjvlJW47vQkgrsLM6SSDwTJdac9Md0lDgB7/gCpmOkAwIBMzzvLQmUbdMl3jA/VX8pIfLM7o7rBFvUF9n1IrL5lVydoDnQVbvPZZqQfriwmYAXDYsMzx1SZGo7BpkA5QibCHL72K0tJ+lBV2yVWWDYE3Z/q0CMTquB84mCEWE1vIak/IRWlrTg+ZIDFs8sEBuOPiDFMenHCPV5q5ROgxCsJ5Z9Tz1wxeeB8Bf1/sDez8rZw== 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=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=NnkPzP3wCrWDPHKji0X39vgjJ5iP2rsuz94o+UlWgNK8RfOQrraCjcz3Dn//Vr2gL6FpuElnKfisuCZCm4RWtWoLr3FDl8+SvrZMsUdL1tjIHjTaVqJVRlJzVSD1VGGYreBlkDe18D3TcwJp5rISzeIidAnbglQeETyoJ3sNRhoTOWk+FqDlQdM/pACX70pySPZ1xTg1Wni/nFJ3EcTY8N/ZD9R3ZkAL0e0DQmlZ+++GlkmwZkAaCxcib0uOtY4VEpohUcJXFAiXqi/kMxj35RJ15daLHKfnVoDn51p7hVNHfV2+ZGvRbD3fxLfx1NVZOro8nnmVhs7SgH4mRYAi7A== 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=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=MPejZRHMcHGsFAgFuv1iDzz6j4Y2hssnv8GuF3DR+Zr3Zl+okokegFy2DKp469VeITyeH7Q8+ZxdlYyhCpCcCpsWhaFLaBxuLmww2+niTgZTlJuV5e3+xTmyoktMs4moCnYYJ77V+oesyHIx/uDdaE0OuaHBCqCZhLh1hz0yBrY= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:03 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:03 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 6/8] mm/hugetlb: convert hugetlb_add_to_page_cache to take in a folio Date: Wed, 25 Jan 2023 09:05:35 -0800 Message-Id: <20230125170537.96973-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0108.namprd03.prod.outlook.com (2603:10b6:a03:333::23) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a4fcd86-f47e-4e5c-db2c-08dafef67071 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IswZdBojMPHUO85Amz2DGUexXSkBxWHzKoiQ8k7hUucsfb4YNXeed48L9tczlFOpyRBL6h5TH4LmAA0VGJJoaBhCYo6XnV80GPDOreAckmaThj8XsRGSU2RdUykQQ+WwO+LJOyqcI97ErMIQPKYpwOSr8aGGPQ8a1DGKcm0ZfkG731beU1HsWfMdgCSPBrhBgmW6UpUlCB4outZxUpLcTGQ4jDk13rZeLf3YH/U5JdAbHUEavqKRtofv9dLGG7/ch2Y7xHTz0rGkkPyvBl1EpN2M5ou9RFX6cM85TQJlECEqv0MoU9aMP7Ogsxa+cU3I5HMmAbVll+pEcmxWyrg6VwFSQkMO5thu5J1w2i6kD20iSDoTwFwFZYL7tk8Tv9O3tPq8Eii+LJjd5JWE+QhWHGb8B3y0VlZizhbDh5yGZ++5+LsZXUd50jwjQ+RrV4OOYZqYseiQtAmiK5/B6AIiT5WBI89jAZPQHo5kB4Fktjvn0prGO/TR15h0ZyQ51cNuyKGM1pHdfQ16rnVy/NaUEIL66ZmWNA5zJemNHoC1u0YaIpKmIaZRgIyXAKQ6AEhSomYl5sRBKY/8voWUkk0kQVqNp8ovlP57ersH+PCnSrh947QEoUZzBkvBw8sqR9yFXYE2yqNGazk/KEjIopYaUA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B2PoJU9SE3Qr1u4O3T0zCWsoThdBIpG8x2cXsHNa5tE0btTyiYYU6YFx4uuGhdseCNc1teInjq2IL6dG6gK/kadvDQuKxLsNEL1hwHIRCvJyEvxaeJLgaMS6ROe1OyhQah55EHqls8AdVTNo1JgWSwnbKILPvRMlaLKVANmlb27q6rghe+WBKO+9MIk58EPLe+p5pD6Bo7pCMlRkl5Trb4t/q6F0g4HSeqKXkwBCvABxyeL6/T1MdOpfwmyodf6UJpf9wLy/4amCaw7673yyHxd8DTixrBSvDkk+95T8ot6K/5Vsli2I7KTr+vS5cavqc1ghoYDEJ+wv/PTo+vuVrt+0qNwzXlNRutGj2nMuyzizafS14l9uRARo36a/lJilKLeNRu+H9LmYZyyVggErto5Clxvesj4uf/Ddf9Un1Nmpc/I3It3QjSeh3DEcWVbmRWFz6+DhGfvPduQQmqjkBhj/GNrWBv67U81OCoz5cj/GtJSjvX13dZWZAVD/k7uU5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tgHCSV/Zb0gPaAn+Ant48ZA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4fcd86-f47e-4e5c-db2c-08dafef67071 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:03.0140 (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: aE56grQRDHRXpa6Xwrl5wO5nzw3F5cx1AbVCx5p7LvRXX0fC40tpDhiNrNyU4oU4AWGuuZplhZudFvOnxuUu5d/tI98kQScCErdOv1KMdDs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: KWx5RzlD4IJLLaHM_g8T15HAtQArYb4I X-Proofpoint-GUID: KWx5RzlD4IJLLaHM_g8T15HAtQArYb4I X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015368509540057?= X-GMAIL-MSGID: =?utf-8?q?1756015368509540057?= Every caller of hugetlb_add_to_page_cache() is now passing in &folio->page, change the function to take in a folio directly and clean up the call sites. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 2 +- include/linux/hugetlb.h | 2 +- mm/hugetlb.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e2b8a00696bd..43af1753de5f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -871,7 +871,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, } clear_huge_page(&folio->page, addr, pages_per_huge_page(h)); __folio_mark_uptodate(folio); - error = hugetlb_add_to_page_cache(&folio->page, mapping, index); + error = hugetlb_add_to_page_cache(folio, mapping, index); if (unlikely(error)) { restore_reserve_on_error(h, &pseudo_vma, addr, folio); folio_put(folio); diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d46f9db09a2c..67cf712c97be 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -722,7 +722,7 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); -int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, +int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, pgoff_t idx); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct folio *folio); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index aad028706fbc..ab30f8550631 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5662,10 +5662,9 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, return present; } -int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, +int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, pgoff_t idx) { - struct folio *folio = page_folio(page); struct inode *inode = mapping->host; struct hstate *h = hstate_inode(inode); int err; @@ -5677,7 +5676,7 @@ int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, __folio_clear_locked(folio); return err; } - ClearHPageRestoreReserve(page); + folio_clear_hugetlb_restore_reserve(folio); /* * mark folio dirty so that it will not be removed from cache/file @@ -5836,7 +5835,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, new_folio = true; if (vma->vm_flags & VM_MAYSHARE) { - int err = hugetlb_add_to_page_cache(&folio->page, mapping, idx); + int err = hugetlb_add_to_page_cache(folio, mapping, idx); if (err) { /* * err can't be -EEXIST which implies someone @@ -6269,7 +6268,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, * hugetlb_fault_mutex_table that here must be hold by * the caller. */ - ret = hugetlb_add_to_page_cache(&folio->page, mapping, idx); + ret = hugetlb_add_to_page_cache(folio, mapping, idx); if (ret) goto out_release_nounlock; folio_in_pagecache = true; From patchwork Wed Jan 25 17:05:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48219 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp385750wrn; Wed, 25 Jan 2023 09:11:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXs5XITobW3h2NEB4QPsM2HcjHjDmsLv5Oz1L5vDoZwWbvnYorre7qIc/jta0ZNcTKdm91nY X-Received: by 2002:a17:906:4094:b0:854:956:1438 with SMTP id u20-20020a170906409400b0085409561438mr81019847ejj.25.1674666675669; Wed, 25 Jan 2023 09:11:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666675; cv=pass; d=google.com; s=arc-20160816; b=dH5scA0ZePaRIRZja3RL7LB/dQDmV6mZK45pqAkebRjZjwtGZI3I4yU4MpllJ1A3dw /+SwwyQrglEffgcse7LbV/IxsOf/QGtULfeqCOwBqZFOcp1d3OqERxUSvHJOqXW9KGf4 N3l8eUZZ+udtE43ZSpk/NC39mG+P2XAsyVs9Wdq39WPSCBYszQXaT5UxtBT0RxSQSGjX o5+mhgt6Vr8KmcDl2JyuPDBwTlwx6YRr/ehJwqG9v/IQpou6ZLahk8FiSqnT1CSZ9e3l JM1JzoDS3iibY3LRygFY7racs8HD7Yx4gXmON6ggN0k6YRV0izdFFai4MuPwdCG8W5rY 4uGQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=UzUYoLeHcHZGfz3ANyDrFXV+tgAoQzom9/ojsmWd55GkIN6Q0rv1G4p/GNgDIEG+FH 5huORL+Ig/B1BTv/k5Z4GqBWC3uT1l5KKHHvqb582+ZWI3oTBSKzgeIjwcO5BYpcwU1S nqWILvxsr/OvfhwQPotDOl4mtxcEanQXCRo28H/oiIiMmIMgIRHgmEDIKmsWcPnStdmU VUwQB64/00BOXU1r5Ci9H0IbqxWmpX3BfH6LsJk4Z8dqf2wPwaIU8IO5SSpjlGG1hkjx XQV8foAC7YoHNcXmK9wlDMZA1Rlx9azDumlKA5PKnGLpfB7A7F2+cnNOqZqnbXKyungQ q2ZQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="qrRs4T+/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oxZeFp7q; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fw19-20020a170907501300b00840f80a0b03si6801569ejc.118.2023.01.25.09.10.49; Wed, 25 Jan 2023 09:11:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="qrRs4T+/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oxZeFp7q; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235836AbjAYRGx (ORCPT + 99 others); Wed, 25 Jan 2023 12:06:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236073AbjAYRGo (ORCPT ); Wed, 25 Jan 2023 12:06:44 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D5655976C for ; Wed, 25 Jan 2023 09:06:28 -0800 (PST) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFPxlv029537; Wed, 25 Jan 2023 17:06:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=qrRs4T+/nah5RKC3ZXPKGruglhSCbp4MPkpevczlMX7d+xBbNBjxcnFhhpU13k8msE8h x00wX1ycgaMKOSUQg83qGy5WbtTx6tt4Y2G2zyDLJFhRYQG8TNwBiqlv/jhMWo9JNMBw gqJ2xgoYIBdGj34/LqftAOWvBJbLzAik99RsqwacnH8FoihhkRXKaWK/boZ1IOEVWcJb uDjy5n60XoK3dDsJxNEM+okYd8A4PqeyBIG4Z8P0EA5QOyB2M3nhdwPZo0wVeuzDNINi jgixy3nWhWtpSKgz+XD9COm66NS7PlDSTJIieL1YE1DZzEvxOl3cp5M80CRtdWtV1cTh HQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86n10jrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PG4N3F009387; Wed, 25 Jan 2023 17:06:07 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g757r4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EanRIY8s+MJm7mY4NfGK1jfY6Wy+3QfQEqfHJjXu01CRJ7wfdJ0nkDJp+RVLMGaV2YPJ3mp77IuUpwqDBxUSQI1v488w8oYgfF1OxDbFG+y5wP6IEftRYs3cEQVqbU7gCcEwrsl8uuVNhOae4l1dOcYi0MShwm+XAGG8M0JY82pax42Y9XMi+qIXewa4VE+MvjDEKcaAFv1vCVQZqEM1HFPgdPFKT+03qb97RaQ2VHNZz6TgNAxg4OOFlf8x5hmYBAVL2lBpBbnHIPF1MCgv3x8QX+IVLXD/sYhHWxKsYx55ci6tV0zfwyFAS2jyxdRwtujLRO1li5a4+E46kFrWLg== 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=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=oLTBs3rAtqrLZh0cG9FWdbrJxTBvdTLwaaQJ82AE2cpW+xm+mhEVoJGIERov7V+wgWQyJmD6jO2JfhPiqZRZUuvUECahRYIz6tacKNRKVBco8D0YuH2giCIMeZDAjCuj6eQuDyLGOwOOxdEfb6s4WgjFZX4quqN4YBEqv0zHa+q6DbDwERKDgxprAxNhfxOYQVrCiuHuQkbuxhkbpWVXVpC+J3n9cwXCVpF48taf7hgpZuzZzRS2NTXNGas5cc84r0aQ8LNOy1xGJ3DKz25aI9Hw0aepVt6tYNddOTrTE5LTAuQHHtVsWyiwBNQdD9MY8ueij5ddj3FnPG/yg/VhwA== 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=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=oxZeFp7qZYnhSiLhSuA909YCiD8VqTYOSNFBtsxGwRplwRhaj8/PLBA8B1h9KhigOoNX7rysVwAgPHx8JbLyekEmReGz/3+Fm4OAZuqfY/WQtJRYy4ERMrwrqB97TpA+1I+VWVCxw5kezKOhSMTkaqEerRkmo0aTv8dwiCd0688= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:05 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:05 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 7/8] mm/hugetlb: convert hugetlb_wp() to take in a folio Date: Wed, 25 Jan 2023 09:05:36 -0800 Message-Id: <20230125170537.96973-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0233.namprd03.prod.outlook.com (2603:10b6:a03:39f::28) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c7da166-c20b-4d74-a41c-08dafef67199 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RANY4V4l3gzGdxcpIJR8HhpGcu47zOXGBLvYbZsOOx3qt/3oFCmY3jdwbn/ALvk/1w3mt/UCYqHQTq8uYlUEH1VS6defQ1lQYUUpL96xEqU+hbSus/p+5N8Bt4VCiBZ4t3FvtkJ8T7L9yZOvE/sUfCNrH7G+z1OqG3Nll3R1X6fjV64ogIw8jqgZsu4Aicxz0bXWQSG6jksQVXPw/TGJ4d2cOElaKynQVktZjdGDfLCn9rYeSHfkhS4vaRMpsVMyHfhIDRJJir5xheaOo08CsaYn5l4j+BT1pVdpb95S+G2mSu3KAXwh72jojWv11xT48sB3s9XVMDtiJ2RJccEYsIdSBEQLqREcrORltfKuTVeXs+tMNV9D4Unh3d18rpFXQmm/IxsX+zIVYtn4nQB9s5Re+ryW9ekPsQ+ut92kh3UHrUK2FYyDSGf6MYPgdy6qNSbqc25sSq98NLH9RE5XIKqRW+1ZWUxhCkRBicz0uulhsUTcen+Wh9A3CBPYwMvfp3uwvrN42OHhygpfc5hHlC8TcicmYrzmYEg6qxVtCL0KB0DavBhyNS/kiEHGhWUqgylEnA3L8axEp7xgi912kW8SMNnDxHN0Sf7Zi5Bn/RjIkA33mGrhNBO+1N8bw13WKsR2Kx+2XUZG5MmBvKpBiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003)(66899018);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SgFEj/uxRRUF3FaT1abQeHHo7F+41oc1NhAAiieXOLV1hXnZ2OmOtl/3rwsKgSB5xKwJPJV0pU2XtB4b3F2MV99W4I84N++hpvgFtNVvGybWIieL1ZkfiMVR6+dl5P3xz9s0L75BJUeLMNdf8ie5c1eNbrov1Mza8t+HPD3FtvQywaC7jNF/v/LWMJGQcbW5Rh9SaDWAd2Ly3Y0iffzWJvLd2OZ9hTBijLyHYR1ryzr8XnPpnAgJT7ef0V1yyFHQUV318yZXS5h31PFlDF1iLzOpWRugHO3mG6UlDE7VUP1EwegoD5KC3anAY8ASVtRKhIF28Qq6R/FD0DxjJhfe4hdclGv+NAH7J3t9vzleM2z/CbPXmrFeMnvJ1fA0hdCk9nqR4nu2pRXsT2fnn8JAsHuLZe4jVtnHzfjP9iY4gmTO4n9PhW/Z2n+IQ2cfEwmGyNWKd1+R1WfyqDZ+kDVvB6Pa5GXG/30REjJXvXZ4WsudkFcj/mfWdK9pXvgSodd+7AU8teQecXAM5B/A5D/tWBz9wPRojpRo+807xdR8gujoQx7FGWDCo9574htNxwHYI1OSA8vU05N5C72o0Jy6QiEz8zWaoq7tuZmrrZmyVBFg1MON8ets3ugOOrfuiyjW83HdJQC3ZNbN5bwQSG0tOnHPRt6Rz+ttPjSNsCLYDfmYzFv80SJ6Q0SEDO4PTbMvU35cAWiL7gIIv0o6Ku+J6gX9dFwy9yPIBbPg1YU8EyJYImH3Ccb+00J5jjfeM74cMHIWEoJjLTrC6c3ZVJqerO5nC8y/YXJDYOAzfZ6IWKxMhdoHKQACF9MFnUT8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MrZS9QgXTkomA7KYLMQl7YQZFlvg/SkQUD6ccnS68aJlmcJktyL+fI1zXdjRl4rz7k6Lr+z9/9PUkKNQ1337cEUTg8pTo7w/F7gYSfkq/T7hCz+l4/jrUO2e4N7q5iB+cDhTA+c5J+Bu7DpA5J6m68nySaAPi35TQKG/2lSzfso8djQz35od213swjdfHts3FYLgcOSf8Snesm3r144N/YScJpf3uc/5IYkjVD9+S7fdJetjMXi+wPbkMcOsgar1iW5LAJWHYt17eWH9lvoCWkaSkQUry1nS81SSRFaXNMzLEBHOuHl8YgU5HKmxAqInsbDYMNVg8/vaNZwXS2zwPhHasjBx+1Zq0kgsHNwoNvPEHSpeTUpybducaVDw0ILwTgqyj+UbNbkw5Q33OtMPOvW3HlaICdM8x+eVSDP08bEFv60uIlBFKTXHdFElGaGG2mtwIAROiEEqwUPly91LpeMMCQA7ZppcumFUUcqqRmwQCIfvEnO/ZGBZt0yfjc1tpgMeIcNk44xWM31civ+wAHZp4/ioRQfTysh+2fJmYaYNLqJUQPzCq7TgDsP4OtkbMUzX71L7mZW+XvVruevtITa5uQ16L/89UA/sRVlRsFgPJY9AT6H1J1Uf6RLshseyIz+/8oiRrkp7Aisbf0r6E3rL20+OID/9rAD6ox1Iqwgj2GJciV5wr3wJOlWZnhzQBllG9y3hfdFbcjrMwKqI5DTYdJ2gOueOgREICWvaQ5p3aYEiwRgadcnckZXGf85ZUD7LfKANO3PkjiPP0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c7da166-c20b-4d74-a41c-08dafef67199 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:04.9850 (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: oGzF/uRCxv0B4b3I7nDeJXnpr/DRe17aYBUEK3O/PCA4UlcHuSPtNgpftEN63psau/WC+Vvz8RIQJTbwxc9YlGE1leNNZWcyEn5jJglTIko= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: H4MkHNqU6PYG2fkN1Btuektho_ZnFs5T X-Proofpoint-ORIG-GUID: H4MkHNqU6PYG2fkN1Btuektho_ZnFs5T X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015283709490386?= X-GMAIL-MSGID: =?utf-8?q?1756015283709490386?= Change the pagecache_page argument of hugetlb_wp to pagecache_folio. Replaces a call to find_lock_page() with filemap_lock_folio(). Signed-off-by: Sidhartha Kumar Reported-by: gerald.schaefer@linux.ibm.com --- mm/hugetlb.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ab30f8550631..b6cbba105ffc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5472,7 +5472,7 @@ static void unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, */ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *ptep, unsigned int flags, - struct page *pagecache_page, spinlock_t *ptl) + struct folio *pagecache_folio, spinlock_t *ptl) { const bool unshare = flags & FAULT_FLAG_UNSHARE; pte_t pte; @@ -5529,7 +5529,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * of the full address range. */ if (is_vma_resv_set(vma, HPAGE_RESV_OWNER) && - old_page != pagecache_page) + page_folio(old_page) != pagecache_folio) outside_reserve = 1; get_page(old_page); @@ -5922,7 +5922,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, hugetlb_count_add(pages_per_huge_page(h), mm); if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { /* Optimization, do the COW without a second fault */ - ret = hugetlb_wp(mm, vma, address, ptep, flags, &folio->page, ptl); + ret = hugetlb_wp(mm, vma, address, ptep, flags, folio, ptl); } spin_unlock(ptl); @@ -5985,7 +5985,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, u32 hash; pgoff_t idx; struct page *page = NULL; - struct page *pagecache_page = NULL; + struct folio *pagecache_folio = NULL; struct hstate *h = hstate_vma(vma); struct address_space *mapping; int need_wait_lock = 0; @@ -6067,7 +6067,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* Just decrements count, does not deallocate */ vma_end_reservation(h, vma, haddr); - pagecache_page = find_lock_page(mapping, idx); + pagecache_folio = filemap_lock_folio(mapping, idx); } ptl = huge_pte_lock(h, mm, ptep); @@ -6087,9 +6087,9 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, }; spin_unlock(ptl); - if (pagecache_page) { - unlock_page(pagecache_page); - put_page(pagecache_page); + if (pagecache_folio) { + folio_unlock(pagecache_folio); + folio_put(pagecache_folio); } hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -6098,11 +6098,11 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* * hugetlb_wp() requires page locks of pte_page(entry) and - * pagecache_page, so here we need take the former one - * when page != pagecache_page or !pagecache_page. + * pagecache_folio, so here we need take the former one + * when page != pagecache_folio or !pagecache_folio. */ page = pte_page(entry); - if (page != pagecache_page) + if (page_folio(page) != pagecache_folio) if (!trylock_page(page)) { need_wait_lock = 1; goto out_ptl; @@ -6113,7 +6113,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, if (flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) { if (!huge_pte_write(entry)) { ret = hugetlb_wp(mm, vma, address, ptep, flags, - pagecache_page, ptl); + pagecache_folio, ptl); goto out_put_page; } else if (likely(flags & FAULT_FLAG_WRITE)) { entry = huge_pte_mkdirty(entry); @@ -6124,15 +6124,15 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, flags & FAULT_FLAG_WRITE)) update_mmu_cache(vma, haddr, ptep); out_put_page: - if (page != pagecache_page) + if (page_folio(page) != pagecache_folio) unlock_page(page); put_page(page); out_ptl: spin_unlock(ptl); - if (pagecache_page) { - unlock_page(pagecache_page); - put_page(pagecache_page); + if (pagecache_folio) { + folio_unlock(pagecache_folio); + folio_put(pagecache_folio); } out_mutex: hugetlb_vma_unlock_read(vma); From patchwork Wed Jan 25 17:05:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 48217 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp385250wrn; Wed, 25 Jan 2023 09:10:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXv6Yj2u43QaHzTOj5FjpnxBK79YXlhkzNu4w8aHrQzu4lIqBARVvyrUTYrNqJQI31quDLqG X-Received: by 2002:a17:906:948e:b0:870:8a70:d630 with SMTP id t14-20020a170906948e00b008708a70d630mr36187812ejx.17.1674666643664; Wed, 25 Jan 2023 09:10:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674666643; cv=pass; d=google.com; s=arc-20160816; b=Z9jCKDmgH5HF1Od4DQhgfuM9tt3uGHS0cLTWcoehjY4bwxC/ZUXbPsJl3RY3OTzinp Cgm+Ss6FiWH0DcUr+9KAkk0jyH7DACs4dLL1EJmrYIITd4uAQq+lmFAJ3NbEk0E34uwA tDNB/UOzwKy2XXeKpVrjUCVsI2lrvbRwKJ76+6jo/I5ZA5Pvn43Qn1oNP3K7Gi2/dDhF gAs7Fd2iczw8NadUCvQpgiUL2B+eF7bY56/tpxZqI/MuwBfJYyB05HaTbLIdqhDwIvkD eEXclABpCX75hc1bQMO6+CcxwPyJClx5N3P4wgY4gba95qKQh2HDXyKMZgXJNx0IymlJ ymTQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=Q7JjNCwV+sHQ/oyj1sclbTKaZaQNg12E/6/spWTMeamVPZLjwfoEy2HNXyZhPuwDQ+ favQI41K8tGg6DeDd6P+HuBML8NPjMMwuF62JD8QOI+lU/mVdtdTg/DjiQrlxaikiVoJ KA3fSRt2OfBNQtKARXmEqeB2Rgp1FFkSheHYn7FI6/uxuO7w+/5Hc4PNXx8uCUTHGzsG NSGKjVOx9FHwSksXs9ed4OK0XmqGJS+gBE+yWJuv6gMafZBXvGsF4cZdr2/SEvzQk/K7 OteMYwqSjB5e36yS0FeCLz5/23TvAy83q2lUgisp7mKbCMdbiI3wTN4M7br8ZA/h46Lo Q4Ng== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=kU9vQjFJ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=LzEdZil+; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 15-20020a170906224f00b0084d4730001asi6758905ejr.89.2023.01.25.09.10.19; Wed, 25 Jan 2023 09:10:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=kU9vQjFJ; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=LzEdZil+; arc=pass (i=1 spf=pass spfdomain=oracle.com dkim=pass dkdomain=oracle.com dmarc=pass fromdomain=oracle.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235941AbjAYRHK (ORCPT + 99 others); Wed, 25 Jan 2023 12:07:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236084AbjAYRG6 (ORCPT ); Wed, 25 Jan 2023 12:06:58 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F58F5AB56 for ; Wed, 25 Jan 2023 09:06:33 -0800 (PST) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNj4w009521; Wed, 25 Jan 2023 17:06:14 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-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=kU9vQjFJ/qQYUDydbc6I8CvCgLX7PqEGdEh7pRKCxujMa6evhS3tAo4xqsx/vBkC47sN /uh8k96hVPKH3r/4gWXtInBJl2R46Zdo6YkqPDrO4vhEBiwfFnUyU/GtF8PGS/yf/utP rWxnF/72amaeB6tbF97J1ffhl4f4uDx3AulR34a9JLOfvS9dkmU7vVAg5YGc7MJuGeKb IF2nUW28UHDeUHfVlnxudJ/IMGKQsEQ/vUMYML/2HCon52h4m2JFQ7VAjgV9ca6G12ll 3gdlcKjx0G26kP9MQyxa9kRTCBP/lvuDXgIyB51M/vaCOSIIiWJZoT4RbYgJ/B3XjsRu 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 3n883c8jf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:13 +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 30PGGDHC019163; Wed, 25 Jan 2023 17:06:09 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gd5hn4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5D9QgTaoza/JRC/q9nOHq7vBJEeNn+PeQGQawEeFd8yBPuzsBZN01F+pMHImXtkgHIzlJz6HaWDPGIxa5KumVPaqHDJ/GFnEef06OTEPKdsAJ/PsFuQwujtSHMGCvVz4m+J0PIXjbG+Z3Z435Pz/BhW49FSnsRKn3HYzOEeeC6lAcp+ujsELD+slaaqZM9jtP5INuVhTKAkSoLvriYnsVY+CCeyDCWqcW7GuYYpxOPTlk28zkzLo2bHF35vJGYgESByDBdFzQ09a6ERfBPmGH0/YFEJahyRSJyJwnfHdiJDFz63XVztw4UZgHinPZJ2iNLpLTd3qIrmnGt+PEl0DQ== 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=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=Uel6goyUaSBdF0FXFip4MAC4n4Z12kD1a4vxiFVr1HkARi792VPYdv4F1QJqsp9/0kMfzR6zEnq+ZmiFx02DTHwOfipjGBYaP+MrNCgntc6ceq1vI0QBD+mJIxHnk9vwq4Q29UGFkdJs4B6Cp7brtM8aS9HR8Y/u8EyQ8l9bohVDA41jLRHUheaY0LrqeCI27UYvNrG1DfeKdaageiYMxdT5ZBQ+2zxZ6L0XXdor5Htm3mP8CKoXZ0zpUBy4//L5xpd5MU94WWadT8KUdZNLNFj8xq77OGdSlbXkADwWwOBepWA7W2FrBm435zYV2XubhUOx881d3waKnAoWGm6gHg== 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=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=LzEdZil+jLIpjwpykLEW+b2Af6MtTX8FBqy5VfJwZzEo+Jk/j/LdDcq94mdqAXQaV5/Asul6puc9qSLWeM2N/PiUxAFNWAR71oMj4d9KJpfhPJLO9avz2rHTST10v5LWNCJwjbnBOjnjmwZd1pPVdmaXIVeO8k+P2WXVQ35fG20= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:07 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:07 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 8/8] Documentation/mm: update hugetlbfs documentation to mention alloc_hugetlb_folio Date: Wed, 25 Jan 2023 09:05:37 -0800 Message-Id: <20230125170537.96973-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR02CA0039.namprd02.prod.outlook.com (2603:10b6:a03:54::16) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 82001441-0492-40be-a7a6-08dafef67331 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kJq8bQSJGDYZDqAVZnw1hx7Q3gdFLya899ow5Nl+QJenlujPH1TQubjOetPfSMElnJ4gbzTecTVh16gHFoJb33FK/6vnq0wiVMAjN/IBN3FYDwTx0GMro5LzcFEEKv+maxj95t7szfAQK5no4K4yjqdEQxOrqliNr5jEwpVuj4iJydPcqdAgVFJGFPYNV645k/soVn9dXG8zBNYOgpP6vLL025kBUm8iE1+8CZ9s5Z+TU1kvZN1IZ2OpJifWHAq9wdW4+UptqE3vmcNipuerO//OUR/DVlELYLQhj+tas0ktHC7NV831RrPcGS83PUlBMyBMVbKiD35/9FYNsXJrx+13i7Svbh+kTqYZtw++3HSDpi2mtbzNhTXYH4OJjtEydbPccAf+NsVoRZ6CChROe8NRvcRnPX+QvR9H/nTQ4rdpMhjOw4ocMUuqpHHzsQb9xnLF052loArwBoDOLGDVYPSa8A5t6gErqy68MB1d/0DB9y3Mq3QNMh+GnVqiyKooeErXtaNMKOIoG4xydRFqEBNOjC8cZ7SXcCa4K3v6Ta7pKjGJPqViXMJRf2KVSizvrxmUde6Mmzl2OwkkvUedWuPK09KJ4tdJCDfLcsDNl18G5Ja789lRxj4R7he0DeM0ylhVOmIoEZGuZMHYe0XuGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(15650500001)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(66574015)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zC1ac90wAzjNHKlziAYskOVUKmv+?= =?utf-8?q?E9EIORHkX55RzxnTr7WRz4Obw9NPMhhXuCY9CIXqWjMijDhj4RWYo7EMOCheOkAop?= =?utf-8?q?SmwJEu9ECnDofOTMhLrL5RmrVVthmLsd3IUGyyh956uub4o38jIzmpzZ/qKNdSsT4?= =?utf-8?q?1EK7XuLyI8nSbfAodm+OtuXIZQOrfNRThM3r8Wcrd5VgTzSqKeiZzuZDrNgayOt31?= =?utf-8?q?eaaYCZMVTq8tF8bGJuID/hY5W1ZHy/zKGTVEL8mlCV9imTlgPJStyWC2sBs7oGwVH?= =?utf-8?q?+EiN4Es6kE0cFLDjuTIH3v7BGPcbxfm4gWNu2txbuGcbNLuh2MuxHlVlIOuduv+1K?= =?utf-8?q?3IDNpiV2g8Qq2xBJDl0/1tpgxWzbCz6KS6WEp5bDcE0N++Ox3v3OxPOtt4LBgmZEv?= =?utf-8?q?Yflb7g2zcoY1f5tJzKmsyP2sYaOhfBAHIr5Sli3BUKmKiVslakLYE4IrdPHGJw+rC?= =?utf-8?q?nnHZsxfiQyx8VvvDL/XEZF7yWHVGw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maHZCf5cafMK9tWtslJhLjpL3QcjEwqAg9JjCKkv?= =?utf-8?q?10FsYEECQ1VFOjE260eOvwfqNde3DrdiqgnPedYLgdlCO7PbP6onbPUESlx9vlgw3?= =?utf-8?q?LvUU1ooAl0dtPUzfKGOwYdBc1blZ7y8YU4kt2lEEHYQKCrPVf8klyrumM27HCv/Hu?= =?utf-8?q?jHZQ0oFyOYGbgdVj7+zBvQRrldDs0t7xT7yTOud42cDulXktKSBzjMk7GLbe1Y43M?= =?utf-8?q?8WXl2xHKXz7I4K1bVjTx3Ue4dwl97Vcml9ijPrBv4UxPV6KjaJnqOGNVdFp5WRFUk?= =?utf-8?q?MjUCp5qX1ASAujb3O5j4BnrnN1g4F2G//imKLiNTv1lkzYygEAeFON06v/V5hSb7B?= =?utf-8?q?7N+nQVmFvBas=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82001441-0492-40be-a7a6-08dafef67331 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:07.6244 (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: smKWXfr8g+q7OiBlK7jcb7duTZFN0GKvLR98pehHC4Y/N/QVP8Upd5tUI0zSB1K3BtlhAg50BmmKIZ77LoKzFC4dO82ARlygJsQGh9vjJbk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: Vlw7kiCJ9H6_bVndrEOg8GZCmStiFpAX X-Proofpoint-GUID: Vlw7kiCJ9H6_bVndrEOg8GZCmStiFpAX X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756015250539986407?= X-GMAIL-MSGID: =?utf-8?q?1756015250539986407?= Signed-off-by: Sidhartha Kumar --- Documentation/mm/hugetlbfs_reserv.rst | 21 ++++++++++--------- .../zh_CN/mm/hugetlbfs_reserv.rst | 14 ++++++------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/Documentation/mm/hugetlbfs_reserv.rst b/Documentation/mm/hugetlbfs_reserv.rst index f143954e0d05..611728c49bff 100644 --- a/Documentation/mm/hugetlbfs_reserv.rst +++ b/Documentation/mm/hugetlbfs_reserv.rst @@ -181,14 +181,14 @@ Consuming Reservations/Allocating a Huge Page Reservations are consumed when huge pages associated with the reservations are allocated and instantiated in the corresponding mapping. The allocation -is performed within the routine alloc_huge_page():: +is performed within the routine alloc_hugetlb_folio():: - struct page *alloc_huge_page(struct vm_area_struct *vma, + struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) -alloc_huge_page is passed a VMA pointer and a virtual address, so it can +alloc_hugetlb_folio is passed a VMA pointer and a virtual address, so it can consult the reservation map to determine if a reservation exists. In addition, -alloc_huge_page takes the argument avoid_reserve which indicates reserves +alloc_hugetlb_folio takes the argument avoid_reserve which indicates reserves should not be used even if it appears they have been set aside for the specified address. The avoid_reserve argument is most often used in the case of Copy on Write and Page Migration where additional copies of an existing @@ -208,7 +208,8 @@ a reservation for the allocation. After determining whether a reservation exists and can be used for the allocation, the routine dequeue_huge_page_vma() is called. This routine takes two arguments related to reservations: -- avoid_reserve, this is the same value/argument passed to alloc_huge_page() +- avoid_reserve, this is the same value/argument passed to + alloc_hugetlb_folio(). - chg, even though this argument is of type long only the values 0 or 1 are passed to dequeue_huge_page_vma. If the value is 0, it indicates a reservation exists (see the section "Memory Policy and Reservations" for @@ -233,9 +234,9 @@ the scope reservations. Even if a surplus page is allocated, the same reservation based adjustments as above will be made: SetPagePrivate(page) and resv_huge_pages--. -After obtaining a new huge page, (page)->private is set to the value of -the subpool associated with the page if it exists. This will be used for -subpool accounting when the page is freed. +After obtaining a new hugetlb folio, (folio)->_hugetlb_subpool is set to the +value of the subpool associated with the page if it exists. This will be used +for subpool accounting when the folio is freed. The routine vma_commit_reservation() is then called to adjust the reserve map based on the consumption of the reservation. In general, this involves @@ -246,8 +247,8 @@ was no reservation in a shared mapping or this was a private mapping a new entry must be created. It is possible that the reserve map could have been changed between the call -to vma_needs_reservation() at the beginning of alloc_huge_page() and the -call to vma_commit_reservation() after the page was allocated. This would +to vma_needs_reservation() at the beginning of alloc_hugetlb_folio() and the +call to vma_commit_reservation() after the folio was allocated. This would be possible if hugetlb_reserve_pages was called for the same page in a shared mapping. In such cases, the reservation count and subpool free page count will be off by one. This rare condition can be identified by comparing the diff --git a/Documentation/translations/zh_CN/mm/hugetlbfs_reserv.rst b/Documentation/translations/zh_CN/mm/hugetlbfs_reserv.rst index 752e5696cd47..826a50c47389 100644 --- a/Documentation/translations/zh_CN/mm/hugetlbfs_reserv.rst +++ b/Documentation/translations/zh_CN/mm/hugetlbfs_reserv.rst @@ -142,14 +142,14 @@ HPAGE_RESV_OWNER标志被设置,以表明该VMA拥有预留。 消耗预留/分配一个巨页 =========================== -当与预留相关的巨页在相应的映射中被分配和实例化时,预留就被消耗了。该分配是在函数alloc_huge_page() +当与预留相关的巨页在相应的映射中被分配和实例化时,预留就被消耗了。该分配是在函数alloc_hugetlb_folio() 中进行的:: - struct page *alloc_huge_page(struct vm_area_struct *vma, + struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) -alloc_huge_page被传递给一个VMA指针和一个虚拟地址,因此它可以查阅预留映射以确定是否存在预留。 -此外,alloc_huge_page需要一个参数avoid_reserve,该参数表示即使看起来已经为指定的地址预留了 +alloc_hugetlb_folio被传递给一个VMA指针和一个虚拟地址,因此它可以查阅预留映射以确定是否存在预留。 +此外,alloc_hugetlb_folio需要一个参数avoid_reserve,该参数表示即使看起来已经为指定的地址预留了 预留,也不应该使用预留。avoid_reserve参数最常被用于写时拷贝和页面迁移的情况下,即现有页面的额 外拷贝被分配。 @@ -162,7 +162,7 @@ vma_needs_reservation()返回的值通常为0或1。如果该地址存在预留 确定预留是否存在并可用于分配后,调用dequeue_huge_page_vma()函数。这个函数需要两个与预留有关 的参数: -- avoid_reserve,这是传递给alloc_huge_page()的同一个值/参数。 +- avoid_reserve,这是传递给alloc_hugetlb_folio()的同一个值/参数。 - chg,尽管这个参数的类型是long,但只有0或1的值被传递给dequeue_huge_page_vma。如果该值为0, 则表明存在预留(关于可能的问题,请参见 “预留和内存策略” 一节)。如果值 为1,则表示不存在预留,如果可能的话,必须从全局空闲池中取出该页。 @@ -179,7 +179,7 @@ free_huge_pages的值被递减。如果有一个与该页相关的预留,将 的剩余巨页和超额分配的问题。即使分配了一个多余的页面,也会进行与上面一样的基于预留的调整: SetPagePrivate(page) 和 resv_huge_pages--. -在获得一个新的巨页后,(page)->private被设置为与该页面相关的子池的值,如果它存在的话。当页 +在获得一个新的巨页后,(folio)->_hugetlb_subpool被设置为与该页面相关的子池的值,如果它存在的话。当页 面被释放时,这将被用于子池的计数。 然后调用函数vma_commit_reservation(),根据预留的消耗情况调整预留映射。一般来说,这涉及 @@ -199,7 +199,7 @@ SetPagePrivate(page)和resv_huge_pages-。 已经存在,所以不做任何改变。然而,如果共享映射中没有预留,或者这是一个私有映射,则必须创建 一个新的条目。 -在alloc_huge_page()开始调用vma_needs_reservation()和页面分配后调用 +在alloc_hugetlb_folio()开始调用vma_needs_reservation()和页面分配后调用 vma_commit_reservation()之间,预留映射有可能被改变。如果hugetlb_reserve_pages在共 享映射中为同一页面被调用,这将是可能的。在这种情况下,预留计数和子池空闲页计数会有一个偏差。 这种罕见的情况可以通过比较vma_needs_reservation和vma_commit_reservation的返回值来