From patchwork Thu Jan 19 21:14:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45967 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp552047wrn; Thu, 19 Jan 2023 13:24:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXuxq+dlwA7RAhIhlAf2L4wedIHJoUbkpRyXAlNd+afqD0nZ1aLVtiuX7S9GQP5DXFULjune X-Received: by 2002:a05:6a20:54aa:b0:b6:99c7:9283 with SMTP id i42-20020a056a2054aa00b000b699c79283mr17877548pzk.12.1674163488829; Thu, 19 Jan 2023 13:24:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163488; cv=pass; d=google.com; s=arc-20160816; b=RgwgfwgL47uQjdUQX4SVtt01VSgFeNEiwLvG1xQmZvLP6RiV3uno2bomtROgUoq6Xf DdwrWL8VbU2t1+TeVgjf3S4fzr6zTI2WtXcgDohOwW3SbBgYbyFtAhhtSpDS44lILSVL UjQkjNhzLwTrBCPlGAomSIBgNBBWrN7pX00QpXrnKyDGpNNj+apgi44psjIjcsHHS3La TuvqXRdO6varnuPvpVhUwUuaMx0XESjmpDGUX/2UmV/ErVSw6oN8nfxtSHvNdjwkKNVf hBXlLUrY4zEnjG00frVAN9KxFw1Fyvfqd9KlQg04g4GfFcvo9iJO/Jm+66+I5QLJkCVl to0Q== 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=RmtvA3kqCtgodpedmZsZAiY8pDqRCnqPRbwQa/+SAlM=; b=hYeUtqPmF3WSSq8SNjIHlgFT3Yb+otPtBMypspWI/ChrziYrMpwEu59oVDn2PKY2SR O7z/niiirOjhguoswdeK1dDY/vKFKNypIyF2d4rhVrZDSTlsD5Gbithw7VRNkGNKMqqr TZxkv06ZclX8I7Kj8XHHKG6ViZ3CkFeGzZbdwGPNOwBbjto1l/2GWuYEXcEc0uClBxkz SqCzbjnaU6IroVSLQSAAaEbpa29Mbu/2gOJr4DGaqHBBLCrgs1Tfq2VDZHAI2O/fpIaQ PTY5PWhjToySwE7ynoTw3lS1Wb0IvZ3eKwdB8hfomOid2cFLPWG54AdeIWnsNVX3+oEY PUug== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=CbDbxWxP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=f6tSu4lu; 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 x1-20020a17090ab00100b00217d892ab40si337036pjq.29.2023.01.19.13.24.36; Thu, 19 Jan 2023 13:24:48 -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=CbDbxWxP; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=f6tSu4lu; 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 S230236AbjASVWX (ORCPT + 99 others); Thu, 19 Jan 2023 16:22:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjASVVz (ORCPT ); Thu, 19 Jan 2023 16:21:55 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70C574616D for ; Thu, 19 Jan 2023 13:15:30 -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 30JKx0Pj017696; Thu, 19 Jan 2023 21:15:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=RmtvA3kqCtgodpedmZsZAiY8pDqRCnqPRbwQa/+SAlM=; b=CbDbxWxPr06wb7g2iaw8qBy5A0Gv35+p2CcCzDzeEDj1I/r0nZtLXgMz1/sOjSE5Nwwc LgyWfiq33e+jOCTUs8fj4te1nAnBVKIZwYEqxmQeHIenlJNMfdTgZ4pS8+dDdus5M8ko 4DmX+Kb01NFhH+fl/y3BNDtvkYzrme4KVWLvXzFrz17dUtRG3WyID7NdojyYHeANhN4T /hyuB3r5YA2NuZTDX/S5JDVxrWTplQ74dN+H3WjpmWfVoSQDf/Ga2I2uPNE8IoITLZrC Ow+yy10X6rObl+fjVGqo5m3l4gsVfuQULHfei3AOpncRSthM0RmdD/WFOPTh3THa8pgw FQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3kaak9s1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:14:59 +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 30JJWBTR018769; Thu, 19 Jan 2023 21:14:58 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2100.outbound.protection.outlook.com [104.47.58.100]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6quh8svu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:14:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cLHZaFsGzzRIgNzf+brz4z0IphIgX2dEsVHQEdnRxbPvomNfCLT2SWS8RVrkwARNsZq+Kv6N9gq7mdG6XGViKsTC1NPOxs/fombOW0sZU1htIcfXuogMPUXBIaszVhi99UisJaJ2vUI2EXLhqGNbMmy8Y6MElD6LOaJToyJ0q4lNIN95N5oj9GmkqnXfOQWfIg5d0Scrueit7w0mnsgGgzLafN3HFKa/1yRsRQZI0I+2IlB1IgkkbWMBAfH6uJlKNpk27D0RGrT3om4Z6IwrqqMOvM9mpO/Fz2Ob6PqEeKx5iTULPPvuTbkQCKZkiMd9Jl4xSdKUqdXUYBmQ/UFGxw== 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=RmtvA3kqCtgodpedmZsZAiY8pDqRCnqPRbwQa/+SAlM=; b=BgpY+pPZt5xZgziMkfUEzcIikMEHKp1I1CYMYaFXlyMUrziYPQFSo4dJ6gBDU32U8iZaRcornnJk5Ec916HX0ftnMdOGF1r74bwOyyosgdHc5J6MsrLy4u2mKiQHIuEnc1Syhq8Nt0IjnVvWdmszLFMHaJQQUqPkFxPzaO08A9Eqt6co4kVXoFgZvBH5/RF/SJQVDBsnOwpEnhzZIz3fFwkBdymkaRF7C7y7lNw7VQbohJwbOzpstsci09vjZMiunfRMMgNcHKRdJ5qN4BYYIahxEZWsEqvw29Awd+XOBqmPwuOHV/GKxwsLZHsKaST39f2qgd8azKjFeqVZRLca+A== 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=RmtvA3kqCtgodpedmZsZAiY8pDqRCnqPRbwQa/+SAlM=; b=f6tSu4luhR17FgczoKyV9DAqBeFEs0h3OEisdWzOaDzgRTv43KZ+qrW26q5wCD98m2ziqBo3ih6i0ee+idOiOpuYoUWiWp6emuu80sQ6OYinccoEkfyEW5+Nc+IOxxwvRWxCDaArHfwishXTdz1Wk19j+f0NTDRuJeZq3nJ59FM= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SA1PR10MB5823.namprd10.prod.outlook.com (2603:10b6:806:235::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.9; Thu, 19 Jan 2023 21:14:56 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:14:56 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 1/9] mm/hugetlb: convert hugetlb_install_page to folios Date: Thu, 19 Jan 2023 13:14:38 -0800 Message-Id: <20230119211446.54165-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR16CA0032.namprd16.prod.outlook.com (2603:10b6:a03:1a0::45) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SA1PR10MB5823:EE_ X-MS-Office365-Filtering-Correlation-Id: d22a0594-0986-473f-991a-08dafa6236e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QFOxjED1Lsdu9fR3AT3YphOFc8OUR5fM6fOJ9l6+NQHEbIDlPtHc8dJ2xg4qcMHXwNXsJzoRJO/YJ8bh9G/k6o1MoiDMZ5RrX/oZVv+hOoyTeDj8V9rfOCCW6aY+osN9UVrwWXv+OIRJWbILCQWMbcdlepMyUh/b8ZiYLeE3sL2M4zPG23G5wQOR9ITlycqZfP82kC+GwCjg+5Kl6/6GsQqdY49G2IYDfIJe21wWSK66zvD/zhxBpI3AKff9abAs67snIPw4ESb24I9r+SL7Qp28YHlzZQMK97NQEDeyZMvQvNajPM+/xwhUZc68ExYHXR/8DiDIiUDAnUd1O5qPqkwQU/wgE7oEIDSadpW8Rm7Sbimv9c1sANjjmhCrRLIRN9XMv5l1iLDO0Y5Llck378lJpWdsvI014hfOeZqaKWCLWbn/VTzzpwpw10t4mL0yUhTHv4eCwJYQ/K00cEdNpjjVMuGCcr8wz9xzBqMJCYja6Rz6ficWYd4tKaPyaQH/so4N5PvI/cUPBlQXARYuajCgmRTvIePcoxbMrvQEzTDerD6oy9kA+WrPqHQA7QY+TLitmH8+R3ngodS0ULy/6jOXp8x0qmolZii4tHWNnHmUmxukqT3S51LkHgr6oXfGNEa2aqgbQ3upEs8hz0CCtw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(39860400002)(366004)(396003)(376002)(136003)(451199015)(66556008)(83380400001)(38100700002)(5660300002)(107886003)(4326008)(86362001)(8936002)(2906002)(66476007)(66946007)(44832011)(6512007)(41300700001)(6486002)(1076003)(478600001)(186003)(6506007)(2616005)(6666004)(8676002)(316002)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: b44ZdWPNM9MJxV0C5vf0/G4ya8Kq90q65sVLZSlp2lDbSOukNQ705szwuwSjnAjvEjzPnp9ihAQDPcq3ByY6H7hZufjnv/HY7beQVwTARuqrmvG/njwLiVy4LhDLoI662o2dE14JqfHw3TJlljMwMpKI4lQejQay+5WbhizbTLN+EmaxWfNZypHNOOTiGdC5QDpnZy2O+afQ04ptxi1fHQ7cskF+H4rnIidJpu0QGsr9vdByZSlRdroc8+z7Ln8dYdmZQbpGQIAok9gKq2OnXxM2UhXOxXNquPTwqWddhryEd3eB35XVX+zhYhGKyItLguStbZ5v/lv7YFx3nf+GQ2KSnLGbWVO5Z605NGjIZa9dBNGpGfiPCvrVYY57NXy5CWr07oUXi7gIjHTt/W6FU7zEQIy6V1r5j8ggfdrE61gpCrjYix2BqzPntM08pBnQz3uQ8Ic1OT6SkwHUamQ5Zw7VBY93n2vGJB7cFk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fYxxGOisw/JUkWRqAmB+Un4/GBYKnjcEwitOOULxiJfX3e8TXuAgh+izb4XxnfJZNwnzbUZBwoI0IRVCmoCoPAt X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d22a0594-0986-473f-991a-08dafa6236e2 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:14:56.2780 (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: FrmxVsZpd9qTJqWhFGFG8fnbpgce0AYbfazSg41qNXUrDqBik0PLtTOsuruipah66+J2iL7taXVnGRU7Hr4sjgKCgwEPLw7QPD8xG148jg8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR10MB5823 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-GUID: M4TMB-CV8n1WS0qLuIIaqWGu-QRK-JYV X-Proofpoint-ORIG-GUID: M4TMB-CV8n1WS0qLuIIaqWGu-QRK-JYV 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?1755487654563432225?= X-GMAIL-MSGID: =?utf-8?q?1755487654563432225?= 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 Thu Jan 19 21:14:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp552100wrn; Thu, 19 Jan 2023 13:25:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXvKiSjhz6ANLloy9Gxm62W9EQLi5TvWTuKzWr9lEILkHEQFKddCKKE1ov7zdMy/OppZ482g X-Received: by 2002:a05:6a20:4c16:b0:b8:6371:9abf with SMTP id fm22-20020a056a204c1600b000b863719abfmr11501857pzb.27.1674163499693; Thu, 19 Jan 2023 13:24:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163499; cv=pass; d=google.com; s=arc-20160816; b=TL0zxv+4etN5IFaTC/6ms3umqRx4AWL96xsTZWzTykdw+3Q98vxlVWq+xKo6OZhwb2 5blgbDwjRkyh1Xpso0AAZiUqi4StTvYL+VUYkcc2VkwRb+9emPFbbJCOkbf3F/kEMz13 apfMxZgslW77kgUxaMv3/DrGCKkhxxd69ima0oZ2mzzG+hstKpuumOydWyptpO7HY1kM K+PUMjj+YBEzzywCnCcdsBR8iQ6ocCsuG+Qfmat40yKkTtTHkEfUcvaphY7pKm3u9S8T DXg+ldmNphZzJn5+NAekYtBfG14LCPQq1IPJXhVW6x+FQ7nPW3hakLagJXPUf+Ehi87W jdxA== 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=zsPQG8fDL482u8E62UY54HDAQGMVSvhN1uuGsS+Bkwk=; b=xIhujocXxZNC3uwfLhyZqvpYyXHAocgPRBv6gPWfLAtw9/wKlq3ywgCiCyP/0H7vUC Utrd2Mw9GhhRZYJfqinMlTpvQxuLyb+247eXAR7D4tJnvWj2ucBpaejWuODBy8TCEJv0 SrBnfEzg9BbKi1z6gJ2oZLWxtVHxHQy80LsIih6k7bUtAn4YpIn2qiEDoweQ9tIlWGE9 Gsg17b5+i9X+mWIbeHf9T6h1lMmyO4sRDw/US8+biOSw7mGaFugb05Mkt3wTfN2+ngn4 AF89Jf2nefUoSIkDRuO9RR1yEoNTbrY8jAcqOBYcAm992wjAuvTpnFUQsY2oO0K/w/Nu f+Mw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=QVzMNEdR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jxPsxp1t; 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 f126-20020a636a84000000b004ce5301ee14si10805960pgc.763.2023.01.19.13.24.47; Thu, 19 Jan 2023 13:24:59 -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=QVzMNEdR; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jxPsxp1t; 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 S230002AbjASVWl (ORCPT + 99 others); Thu, 19 Jan 2023 16:22:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbjASVVz (ORCPT ); Thu, 19 Jan 2023 16:21:55 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36C1930F8 for ; Thu, 19 Jan 2023 13:15:31 -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 30JKx5v1027492; Thu, 19 Jan 2023 21:15: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=zsPQG8fDL482u8E62UY54HDAQGMVSvhN1uuGsS+Bkwk=; b=QVzMNEdR8NrPY+FPHxNJnZQoiFkBOOHMrdgYk5KLGMZ0rfGhA7ciV+mQlz8rmOYPEP46 rr/zKF3RJOi0cUdo23K3uUXhnBK0rPYTtve8gU8S9ci37XMWgKK5eUsjYXlcHf/Udag7 GJd/ZwieENmNBUl08uxVhg0+VnjHlxdf0AWW1Dp7SS7YBHkd1axa/1RU1EqW1oCI6Exz 1g1R49ir0FEJ2Y9pMASzAZiOjCgrB/coF6CQsiF/QekQsZiN2BUg3Iae4rLhpJ44rPNJ hPfJXcHpY1/QzmVRsFUPDgNtQcZFtU3NB7fjy5CwKYGPJjCWN/uwZQxFUEndRong7TyJ TQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3k013at7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:06 +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 30JJavLs004672; Thu, 19 Jan 2023 21:15:04 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2049.outbound.protection.outlook.com [104.47.74.49]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6r2v07ej-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dSDzYNIs3ono7piW/ia5OI2GrWBWOUGrObv6a73SfGWPl2o3WIcziG8OJRdfQgIprypxjY++ZH1Ys/GwJ7JNETuonjdxKKDOpwZZfKkvIj4UCnrlEbPUCkym9qt8sC6gdPxfSDjXGz7mJCc38QTr4NOXBeplr9I8uW/ABcO+AoKkKXy5cQDoeXalxNh20e2WFwkJtzlAdCW863IsNorBnfEbKPSJyPT6AtbijUtr92b5b4JGmRHoQu+Q7RALpFB8hDvEmWF608g/nYUrY84dvevP/LT5lTPL4OpbXtW8Gp86eWGeBsQcfxCqeF0nFphDO47mSJaDDkgRHd0q3qyURA== 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=zsPQG8fDL482u8E62UY54HDAQGMVSvhN1uuGsS+Bkwk=; b=VkrbmEC/T/6JtjclRUkORw+5/xeZw/hDLabjbNjmpu6ZvNTFeGdbg4J/9Vk7q5mCAfd3NZqHAi47KQ0gDHFqEVOKcGjaqwWaGi6Pvo8Qi1pVTzVRqFm/1SzkarKDRWOLX/LVf9riUbHt46NX5IvZjdXy6tujzigyC04lUqRowBQXRyvIG6utb9FLyHCPn7+cWVb+QPfx57/pETxaj5iaWuZ1QaozpCQhs/fsgQ3cTHFmgjlShR56XZlRo08QWDtCvVrhSEGvBkeVX0QEg3qq5QE2499V+akuFswCXhmR5y3V7Z6BoGRuNMMzklJasfd5vWFG8pVxfnEctc2atPk9HA== 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=zsPQG8fDL482u8E62UY54HDAQGMVSvhN1uuGsS+Bkwk=; b=jxPsxp1t/+kZt0j3C+h9jUmcdkBabhEJLJJFSNZ7te3nhwTVmXtv0chHb7xYIIZrAFynKXFBe9BGJ8uAhIdzUaQ8Vq17lhI6NWzjFo7z1pVHpTsLjl403WmOcIE1427e8blpIdzQgzp1M8a1usTG3jEcW47BZYKHH2v5oigSRG0= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SJ0PR10MB5600.namprd10.prod.outlook.com (2603:10b6:a03:3dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15: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.6002.011; Thu, 19 Jan 2023 21:15: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, Sidhartha Kumar Subject: [PATCH 2/9] mm/hugetlb: convert hugetlbfs_pagecache_present() to folios Date: Thu, 19 Jan 2023 13:14:39 -0800 Message-Id: <20230119211446.54165-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0003.namprd05.prod.outlook.com (2603:10b6:a03:33b::8) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SJ0PR10MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: e34cc9b9-ffe2-47f9-d7af-08dafa623942 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qy7x+wNVZ50XB5JrxhxodaiJrWso3rgp366E4bqEOwLQg/fKsZxLfQ/L6wLxBhdhaiARmQUf6UCGoiKnn/pShohT1hP/H9ZYTl1JzsQ64LTWv6kkiDp+vlhnfSHGExQtv/3Y/jhRxLVTi8mYDzRzJ3d0LyYEHuEVchcXkS+E1s0/Y29Bw0Gj1gehjx9xUAJFh4lQ5VDzqscV4nsBOEroXXWibL7Yq4uTaSCTJ8DagKdBhO9zQWODRz1khux7oyCd5U9z/9CchQMjUpE2obduWFI3IALyJRgqF9czgbNKRm15EFTxc6IcYlGe+S1K18nx/dtVatasetKauLp/MdSZP9b5F+yYFSSuoLcsTXdw+9vpcZxjr72fBhmcKGOCn1lgTa1XwQnSNj0TSVaxB/A86s5RdJKxAAR+GgKuP903XV/aJ2gxrceaEd0z5i1Fy3yHC+zd1GPGuW2tejhhCaD8KLFV3caI4IP0HegVF5xMHKjD49DjbmGRRxPAscEAUGkaiaAE89CwlUq8OfVkDVzjt0Ne60VVYTyy+49PM7jT8kUUJ/rStSO2O6Eu0b2qJQKxe9A9+e3pENCykIZfXGQFdprlK+jSWOokLmaiI5KwLmwrgw+TVZew9lCL8gdlmZn9KxYVp/HEO5ct0CMQLEKj/g== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199015)(66946007)(38100700002)(66556008)(66476007)(478600001)(8936002)(44832011)(2906002)(5660300002)(4744005)(4326008)(8676002)(1076003)(41300700001)(2616005)(6512007)(83380400001)(186003)(107886003)(316002)(6666004)(86362001)(36756003)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P25M3ehEgCDwDYwSFs2PBXV/efuxjWJIBydC9Yz2rrG7SCXRHs8tALod2n28+pQSf5N6vO+OIzOc85J1t3uMHM+Bph0zXAphAMbxUvLfotbvGgFSzifBqdOLtyUXhgsYYXz33br3QFAdqe+MPOpnJe2PTd59owsd0R1BDAZk3PgQMgyTlcBdAuzPyf+qkDxvcs0/9EJP84nsOmLmcPItx6HMoHW7sm+nhhiqkPDH0NzzTyRzhKLfIexYbBJVTyOix8Meq/JwIB8DKYiYLABuPDsLAZ0Pl4r9LnOH1fV6UKD75Eb8GPq/lmptC+cdS0kZPDzZGCl2GA+QwctWjQjbMrkWfAyKftbrsPJCzgM3Olone19e3za61pylyAkUnjJ1lpg5pAmJIdLmqHV7O8QVemxiE4RYob9W+vp/yO9B/liN0xIe+WWJjjiuGjm+a9kJ6nHDx4zkmDVRco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oOhRacEU4vkHM0SPK4aQpOldgautGac9BPLsAauNc1hcG0W994OEgwWXl+9kx8AzfQizluRcogMvDnwK8Dcsk0trDt3fGlprPqqWXvkTbwcuQoZ6f1 X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: e34cc9b9-ffe2-47f9-d7af-08dafa623942 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:00.2017 (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: 7of99WqYH2u7RSI4R6eDcS0eUnzuG8wTfN9fx1/PhVmF01jFiriuSQvDlV0FY7gK0FYdAkYeslGT14AeMVSJf/QncAzShYbiktIsm4wsAx4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5600 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-GUID: jsivQA4vrPT8-DTqgdFWT04JY3JksEJJ X-Proofpoint-ORIG-GUID: jsivQA4vrPT8-DTqgdFWT04JY3JksEJJ 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?1755487665976629589?= X-GMAIL-MSGID: =?utf-8?q?1755487665976629589?= Convert hugetlbfs_pagecache_present() to use folios internally by replacing a call to find_get_page() to filemap_get_folio(). Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 849206e94742..04cbdf5025a5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5653,15 +5653,15 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, { struct address_space *mapping; pgoff_t idx; - struct page *page; + struct folio *folio; mapping = vma->vm_file->f_mapping; idx = vma_hugecache_offset(h, vma, address); - page = find_get_page(mapping, idx); - if (page) - put_page(page); - return page != NULL; + folio = filemap_get_folio(mapping, idx); + if (folio) + folio_put(folio); + return folio != NULL; } int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, From patchwork Thu Jan 19 21:14:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45970 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp552821wrn; Thu, 19 Jan 2023 13:27:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXsNcDY7gcu0MbDHUWiOGg5c3QxpK5mZoV3nzbOLS/KSQ2gQ+pf7xe+SfOXLPcVr7jFRlkej X-Received: by 2002:a05:6402:4305:b0:47f:6531:dee9 with SMTP id m5-20020a056402430500b0047f6531dee9mr17225319edc.20.1674163620630; Thu, 19 Jan 2023 13:27:00 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163620; cv=pass; d=google.com; s=arc-20160816; b=NmxI2DnxOKZiMKIJj45qCcG9eyHZhg2qk2TbYbq5aehTnGSxDqiNJks9Gbaq7680c+ ExbbnCP0XggeJEm8xWIgmObVJwC7rVmru/eOv5jE6IBClV7DAs2ucjRVcshOjEDX5AMu ps9TMhEq70do323bX0nZwymTphFvWaFbWzzkptUDyBPsJfdNdc2LGxcb8JqfPUBP+LuK 6TAXzpdAMPwpa7BAlH0BHnQFMXZMman+ZAiDoZFr2OtVgePPmIuJaAaEC2hyp7Y37CI3 kdIpwSjkKyfnoigiRefnzzADZ4+kakyWCdSWdBNiZ0Zdkh5lgsv1uxGd8fyL3R61HRxF fRAA== 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=P8ONpzIrTwJHXkSAMdbEViZE3APyT+eQytr+nrla0D4=; b=0uc8gMPSWCEqdQsTyTsyNJh4OKT8u3aXCuYthJemP+cFp8xXfeDPw5HqRgtW1b5oPD cyKOAar1FwXGcmUOYKxLqiB3MxYZGUEU1U+InRz5Y1X9OtKrLOoI22NRNsX6INi+jDeW vA2AMN9aNK9lKzc5KIeNbJ6VPt0qHpTiFQKPIfRrDSkIboPKsXM3S6WXHR5zbB52/hjs XNPuKnuciwqEGPF/7ReuTZwSfclzQ0t+liZeDZPafjvzkU8obarEuvrYVZ+JMwU1uWVE +thKUBnRtr9MBlMLp5SDihF/9mAfiNPZFFQRH1H51Uqw37q2HVDsm4eHniJk+nUhn2Pg 4neA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=WEBbfSvI; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OiE23BRc; 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 xi5-20020a170906dac500b007ae1874c142si9711942ejb.446.2023.01.19.13.26.36; Thu, 19 Jan 2023 13:27:00 -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=WEBbfSvI; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=OiE23BRc; 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 S230076AbjASVXS (ORCPT + 99 others); Thu, 19 Jan 2023 16:23:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbjASVV5 (ORCPT ); Thu, 19 Jan 2023 16:21:57 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 920815B98 for ; Thu, 19 Jan 2023 13:15:32 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30JKx3ZH008407; Thu, 19 Jan 2023 21:15:09 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=P8ONpzIrTwJHXkSAMdbEViZE3APyT+eQytr+nrla0D4=; b=WEBbfSvIKL7zyFvdfVE6VaSg8ulre58/pe70f8iZmRuox7f8wIgTyIKzLdlwqsnyBM25 7ZgHLYELqDxgYJCK3dlz5zmj1T3lAzZAZiWIjjSUL1gJ4Jqmebt+WYlsI6ME0XY4YtUC egs2Rf2zq8WHGTV0uAtk7rk3869etbMIEI/0k6tAptVAGaGaoB5z//KFFapDXurnN4Jb O7zuX9r4dlUSJHnvTVJ11lPlIqjZJZVjqIQ0TTajResawbUsvICNIP5EWQR0cUVGprSm SAShA7283b45r/94RmBMG/M4/vUzd4B/eNC1iRm9DRKKicx7rc/h8rAr9MUQFFfsqZ8Z 9g== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n78958x94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:08 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30JJZwGp027915; Thu, 19 Jan 2023 21:15:07 GMT Received: from nam12-bn8-obe.outbound.protection.outlook.com (mail-bn8nam12lp2171.outbound.protection.outlook.com [104.47.55.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n6quc8abw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DxDQsJZaClsp4uzKsAj5hZ5sTeYR7D7p/CAa27SZ3bR1QSuMw4rZy6cCJWKszfQHDckyos5mb69s2UmXhdBOfVBzqN9pwyaOqt3vbSdGqQvw1XPDVc92utBmNxJC0RKAOjkkhEdKX5V2mVXLkFxokhCGFEsHs3uKTgr1QEIIkvuXk6bALVD/EDXIoo1l3zeDqKP0QSxNY+wDNAVMfjL4j029EZJZw9cmXrea1V1VfnbUlbQi/nqekNWFUeu4l3pBXKsSp9LsCeLrNXoznPzuAvI1aTxJYE+BUbKpvqtdmmKvNIr1fYFxqitap+9EviGWbXMkHk5GfqZaxzCXdOEgLw== 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=P8ONpzIrTwJHXkSAMdbEViZE3APyT+eQytr+nrla0D4=; b=F7c3fgd8n+s/yW5PInQELS8LhUcf1N+M0zuRvB/NPRX4RUFK+dJQezavfWdDtkx4ntXx3sUB3G203XYAjIUmYFpWlqrWbqZDrJp0Vb/lxVCJaHtEd2E/Q1CFr2aHM60yvVNCl6Xdc/OWrsPZdo6x4/F1ssf6UXcg/VmA51zOi6QPcVb0/MgeFslnrRaayj96sN36hMSwF/kqHFfEhYeD+fnbDg++nA4J6DY7YcEb42qvHkJ24ShZ7r8QjgGUJ+XVHQqxRdKkY1t7X2hVD4PdvRITdU0rwUeqwy/606vl/2K9OSDIP/kWa2qwAN7hCEQPnrNGOSW2DK2tihAkUeS0QQ== 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=P8ONpzIrTwJHXkSAMdbEViZE3APyT+eQytr+nrla0D4=; b=OiE23BRcUYHNPmnmrg6RE9E1ebgmOIX07XXB6bKYjt/xa6DLLWKcBMu/wSrOdngoZF/n/2VWqqXWtn2c5jbQkmF7mtAAsOWq7nGgG2fM/Rt7fRRM8RekwSbq9VegfbSiNHvpZUgGiUE2FdcLuHv6kVzOTL0tj+tFN8hGEdljDqs= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SJ0PR10MB5600.namprd10.prod.outlook.com (2603:10b6:a03:3dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:05 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:05 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 3/9] mm/hugetlb: convert putback_active_hugepage to take in a folio Date: Thu, 19 Jan 2023 13:14:40 -0800 Message-Id: <20230119211446.54165-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR03CA0024.namprd03.prod.outlook.com (2603:10b6:a03:39a::29) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SJ0PR10MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: b16a18f2-097a-4e65-e183-08dafa623c0b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Exsey0OWJC8tVsfv2tg4U8ArmbfX9jkBUgC9/T/ppyX7rlultj4BPX6cT63LatNKGUfmykTMurAY4F5AZzkOrbIbTgYVdZfJuxlwnVuDhWH9M/4GT7o3q284o8iwx/jBFy1ILU/FsLHlOKy4/ow8uDkpIhLGqbIoL2hH20+w3BZxj1jH9ueOqb7lWiVOqWwAapBb2edtmvS66c3SMQz31t74AUyfo9DeeGBdQeJAE+j0u0+wUYO/iXwdym/YX6Mxi8EYZzkFH+LiU7OeiIPDA7UaJ+qdF6VLHxkXtLoK9Jfz3nAI3X+FnnimnN8ibHY6XhRpVZyUfpwjD1cIFGTSo1vZwWEw4AmY6GFN+y8+zDpsfWiuJKbYr0zo/xpj3N/ZRfgl8cow3oi73Shn2u5VLc5scsve5J8tln2JxU2UEBMWyb1XxPAAtjgKAE+dSHS4YNZEkuKsATMAdvEtqV1kwdwcdD8CnbTTx4Y9EB/FBubsnLUKmWjJVeIb1sYSmECiFzMW5gNOVrofHc8toFZgbIQuFY3FsEOpsanRf7AYKlTNx77GUXIlXHPV7CgtVd6MkT48idu3qLRq807d82N1vHoVfLvSvG/cbMdxiNBM2qThhRStZkZdhY3D3oaub64ZLSSw/YvPro0Jo7O67BjoXw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199015)(66946007)(38100700002)(66556008)(66476007)(478600001)(8936002)(44832011)(2906002)(5660300002)(4326008)(8676002)(1076003)(41300700001)(2616005)(6512007)(83380400001)(186003)(107886003)(316002)(6666004)(86362001)(36756003)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A80D5j2fqFTX7aDlX3yACCAye1YXgs0KwL0TsYy9WRifFbHYyIS9hcXwkWmlR85T34mBvd5DvVAMvEghrWXP/ERXGrMCCG70uxKDoM34/xKC26Wz7qxYx74Qkm7otHrfguqh+DYdaCU1hlu+SeR0tsSbjqvvMZOObxGadmPHMnkqB7r0ay/qVwSioK3DlwuBFqM9E2jMxbuhV3MMnTtahQrqbiGYpZgGp1UbV6mQsvsG6isyCFgLaqddGd0dCMMHbqlBTyO1Gb+Lk50L+W/wA8x8MGoLQl4dtli0Seh93qZ5zuJEF0PqSzSMaxoOMo6N8QIA+eDLWL+X1YSh1QUrvUhAbKR6c9hc79tsu0ImEhrJG6zDEqVEJsXA6sNCD3RuNXO2WUyxylvHv+VN+jTB9VZkfeTCRGTbdkk7Z9CkNZyeqj1eUhJ+czRo/BZ2gEwPtKltBuaNnoT/vBaIWEkVyBqGgpqrEaJdealek4YzHYhInn1RoOjMlkxKeicLuq0QVWZxbazj5fWnNXEN/6O/3C2QCpbHFvMIx4N2f738643fEW59thlqCFMYDY9BYuBm5yaTB48VsG2hplKMvgziObGe8BsVVV3RfcTpj/XLyceVffxXtiuPPYPdT7fhjtxl2sYm1ZlAHkpktiljmk7bIU9Z7QYOOAe1yJhN3Gwg80u8PE242yEEyGbI57u8PMfsnhPQlbT/Jn93Ds7pCQ+61Tf1P316K2nDG+CLCSZaWd/keFgT12bhae8S58k4YEcQVJ4iRcDZ2bBcCvzfy7vfpvjsyR6d6QbiC3zMM+z5PB4D1B+vhdAugkcvqXQCEdAKOZFCBDz/Pzsv0mkpAylDJT2tYKbyDroYIYTcTqtddrh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KAd+r3BhqNO9bul+WMKb++xrpLGqhCBmAbX6zJAnuLb4dfHx13glnv34ys9N13Pul+4b9k2mHnNdTyjp5wR4Btb02D5cOJSnFAh/Y60iePPp24l7Nxi6sIQJ8/WFAGD6aI7LGj8VvEaUAj6AJ/dI4KNzdxuXZ4qtgTOMuKBnKvcSUzVYdL7L2UHGW4cVtXAaRcKsdRh3W+DOO63woCNT3QlSFySA0mIpOQ+sYtAbakYoXqtJbhZT7d5KPM9+pNAi6ZPKTfpkeofV9jsdeoceziOz6RVZDiBr9eSQmm1S7+rm1pq1ah1ABE5bG2/xPjKCq9ffMgQg0vlFtjf5po5EsH8tVsHyi8p8+sDK57LeomqGkJKrzMJWneEj/4cK+OR1BFC3I+n5G3D8x38RKPgasSJbv56pB4E7eRchtah/Gljmv5w0vJWTdx4gGT8ITztKUSJwZKRvhnLLP9G2bO4PxHAFNQHDsA2ORP/lpeFZfeAuLeEFXfLhBY2l8Im5AtW3BaOxc0jJHx6z5s6wfix7fAcrEwICIBm7vIVDswz96IC22IwK5UOO2gdhC5aJsZcfwZYwXxkeDFz3jlUK6vlR4pxyygbh2bKoXOo2com9ssnJCtwBUESqY1cTWXCwZOGR39wU/CkM3F0Kfx0+ApZgFF9tkZOAmkABHRrePhfJ3w6dPEpik7812lfr3+M50WqZgvhzmPFB3siEOKyadiljavjK0/YZiPmVtYluck3frlTWB0ALqVLqNGwJqZxr9uDf X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b16a18f2-097a-4e65-e183-08dafa623c0b X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:05.0790 (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: /mEqyX7OEdmdS4snyBQQI7+CNtuCWhVQQZ/0mYcgGN9LWqo8+Ot1uaoTZB0FspJLfluElGtCuusn0C9YGvOBpWA62F6AMmfYFjcBCZPPslQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5600 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: 0CFDQ5Rd1e0o3TcRMDdds8c63c6BLrUN X-Proofpoint-GUID: 0CFDQ5Rd1e0o3TcRMDdds8c63c6BLrUN 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?1755487792597003233?= X-GMAIL-MSGID: =?utf-8?q?1755487792597003233?= Convert putback_active_hugepage() to putback_active_hugetlb_folio(), 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 --- 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..f88c832bdfa4 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 putback_active_hugetlb_folio(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 putback_active_hugetlb_folio(struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 04cbdf5025a5..c37a26c8392c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7302,13 +7302,13 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return ret; } -void putback_active_hugepage(struct page *page) +void putback_active_hugetlb_folio(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..a35f2b36df01 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); + putback_active_hugetlb_folio(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); + putback_active_hugetlb_folio(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); + putback_active_hugetlb_folio(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); + putback_active_hugetlb_folio(dst); return rc; } From patchwork Thu Jan 19 21:14:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45969 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp552608wrn; Thu, 19 Jan 2023 13:26:22 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJAHRm8DjYSsb4gyqlSh7bHZfsN+QXkkrfzd0jAYMO5V8N8DJovUt7sF7gzJqPP/rLkAy9 X-Received: by 2002:a17:902:7881:b0:192:bb38:c412 with SMTP id q1-20020a170902788100b00192bb38c412mr12099525pll.44.1674163582068; Thu, 19 Jan 2023 13:26:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163582; cv=pass; d=google.com; s=arc-20160816; b=JFto/9Jr0WHxg/BIzHA4TmrsTLDnmKYDCSIfNLk/tfZpIkNT+gl8IIlpQNshSLfNuD Uv3IHPTvwP3HzL/TOjoqSWEFKQdQkkh3YP4i32aXHd8GoJvP8GPYNFvk+LXnE8VVZBxb AnYyVFflEZGFI267a9I2DX72YQyCcreBKQX2MfJMZRF/53jl6xAs4Np0ctdMtjwd5qyY LVYA4F2N2mAT6IxjRlkiuvF+hI5rWKW3PHYiUPmFwzv7ScVNpWn4x0wk985cPMr2G345 PRQkYoPM1kWqFbt/5xHaQkTuH6ur9czcucsl69IF19Ri1xQFyJReuVWRUtIni4IKN9P/ lmTg== 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=Lb3MhSGzC+YlVfqsSRiHS2gYkZi4Zy1MDQZFe/eP500=; b=HJAjnqUgmkg2zI6IKydKwJXBapkeIvrQ5PRNQNI23swmdZ4xmQ1gTv4XIcjBYXk9wV eGTUsQPK9O/yZCbpbgZyYkUm/ayKQBm86HieSgdhEVWTrc/craTW/Ot9z2bay+cQl64q 7Yqc0r8L6PyLhJYQl2o2Le20WdxD9GJtPHWNvUF24MFWJHDZQimVdxU2gtpnWiOj+dmP UHKoHrN34R42kaCRhlx1lsude9dYdhJBZsbQhrapYu8wUDIHN/fWmUAnQJj71AoDW/so nY45KrE4xsk1osbFyICIRZw6BXiXYMvWphOiCNgeHynXX0r42JBQLjbLTPNar3Pborpw tM5A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="sdZnZ7g/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qf9RdkBx; 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 ix9-20020a170902f80900b001932ed455f4si30914871plb.273.2023.01.19.13.26.09; Thu, 19 Jan 2023 13:26:22 -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="sdZnZ7g/"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Qf9RdkBx; 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 S230189AbjASVW7 (ORCPT + 99 others); Thu, 19 Jan 2023 16:22:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229784AbjASVV5 (ORCPT ); Thu, 19 Jan 2023 16:21:57 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45643265A6 for ; Thu, 19 Jan 2023 13:15:33 -0800 (PST) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30JKx1WI031429; Thu, 19 Jan 2023 21:15:12 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=Lb3MhSGzC+YlVfqsSRiHS2gYkZi4Zy1MDQZFe/eP500=; b=sdZnZ7g/cNDfhg5b3TJShFcbVFe3rkd2z5odl5nqYj9h7zGkcLNjl9xQu8sbHUuoYQkk 2QOtzb8Bgh1IPesLp2afhRKmRehcB0qd2p+OdTdJ98b+CPz70qzaX0e0fblEvYzLPqKr hAZfLOvxiwooGICDAyZ8+8Xxb5h/BPsdM2pcI/uThSGpCzwFdDf1aNyqOKe7wBnkF9bq S4/tk8kZKJWaZblwpMZTURyRgjnsyAyyIbts2HnFFGUSXtnUmMLG/k62JQ0gxtwwR8h5 R1ZQVVkGGVdq0aJqxVJyREdrxeKbsYX63jYQ2xIv27+rtLIa07/ZNf++cp3Xs86yerrW bw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n40mdjpmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:11 +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 30JJXNB7018679; Thu, 19 Jan 2023 21:15:10 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2048.outbound.protection.outlook.com [104.47.74.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6quh8tbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GVOTIceGRA7eHI0BMOSLfNfG/O1cQzygDGVc7CE8ZiBWXCnPn008H6tnqXGBMrGHTnuW5uM2IK2xlMvbiLWjJar89cf4fEwnGL7K9OtmZkeYvfFKJ9P8Qd1ohyI5zTAi42Ov2meZXvnRtOiMp5NRKLz8yrPyw8Yy9+dmQFafkFJTD5V1OtMsdx1IMYuf8V8GrBNn7yvcfxw0Fu2cHupp9WObU0jOk2c2w4CoWM54VBKa7DUIVet4a7ASCvN3rhWMxIEb3DyY7PVnywmM8OCO4FWsXx6XqlNm1EockBObI6NeUc6OHsymRH6Zgz6XL6fxrwYvVWU8HIEJw++tLe8l/w== 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=Lb3MhSGzC+YlVfqsSRiHS2gYkZi4Zy1MDQZFe/eP500=; b=Oy4hE8F4ZQruaG52ErMme2InlbnbA7ryE2UUKsWQGGixqzCBMDUafVuFGSigKiBHLxTer9YovVdRDJRqwA5S330wnMdDyFszFaTPmJqpn3ygfoMK20AVbQIZ6iQ40wd2gaqlzPV8nPeqD4ECveoFHdRKWEEBcgUmVOAoAnH990wHziRsEkMRfVwbLB+Ntgzlz0xYsDGjeQn7XKVcItN8cmhXf+PS974mfd5yDrZKacK/XqPIJDu7DPaLahAPYWp2sZla9tTKH0n/mK0gwm6/6NPwWcrIGc3OXILA1iVcfdntxFOL0pp1MMfoslGIuQGXtqcKL+UVIuIEkVblvs3xtw== 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=Lb3MhSGzC+YlVfqsSRiHS2gYkZi4Zy1MDQZFe/eP500=; b=Qf9RdkBxQ0Q2WCTYRS/NM0SVdG2wUiPMs7gCrDCg0CHVnX5p1mhcY1gDZncb0vFqfzer8/XnY8j9Rj0xSETpXd0SnXaROAl/5DcY0dlFgMfVL+rOJ2CSoElB5HwAfrIkssajAkOrHT74k37w8gszGyoSPs0Tg58VFvl9zSBfJTA= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SJ0PR10MB5600.namprd10.prod.outlook.com (2603:10b6:a03:3dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:08 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:08 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 4/9] mm/rmap: change hugepage_add_new_anon_rmap to take in a folio Date: Thu, 19 Jan 2023 13:14:41 -0800 Message-Id: <20230119211446.54165-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR13CA0032.namprd13.prod.outlook.com (2603:10b6:a03:180::45) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SJ0PR10MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e0c61d5-7b6a-46d8-2cc7-08dafa623ddf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ED63qpPHxkhHjFMyLkRWLp4mN4YP16nRYtxMQCb4kupghspkfCSz/6gH0ZOfu3I8j4+JEXFaR8xVxCoYqHBoQdE/XoMElR6OKjNhEzkxWtAtsoLBp3kCFJ3xvupUKiMEJ+bQXIe06qk4GfENng2qzSfEy877DRGzY7crgeLRkxxz8pHeEA7uutd2nYP74ejEBKF4Z0Nba6/oiamxwbR7N2QzpLsNBuvQdBTFEw+mxCzl3LbIZO0zAE2iLrMmfvm9Q74EdOz5Pz8dJyG1AxTsk9Vikc4dOomrv+QMiFabikS5NKEko8vkQCgtifMX3pTBwQU02XEOLORLqqwMA9cBXEE3KgMwkOO3aj2K2yNwLVQ827ifdsfhhAdUfLuPGr+eJGXXODbnyIXSy1cXjzPBPrZtzMBC4GmzKfzDfc1vhqo+zZEw4qrD1DpmcmPITCbIS21Qy5B4lFmacweJocWF+54GzvYsOPxi0JpNH34nzNN/v0g8gRNFWREF9CMHO8A3q0gJEf+5Vg6oEca4e/Lffmv7StyVAQQ5+dil/k5v50fcsNECkbyFokBZjHUibxT3mWmCoPmpXJHgnHwaULRPJTpgJLXCvl80Z16DNOXkxoWxdAvsR8I92/d3YhL/oBHkNYGs7AqERJlw4Bp3H2Ecsw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199015)(66946007)(38100700002)(66556008)(30864003)(66476007)(478600001)(8936002)(44832011)(2906002)(5660300002)(4326008)(8676002)(1076003)(41300700001)(2616005)(6512007)(83380400001)(186003)(107886003)(316002)(6666004)(86362001)(36756003)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /a9KMfO3772Jb1RrZm9S+SgGxyLUMJSJD8mHqSWUuvR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rsIO92YkuYKUJ+EPHwv6oI5o+IhfwvotBqfGodMj3hLrWO1l0+SEFtJPj5O83nHKGK3WxKZyY4wJytwC2W4QlbkJd8723ESeHeuiJJO+ZB0UuGxjetct4suFFig9RwzKcCWGATTaNzWg/wAF4yp4EnQ1o06WpHpID01K2rYsEN3zCP0+Duqt+3ntsNmtku0HDpXfFfebghWFM31rJGeZUpwJ141nPmA3ZvOyicTq4HYTeL4T4Zz9Ee0O9fiB93voiAj8D0hOo+9HxUr+g5Kp+ufDX10Q9En26Fv6WRfluucTJQG2B3EaTsnPwkt9EefXy5ZP+XZdhn9sR07J1pUZOu4P6Kx5ueTQqMqabjUTNINErryQW2+ENG26WUWay5aY7W5KbOzqe9A8f2SRaeet5k4cXCoVfUdRiG+Cr1pwBwVTOloQTTq9gohTV70GOQvTOsjyLqrTdFBKxpEF+tolklr6v9VJouodfOxX3sweAO1bB6TxfHTDpVLD3VEqnmP+RhYlqWOe/6i X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0c61d5-7b6a-46d8-2cc7-08dafa623ddf X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:08.0933 (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: uzc1PayUBTn8QwNINePMcMRIs+2mVuVHc+os/8zMGiWkqceDqmhU4GwiZs+BCANkMfErOjy7xtTNV+9AE0hdh85NqLVWiBIFvACLk/n93dU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5600 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: QQuKnIiI86Y5FVEVf4yTr8Tf79LWhpnA X-Proofpoint-GUID: QQuKnIiI86Y5FVEVf4yTr8Tf79LWhpnA 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?1755487752339819670?= X-GMAIL-MSGID: =?utf-8?q?1755487752339819670?= Change hugepage_add_new_anon_rmap() to take in a folio directly. While adding a folio variable to the four call sites, convert page functions with their folio equivalents. This removes three callers of the Huge Page macros which take in a page. Signed-off-by: Sidhartha Kumar --- include/linux/rmap.h | 2 +- mm/hugetlb.c | 90 +++++++++++++++++++++++++------------------- mm/rmap.c | 6 +-- 3 files changed, 55 insertions(+), 43 deletions(-) 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 c37a26c8392c..6f25055c3ba5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -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); @@ -5479,6 +5479,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, pte_t pte; struct hstate *h = hstate_vma(vma); struct page *old_page, *new_page; + struct folio *new_folio = NULL; int outside_reserve = 0; vm_fault_t ret = 0; unsigned long haddr = address & huge_page_mask(h); @@ -5590,6 +5591,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, goto out_release_old; } + if (new_page) + new_folio = page_folio(new_page); + /* * When the original hugepage is shared one, it does not have * anon_vma prepared. @@ -5599,9 +5603,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,10 +5622,10 @@ 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; } @@ -5633,8 +5637,8 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * unshare) */ if (new_page != old_page) - restore_reserve_on_error(h, vma, haddr, new_page); - put_page(new_page); + restore_reserve_on_error(h, vma, haddr, &new_folio->page); + folio_put(new_folio); out_release_old: put_page(old_page); @@ -5756,6 +5760,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, int anon_rmap = 0; unsigned long size; struct page *page; + struct folio *folio = NULL; pte_t new_pte; spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); @@ -5833,12 +5838,16 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, ret = 0; goto out; } - clear_huge_page(page, address, pages_per_huge_page(h)); - __SetPageUptodate(page); + + if (page) + folio = page_folio(page); + + clear_huge_page(&folio->page, address, pages_per_huge_page(h)); + __folio_mark_uptodate(folio); new_page = 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 @@ -5847,13 +5856,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; } else { - lock_page(page); + folio_lock(folio); if (unlikely(anon_vma_prepare(vma))) { ret = VM_FAULT_OOM; goto backout_unlocked; @@ -5861,12 +5870,13 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, anon_rmap = 1; } } else { + folio = page_folio(page); /* * If memory error occurs between mmap() and fault, some process * 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; @@ -5874,8 +5884,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; @@ -5909,10 +5919,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 @@ -5925,7 +5935,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, page, ptl); + ret = hugetlb_wp(mm, vma, address, ptep, flags, &folio->page, ptl); } spin_unlock(ptl); @@ -5936,9 +5946,9 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * been isolated for migration. */ if (new_page) - SetHPageMigratable(page); + folio_set_hugetlb_migratable(folio); - unlock_page(page); + folio_unlock(folio); out: hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -5948,10 +5958,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, spin_unlock(ptl); backout_unlocked: if (new_page && !new_pagecache_page) - restore_reserve_on_error(h, vma, haddr, page); + restore_reserve_on_error(h, vma, haddr, &folio->page); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); goto out; } @@ -6176,6 +6186,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, spinlock_t *ptl; int ret = -ENOMEM; struct page *page; + struct folio *folio = NULL; int writable; bool page_in_pagecache = false; @@ -6251,12 +6262,15 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, *pagep = NULL; } + if (page) + folio = page_folio(page); + /* - * 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) { @@ -6271,7 +6285,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(page, mapping, idx); + ret = hugetlb_add_to_page_cache(&folio->page, mapping, idx); if (ret) goto out_release_nounlock; page_in_pagecache = true; @@ -6280,7 +6294,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, ptl = huge_pte_lock(h, dst_mm, dst_pte); ret = -EIO; - if (PageHWPoison(page)) + if (folio_test_hwpoison(folio)) goto out_release_unlock; /* @@ -6293,9 +6307,9 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, goto out_release_unlock; if (page_in_pagecache) - page_dup_file_rmap(page, true); + 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 @@ -6306,7 +6320,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 @@ -6328,20 +6342,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); + restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + folio_put(folio); goto out; } #endif /* CONFIG_USERFAULTFD */ 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 Thu Jan 19 21:14:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp555041wrn; Thu, 19 Jan 2023 13:33:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXuL5ClF7o2Ql6PwH9Yr2RTnMvBErd/dQeIr+8Yl0fybW/pJRl7pF8rGjTQkIAppwJn146Dj X-Received: by 2002:a62:a507:0:b0:58d:e780:33cd with SMTP id v7-20020a62a507000000b0058de78033cdmr7232294pfm.21.1674163987592; Thu, 19 Jan 2023 13:33:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163987; cv=pass; d=google.com; s=arc-20160816; b=nTNpnwMbsnHl1xPGzw2lt2X4a5QzYVQQWCctQpAxGHjmY4dXLb0oV508bLnhbm0ShX 12JODSXDB0Saoho95bJnwyYNu0AAOgNqowYmHWw69GB/XwlMN/Ym7dzB2ChTpCeCM+77 IJmYwypf0uc231dAtnyLS5RQ+yXUcHW+ZdiJOxgWpqBHuTGwHqICBRwVDXt73tozYwvQ oLRERG42iXdaXwaTMqt4nkz8kWvhOBUbSQN6Vvh0Hi55BtWsmcwkqxAupPOMzYAPiN1G EjbYzcy3TwsmRHwlDY1gqWBuZwJYTMWFFC9d9NejO9CB/KCtkxuTFCX/7jSkvalstQaz 1N6A== 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=GYb+knLTbexJ/uzVeiIADOAI5vrG5GzfsA+zdeB1WS4=; b=1EpueRUaXUqYE8g8uij8ao3ncQE8sBBY7WZ0j5KJX6X/NLBNizV/iLjxA4ZZ2ByyV8 HfBG3BScZGc+5f1i12cL++ZBZCm72luZ3BD+V7/v4Zq1BG4isHT9fReva53tOtWFDFcj RVcxoavL3XxMuNgvuAGvDgH6FMjjqDJ/G0GbwpjG96xePsNI7tk8N0sZsvDp84f4eFrI LuT+pFmQkqPpnnym0QL70zGF0JnbIHLAoub+WWWT4qaptLw4GYNAvlYoo3Lt1oULatMG h/OZCBFSge6Qblrq/+49eTYfsJxNljX/ONGAU2IvxW+RzK2vH9dDEizG/Ukp4J2isv1Y JkGw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=Js7G3498; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hwJLMfjE; 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 h9-20020a056a00000900b005820fba237fsi14746249pfk.302.2023.01.19.13.32.53; Thu, 19 Jan 2023 13:33:07 -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=Js7G3498; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hwJLMfjE; 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 S229520AbjASVX2 (ORCPT + 99 others); Thu, 19 Jan 2023 16:23:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjASVV5 (ORCPT ); Thu, 19 Jan 2023 16:21:57 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D30D049564 for ; Thu, 19 Jan 2023 13:15:34 -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 30JKwkrb010055; Thu, 19 Jan 2023 21:15:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=GYb+knLTbexJ/uzVeiIADOAI5vrG5GzfsA+zdeB1WS4=; b=Js7G3498bNb4lQAbgEqSwauB/bU9fyDV1m7R0zt2RcZuYEG4hgwyaC7TYyM+6D7Sh+LG oMZETbkP644t9grbj2fRCdnN2JNckzwmy20zcwFV12j8khdKOtZ+ppKXBBxWD4r7BhH+ 7BiQr6Wrfi9kI1NErZJRgPoAzwTyK/wiDFWD6n4Rpoq+ucBdfRy71ePGZoTulg+o4zXA 1T7VazkfpndYMRSWidfIQuj0JaXGN9XPtY0JxkegnoNy/oU5c+bzGcxULF7tW5jQvanM ulXbEvLpLe7RiIVxQShCllu0Lc1PfhRs9UZRH7ZPB0R7JpCJhiwx8FpvxYlt647XcgpU jw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3medkdva-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:16 +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 30JLDiNF018698; Thu, 19 Jan 2023 21:15:14 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2048.outbound.protection.outlook.com [104.47.57.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6quh8tg1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z4Oi9dJgGLosP9so4eQf76H5sfgrzsUwFb+IvDYovyiIHuTpJtndUxtMk72i/zVSeHSm9nmHl2K4T3Vhk3hQJd5YsUVdeX+4FDuEy9cn5G/5lAW4DSlalxDy+K8AJf79AKm4ABvIaj2f5z5wHQi9Qx151xMgV5R5Vo8Mp1d/YZtNOlYcmZUWAE2KmGM5dviBgNmrd3RReDabojEFMksC3IaaYar1G6aQ/vL0zcYHRsllnRd9S/TbxDja64DgZ9tBzRFnF7y3L8L9xVIlpChZA7cluPzIxnl5DimH97wPYgqNFnrZYeAgyH1/jcbkRgWRh1k68iGfzewAk5bngLPRiw== 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=GYb+knLTbexJ/uzVeiIADOAI5vrG5GzfsA+zdeB1WS4=; b=AMVFumpRxu0q63xu2wbYD0PKcStjti0jPYBWSpu9C27Gb95YoVbQ/adTEbWduG6TyNRoXhIFlkOK7UDt+4FWpg1bNCPmHYPt9KAqOFPBHFJaE6qtRIEfSIeDDUovHHZAG2KfcfPYf2j+bjvudNbtAv+nktJ1MhJ3n1Oje9+w8B2vkQLEXZKJJnaisQQ2xTZIVK4FlKRSZkqFOCP/LP/rko69PgfAyybUwQ4winY47jI3p+2IxRmXSpzvlJgwpcSnzBjHG7tQGMTRPE0/xwJL0+VhW2zqZpOPOasjxCLw4xh4jPQ/ClmbHmj+7zKssnRqz0iSUI984a6zwmAKmlnAoA== 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=GYb+knLTbexJ/uzVeiIADOAI5vrG5GzfsA+zdeB1WS4=; b=hwJLMfjE92dZ4GpZJ3DuUS7XiDxQbrEn+REfwod//qMz80ioYxn0Q5QTFkobYdWA9SjNq+a2xqpIBs4VNYDkqKlGTfc3U6mD44HRdrabwrv7QEAhKulvj+fTTUlUS4caeNmdAzI0ZQLSE7TW9gT6+3fRqb4k68w2Pr2FKIVI+u4= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by BY5PR10MB4148.namprd10.prod.outlook.com (2603:10b6:a03:211::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:11 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:11 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 5/9] mm/hugetlb: convert alloc_huge_page to alloc_hugetlb_folio Date: Thu, 19 Jan 2023 13:14:42 -0800 Message-Id: <20230119211446.54165-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0281.namprd03.prod.outlook.com (2603:10b6:a03:39e::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_|BY5PR10MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: d6151c72-6de9-4a0d-0236-08dafa623fdb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jLOczRA67EZmUuymv1DJYdmMvE9woS4V37tJ4ZKWjSTqWVpFRF2EBBKvyeBtuKW0W38DQaFghDJgzuYUb8esPPbjRwWt07ZVF3y0GGjMOwlWox7Q89zo8IIyAeDyBVChK0/CJ16z4qA9H2q82n+/SBXbobc81P0KsP+qWx+P3Qri0UERt34K09f1vdsExWeE4VKKOXj7en+EFyFgeHHkUkFAgaB6l6T/zYKdN07pQ3xfq67Jrp6ZeRFhaLgG6bu4NiwzB09jfk/0kq42R2yzUQMWVgqEj7zt0mu3sQZXfC8wzk/6msECsntv80TZFhQKlkPFZsxh/J3tKWs6RyshfVmbkfpY/AqnywZ7ig45pizENo3Gs2Xp50zWefHEpGUPFapis6mMJc+sS8E0vXdi+/ktBrDycTw2qUDHzQU4ZGZWtX3oCIG72ESZovZHETDo7BVlzHg5lipUQ9+mohnA+bHs+dcoeQiqPM+lEIFxZlWLPDEBBKykiq8/Cz8KWnFz+tFVOQaEfmk5xKgaajRId7P14DQbTHoE3p6by4gX/Qw7saryIZGDMMrbCkdAyaPBpjdjVNSvedyBbtVNHdrSuR7P5g35Vg8zy4y1TxTSy+PRDf2Djn3fOnKJphH8l72U0b+Jl/yo6Y3W4oM6WJpHbxK5SI3KsZtdlhxuaRzO2gpFKd0uQfq9Un1vVWmyYW22 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(366004)(376002)(136003)(346002)(396003)(451199015)(6506007)(5660300002)(86362001)(66946007)(66476007)(44832011)(30864003)(2906002)(8936002)(66556008)(38100700002)(316002)(107886003)(36756003)(6666004)(478600001)(4326008)(6486002)(41300700001)(8676002)(186003)(6512007)(83380400001)(1076003)(2616005)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xa9a/g9GiR8PjecpvF9/aMd04znLLmMWGRZQ3fLPJ7YIo2f9TTTCl5cG16XqxdiTdizl4rObWCZbj3Mit5CV9B1MQL2z4Tc0s4+e0G7+6bn256AzmWsWL3lay76CALegqu966pGkorS00lzcA5DCRRzq8RoFfWYLCZIRSKoPQW9lUUlR+KXU44SFEvznz932gnrCQDBd33CdKgQ0ZE4JKo/52GyMG1n4ZJH+GVhIklrNo3WB5daRIwzE71WwIA2o8q89M+kl7BJC/0T9gvWnxGGDQR/j/hdP7V3C2ULDtoUwOXEcx9z4HdwsCS1JIm+0xM9L1Ac1yDi3jd0/o6TKsUgPsZkiDl0apJl0DBVUlH8W41LUcM+W6ZWMkmkqAhUi4bZDovHrFt5UicMQZfNXV7P1Jdoxnxo4y7iaxnlqS6uTPKFSPQckwVZARldSPYX9tO+0lR9CfOfjZRSGk9r0kgg7+11wnDq8taNerFgRT1a6jJbBLi0sQgLOdpIgjDAIN+Y3a6pBNwCExyb2sJ8UuBBYWVijIuFjV2UrdeYUQ0ssaYfFPy3PAmmtS+qK71RzdN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eYfE2KCUzNamUhuOqruNTOecg3au6rAFrcg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VCHvQ8c2H7uEaUzLKMBAGe0LyyxLb697cGd2Cr9Ts4UUgvhKmcudzxrQ7fV6hpizd8ODIgLhK1HOnN5hP2OVkJAgHicu0xXhjhlNkF0/2nnT2IYXPAWP6JebBaleE7fB6CF8fHJ55XNEKO1x3pvEeP8lWyb8FU3QSvENoKna/fUYI+g7SW3JfWHF3i7rzoQx3WVUQAm9MYHQM7crurdRrxoi1woeZrBzvtD/el76D/MDlS4/lh4Q4FqBS3jX7vNUn1BWjH0JUVWyfDwxCsWEIfGsAdNoRldJUuK9V+p/udB01nkKOXkEt6tfSM4XL7P2r3Tn9B5mYkv79Ltfqb5UT5T1nXBF/lr71tXXBNPm6ok7JLGkuCHaMl9SmO7y17op5F3wkJbadEqp3F0+ZwRE58x8T+Pbuev3gc6iZl74dLW9qOwMd561Htw4t5GLFUkUKyKYIgLMWUNJnbo6HEnuD8LralePeBJJYAiCDPAEpDVVAifr8TR8HY1+xf/kSyRIGGwwH4hMhWXb6SH6m7t8wwe/a1KwlgsCVxBC6N4CMzrmqAl5Cd2GKSOqo4Rr9jRLTzXfxxXSkDciYMmyy1qwJe9zW58ajtomJ8SFSgVr1HKh64tD/dSWkrSSWupSlNGKk+u4A7tVxClwQkap585iCz5ot0aRkESLZoF0BiPnD48iqwmcAbVp+YmVMH9aIgSOY36ME+Zs9fvE+7WmgvM83ocPdnV81kq+nJVo8943qec4w14AuGmtims51jgw3Yuek2An+uylklTLqeFf3fKeHzlWa4fUPBTp7bxZPcWIZVq2PH2lJ/Qz7HTllo772ezszlP3imehdB04LLXdJzTzcuKODYkOZGt8U0vz05NfH4q29hj0SeuiDxzVLHUf7CiMQxXYRfUOFpnPavnLR0WO4nWFlo/X3eakqDj0cFjwYJDzR10WeY5T6SzCfV31kdAY X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6151c72-6de9-4a0d-0236-08dafa623fdb X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:11.5165 (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: mvut+1pMwoaHNH+H5Bb8O5oNgZ0tO+tpU2iEiQYsC7Ljp14nUOeUuIQpcAba4/XP464HFv0oAAyL2l2sr6QV7kySr2W8sCCwfyGA/wvi9gE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4148 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: g3RfW7cwUdjzMdXp-gfxlsfdP3aqLzZp X-Proofpoint-GUID: g3RfW7cwUdjzMdXp-gfxlsfdP3aqLzZp 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?1755488177805861795?= X-GMAIL-MSGID: =?utf-8?q?1755488177805861795?= 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(). Many additions of the use of &folio->page are cleaned up in subsequent patches. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 38 +++++++------- include/linux/hugetlb.h | 8 +-- mm/hugetlb.c | 113 +++++++++++++++++----------------------- mm/mempolicy.c | 6 ++- 4 files changed, 76 insertions(+), 89 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 48f1a8ad2243..e2f8951103be 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -819,7 +819,7 @@ 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; cond_resched(); @@ -844,48 +844,48 @@ 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); + folio = filemap_get_folio(mapping, index); + if (folio) { + folio_put(folio); 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 f88c832bdfa4..8f054d81e63b 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/mm/hugetlb.c b/mm/hugetlb.c index 6f25055c3ba5..46467e80716f 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); @@ -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); @@ -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,8 +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 folio *new_folio = NULL; + 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); @@ -5540,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 @@ -5587,13 +5587,9 @@ 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; } - - if (new_page) - new_folio = page_folio(new_page); - /* * When the original hugepage is shared one, it does not have * anon_vma prepared. @@ -5627,7 +5623,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, 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); @@ -5636,7 +5632,7 @@ 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) + if (new_folio != page_folio(old_page)) restore_reserve_on_error(h, vma, haddr, &new_folio->page); folio_put(new_folio); out_release_old: @@ -5759,8 +5755,7 @@ 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 = NULL; + struct folio *folio; pte_t new_pte; spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); @@ -5784,8 +5779,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * before we get page_table_lock. */ new_page = false; - page = find_lock_page(mapping, idx); - if (!page) { + folio = filemap_lock_folio(mapping, idx); + if (!folio) { size = i_size_read(mapping->host) >> huge_page_shift(h); if (idx >= size) goto out; @@ -5818,8 +5813,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 @@ -5833,15 +5828,11 @@ 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; } - - if (page) - folio = page_folio(page); - clear_huge_page(&folio->page, address, pages_per_huge_page(h)); __folio_mark_uptodate(folio); new_page = true; @@ -5870,7 +5861,6 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, anon_rmap = 1; } } else { - folio = page_folio(page); /* * If memory error occurs between mmap() and fault, some process * don't have hwpoisoned swap entry for errored virtual address. @@ -6185,15 +6175,14 @@ 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 = NULL; + struct folio *folio; int writable; bool page_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; } else if (!*pagep) { @@ -6206,34 +6195,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. @@ -6249,22 +6238,18 @@ 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; } - - if (page) - folio = page_folio(page); - /* * The memory barrier inside __folio_mark_uptodate makes sure that * preceding stores to the page contents become visible before @@ -6887,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; From patchwork Thu Jan 19 21:14:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp555295wrn; Thu, 19 Jan 2023 13:33:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXtmrVU/fL3tOSmWnf9NQHpt7//qA4xssvWw0cEBIV1SS/y5DASsc7GP1YBFU6q3im3Et10d X-Received: by 2002:a17:90a:198c:b0:229:f4f3:e904 with SMTP id 12-20020a17090a198c00b00229f4f3e904mr2363432pji.11.1674164028071; Thu, 19 Jan 2023 13:33:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674164028; cv=pass; d=google.com; s=arc-20160816; b=nsQ3i3a2tpoI7Il9FyjkBGiLclZHfOWsoyhKAW4UHE9+LwuUowqknpoHxVfgo7ghcl ysL1kpujEQnLDJHaiaXbnqMjcT6rPCRidNMnfjiszCGdn+hT50FX3cGFMxX3B3RBzik7 87RyLeUnzBl0HBAMhp7Ix9LKwrbSPxmFkKddnacqE0OixbZXb4nt/4xob3EbnXIc8F7H WI5W0dUeaAgG1aTMdSZ0aw9T41icLCpCJFF3hw/JY4jmH7yznZu+2YW3v0XlEUsJMqFv d3hfTQRwduiap/+aj70wZLbWIM75+Ku4CCvWNwXPCLSwprELdyJn8C019X1cy/cCMpof W1CQ== 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=eajZ6BEFzwRRcAfH/MaHIcKZWur6SUr+SVPX61qbPAo=; b=jpSf9s9xumbj51uDvwd176M2ig6uRNciVYTUXraAWsTrOTmzPqVPXJbVteh66z5KBe mJRr+TAgdTRee0CyWbrxJ+jr8fD8ijAsK5MXzCN57j5jisRFxgVflc+9kLvjXv4Y03ni pX/Qq8XOd/3WkkMNt3E1XpWOZREMdEtCvjIxex3blLmmvbX/qh/I42fuoiGBZ2FHJbUC 7H2rUd7PLPLUYgtvdbxc3QstAgRU3mhckuQGZ2knXFhkBGXG5/czTDDH/5uf1tliNM/Q /uG/mGGQhfAbQ86bz4jJ39fDeOqVPgxQf9LD3p0URf97J2NXJu+gmI9PTTpgsK+m3vrc 0NlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b="czV/pYIs"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=l69gYxcp; 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 z10-20020a17090ab10a00b002239c987051si280514pjq.128.2023.01.19.13.33.35; Thu, 19 Jan 2023 13:33:48 -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="czV/pYIs"; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=l69gYxcp; 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 S230070AbjASVXg (ORCPT + 99 others); Thu, 19 Jan 2023 16:23:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229819AbjASVV7 (ORCPT ); Thu, 19 Jan 2023 16:21:59 -0500 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C1F9D287 for ; Thu, 19 Jan 2023 13:15:42 -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 30JKxAxJ028142; Thu, 19 Jan 2023 21:15:20 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=eajZ6BEFzwRRcAfH/MaHIcKZWur6SUr+SVPX61qbPAo=; b=czV/pYIsntIESziVOKhDes2aiUKRe89urajibF9SQ6sKYiOaIirXk2b8SYd/6IZYVDGc lr5d1ppFAiLOwb+lFbHcJZgGvRzQ+QxaRy3mx2BZbcjVeATaKGGhTM37elTxQzyfH8bn a5891TMF9Bznkvw7z03iKeouKfFEb4jijRlnydBbdMJPDnCaxed6F/1DHMzsIFPm9idf Nojb5xV9E08Po5QmmtzJWqDQnrdn+rR92FMxDijr59/ZugU8c0ofF+xjkjpdRNO3pzOa AThj0QtHPFwdaoAwTJbhh8xNl3ActJI/O0KHy/KpwB3tZ/M6ImOjiH4Ruj4TjHpkaYU+ ag== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3k013atk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:19 +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 30JL9XI6018694; Thu, 19 Jan 2023 21:15:18 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2042.outbound.protection.outlook.com [104.47.74.42]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6quh8tmr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QfZVaNaN+KtCXo/0pisTKB0rYR1JxHxXx4VyvtELMfBIC+L8f/V2vmTAObOu0QGrJaiGiePvOBmlnewfUEKbXwFazZU3etxMYYeVB8VPX4rqQhLiFdBpAeImNnIvJxhDkqZqyImIFqIvugW3TynwmTqYQL4QVWJQS+Hi303GZ4pn3ZSJGKW2IPcNLKY7x8lILmT4kzeWEkTe6NABW8SCyCynEmaai5E4M6XbMMBX7Bjr/Tz5mOcZZlXqqlqIhHtGpr2AsVEfXsnWjz//uIRL2JxAaInQ75YJVKcJ5SHITzU7bh0ErDH9BQTRXvxledse02duPDEqLoL7eYU7eVNiuA== 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=eajZ6BEFzwRRcAfH/MaHIcKZWur6SUr+SVPX61qbPAo=; b=ji3qDmxfltN0zQsTWN8EeeQYAcLW6kW2qrJTRf6zemB5ko+KCRBb9NCXbaTVLipTGIVLkD6wKLc0OtG9KaQWs0/2kRCE3co748Ws/XLievz0GJ6jqXSxrEbIGB8zxhkALSs0lWkK+uSjar4haIrrzNGRQ0mGL65vOvYQzgtKz0ecXvsSXnH7CKoWnrY3gCZUMfKu3+lyGr/9bIAvZ3wGajTRTZiZbzBIPaOdw11/SpjbzPwfIQGYCxFkZ5nW8zECzzlrOEIeB0k6mtrH9MaxLwyUmVjWS/ZPDjODjG1LTdtidtKUOSfHN/tnkQOPIbnSME8PhLoWo97KarHnjL+BJQ== 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=eajZ6BEFzwRRcAfH/MaHIcKZWur6SUr+SVPX61qbPAo=; b=l69gYxcpPq7wflv1sLLJPLbjmxykf4drcZkzUnUVUhPvx5DlRMK/v1tl07HWh7HGlfcTQJ4FdoPOoEGD+PQlLM7Jw2hUYaeyuGfvBM46+N+Xv4nGF8no/AwupLIoVvvtxJhpalAkPXLlphBS7XHtHbvr7kww48YpG7jkEudlT2E= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SJ0PR10MB5600.namprd10.prod.outlook.com (2603:10b6:a03:3dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:16 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:16 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 6/9] mm/hugetlb: convert restore_reserve_on_error to take in a folio Date: Thu, 19 Jan 2023 13:14:43 -0800 Message-Id: <20230119211446.54165-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0291.namprd03.prod.outlook.com (2603:10b6:a03:39e::26) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SJ0PR10MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: d9709ee5-3f23-4d51-e8a9-08dafa62429c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZA2OpWItrijEzYlpfChi3S1vOcgoPhgTvux9eIk+RfqftszHHRrNKPxEWzOy0jQsggnemcVPojfA7RGF72LDnbHUILQoK4nRkE4O9z5XL12RUr0EfBAqDuLEJpVKBTZr6hwXyDt0Bg0uLxwJYe31XHD2Md7fOFsZJkeOZo8SxDX4f19antmbt476v1ii7Of8rGNsNtw5RcLErURlI1Itwln9y05LMDiuyuT7cc7zc78xzSDAbIFttv3b+CQHmrB/loc2Zb68Dx7Qzj9IaEIYsN1ywIoe7i+iRXHWEpWJMEfjc7oRVpJNhwkV3jOP+HoXD7TBGPfUnpgi7/fUXYz2x+/1LatTDohUNqmIiOfbOlXKcv4TbLe1NaNvdhhnivn2/+dfGnIxmrwN3Jv0fRsUof9+0414brFMjPy+GmYBsjn5KhAl4biX6dVJKvWSe61q0s2HmMQJFgpWiGhe1huYqCB1JmVhB7wvciqcqMqDcFBxX07oVBym0K7T4EqwoId7VXO29I2hHNUgzVHMzsBqBfN3zmSGQsiObGAM9jLvo1AftvAwv2glyk27j90KSkbxzF06EADGa06LzrnGQv24teENTpLqgtJbssD7AfkmYZsY1NYqZ98/29fXnFnK6wJwfGDa0J4Osm0YZqqNUunM3A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199015)(66946007)(38100700002)(66556008)(66476007)(478600001)(8936002)(44832011)(2906002)(5660300002)(4326008)(8676002)(1076003)(41300700001)(2616005)(6512007)(83380400001)(186003)(107886003)(316002)(6666004)(86362001)(36756003)(6506007)(6486002);DIR:OU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i5qRvzWz5THEhxv/poxsxax3a9V/g89P9A4bI+Nbe2RULTCIRUkaqqzhqeknQzrmXRuUbqfmoYiJ6HSwkHdBh/5sufeZbIlnLThb4iDkSn183t7fwWccOKzXF5x/0UCAKCnHCSgcpX+kcjVUkkYYXbWiy6nCFv8ny0I4sqzUvMk+eLDJTKdVZCyK2cfOxZSz6AzUJcu33phlBc4Nz+ty6wzINSvKK8TQamTltBVv38fwhYXPyHo2KEKvkTjmSi2YLN2U+mD+2dvERddwvGHzXE/ErQOufjHe5h2zdCRyo0htfBWVYFjTm5yDb51mhzBoSmMzwjbZt/zTekNdM/39P4VXVzNFTmKoEdeVpP1338sthtg8gK7Rzxc4cdUjQYYq6UV+LpGHYK4QBGCr8XyO9mm0THzDELA4CkgFcbO6pEFASWooUMk0fAKBr54COda2CwBPLQYyhCp6Om8Y8z1AMIGBqPG31stUCobbnW/oOdZwFzsqzAQAwkfmQIDr4HEX6iokd52ol2KICPtHVlo7twLKuQ6ELZbR9sPFkEq30WrnRBt5JkOh42+T0HBDZm1zKamm8X4dd6RkwU70sPN38eIQWZhsZmZxMb78B06iWZWprPrpCEk1mFCg5p/FOA9lUNok9p4YwHlQd85Z/JSj93GMSAumoj41/Ao0IKlA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: jH44AFwPIJLsghRoNcN7BGv4JOEJyH/uUN+1DmDO6TtcpfK8BV9nePM2tsIsm0VcySWWKX9XpclaXNt22JJY61NoJeDwEP3SXRGwq5o/YQG4ktuTCJz78MAUamiheuu2aJoW1J2buQHvcrBuNJJG06KsknS7T4cIVvjxZqNrSMxe0FWwLwMGCLd995LsRQZJPJmpBWpvwcPhhiSPJvzuYP9NdH7iZIFVxUWufRaGVaNFaLKoI85kq+S8EvxXai8xAzlPaYvQIVYXjLIfofhaBHUKyIfBGgNpkm9ky8ijALWATw/wue1oIUTEGHA1A3782PiQczFequ0GjSaRyH0tJd7lxB9NI3d8HAROaaJ0GaE2UeWqGi/GbeuGELJ+TXLMbTFMHYVjAuZZJgggVBVw1Otgn2EgpIaeZQ5I0M4Mua81oNwdk0a0iuYqVPPfn4CdU5lHBawGQDK4EAYtz4V8YQioZw2IiqFkyeYV9Dtn/ZbjnYnhMVYuC5B9NkL5MJx5DOxWNSpdfKh5t+9ZMqdWLcIW4En9cTZBkIvGJ2Iwdt23uDeLU1IgaKDAQebSVQWo5cTasDxkkLNka+QGzowkmtHnamK5Os2Xycg4ZiUcCZez1l+NTVKj35hGhVE85gTsAJijsJu3NVCsccqI3Te4JjXgs7qO2A9Ju0swq5+cL82NCpVvMPI84f7byo6cJ5vFPC/AaydR4HcwvZhBoUKpmGkAERy9Vs/X+97e3h/qhIBFS0pKyBu34lPT1v2Q2Zf0Bjuu3OdsT7uEpKXFVR7QWRjmdPxQEt9sLU/jH0ldXYXDB7rYjW4Sf/BNimfBCuQvXsHQz3XXOYe1xTb+RgWk1o2Tc51Z3L6/p2LLvGVHeEsBEWERoNeUnghcM7lOlL4SDDksH5hyzwOslroOG+5I5jfTtGfXowdCi0MkgCb/LpnCvRSGBlgX1cuX1SodgWyP X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d9709ee5-3f23-4d51-e8a9-08dafa62429c X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:16.0476 (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: eMncciwByK42ahoAFSX6SP36VcjXjHQ1YtN3JxDqUCMRCeZqreisKu8l5Q13iwiV9MjBjKbq4TL6kNqIg+e1gNfBVC0nce0OFxVFCWA0Ki0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5600 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 phishscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 mlxscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-GUID: Oj6PdwfMtkh_oXFQY0eAAe7QagN6blGb X-Proofpoint-ORIG-GUID: Oj6PdwfMtkh_oXFQY0eAAe7QagN6blGb 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?1755488219924136635?= X-GMAIL-MSGID: =?utf-8?q?1755488219924136635?= 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 e2f8951103be..880ebc58f330 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, __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 8f054d81e63b..e76be7e8df2c 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 46467e80716f..9568d49c12d6 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; @@ -5633,7 +5632,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); @@ -5847,7 +5846,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; } @@ -5948,7 +5947,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, spin_unlock(ptl); backout_unlocked: if (new_page && !new_pagecache_page) - restore_reserve_on_error(h, vma, haddr, &folio->page); + restore_reserve_on_error(h, vma, haddr, folio); folio_unlock(folio); folio_put(folio); @@ -6211,7 +6210,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 (!page_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 Thu Jan 19 21:14:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp554842wrn; Thu, 19 Jan 2023 13:32:35 -0800 (PST) X-Google-Smtp-Source: AMrXdXvlZeAp/IZyWuvxJyFclRvg7/tmFRYWQvUr+Kkxpztr1j0Mqlil9trq3+Oa/YLX0zd1tFxe X-Received: by 2002:a17:90b:4fcb:b0:225:f47d:b49f with SMTP id qa11-20020a17090b4fcb00b00225f47db49fmr11881388pjb.39.1674163955634; Thu, 19 Jan 2023 13:32:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163955; cv=pass; d=google.com; s=arc-20160816; b=Pfc5Ne7x2hffKywN0FHpux2LfTtF6R87hkkRO7MMHn5g145XPaycuvD6ofPOnUbTDX Z5DuESkKVeRqXJcKqP4nkCpjEe/ySbSrW2Wmk7Vx0UJV0V+eYRm0LnKZt5JFMu7Hcotb B63CbbZIb+gFQZD9d8FeD+BTmL4UhmFZsi2qR5LxNi0HTSnkqcmZjSvoomYIex+NxSCO zAKSsZ0BIRIgWe9tGAfoZiVmavYy9vkBNlEQHZ6DMxhKc9sFadajMPE41JTiJwUlvyiN ImffPDSn0xqrKC2BwcXEM88Y/u1tij1NzDq1Fwe3Vys4ZJr7cQ8drOAJEdgEevQGsYdR k3gg== 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=GHxPmvKVHX3NIeUTQKvpfBxCyfCEIpn1BvmhiZqKnxo=; b=ztd3GFXdp/5lGXcSo62hXpLmjvP4F8h6hE/rLs37KiryxlRWCULvVjXCa9aWvIreNb rrupfuNJmYpCs2dTP6rPQvmaw/DBAN6ZUR3S/S/kTX8LXHj0/tNcp4ARthenQe1lo+0c J9bAZM+0AE5AHc59CNh5CaSOxAf5y48dglkfkVjRgRzblfK0GSYGRWhHWbo//aNLy6Mq nO2stmBb/sglmA/jtXu1fUHEq45WBLoOgn4NJoyUGkGOIW3CcINcgTvzdDvZbrrVSCru DKI9Kca3ZlG9Bn3wUbKmM9tgOFcG31Q7gZmD91Mcqg0KCgMLx7dnSDkWGDmSoop/Scte WfYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=gYgoXoQS; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FMl+i2cw; 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 e14-20020a17090a9a8e00b0022979c98557si399840pjp.0.2023.01.19.13.32.18; Thu, 19 Jan 2023 13:32: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=gYgoXoQS; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=FMl+i2cw; 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 S230165AbjASVX4 (ORCPT + 99 others); Thu, 19 Jan 2023 16:23:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbjASVV6 (ORCPT ); Thu, 19 Jan 2023 16:21:58 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD4329086D for ; Thu, 19 Jan 2023 13:15:41 -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 30JKwkjO010065; Thu, 19 Jan 2023 21:15:23 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=GHxPmvKVHX3NIeUTQKvpfBxCyfCEIpn1BvmhiZqKnxo=; b=gYgoXoQSH7r/euiZWS4oPXh5s+c5OofsU106xRjb5P27nd2+V+1uQjFVKm0eyuQczNJK SzJKTiDPqwq6YYNjGJe1TOy92fuh+Tee3U7kf5HTWM/LpIy8/u7wYezja6ulx+TNDSt8 Nv/zc9EohjXEY2d9N6xTFQBzImcSqZqCjirdmEDmMKMhPq4pIgUC6MtExRyC868yucer xu+e33WE6FfEJTWmERRUcGwJoZoFbJa3D7oqrg0Yx72wHJY2lszrLWzxKIzKeT7hTKcR AQyZn3osythOsNG61ju/X4dk5LKEVwp7hj5d3GSntFMUvkrsWQlE/iraKhS6qmMExREe yA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3medkdvt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:22 +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 30JJZFcA000860; Thu, 19 Jan 2023 21:15:22 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2046.outbound.protection.outlook.com [104.47.57.46]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n74d1s0h3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVbeGsv50Mywd/K7OJ49cX7buOM8ioVvcppnKO7xM06rJO1kvD5x4wZI3kcu9E3WzHJ3Z2jDYvQOn+yT+F6X0S/ZIz+3lbkkVTMTsQp9U3LznnKG/SZFe9pqO1j40R279zFaRA8qFY7qEoD4np4oi8v9DcurgF0VhH469rKpEOy9RqYXh4CgY+sIAa4gCpnHI9JfvsG6jq//LsGo5SS7O5KWTarT7EiNBzKs7gZoYIEPg+tKHjM3CSX60Fwy7rc3sZepvzCY+jPIAE76Ihmdf/YC0f/MgBI+gcQkG9IKep269w/hbs7osT1daQtg6GbHl0gKcz8UehT8rTBALZGxag== 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=GHxPmvKVHX3NIeUTQKvpfBxCyfCEIpn1BvmhiZqKnxo=; b=K6YRKq9faOebPAycuIJl1bD9B5K7K8m9plxC8QtsvZH4De2v1t4fnINKLxcZVwodlqmDLNsmXak0zgczYVo0V84cv2EnHKXMP8Kza5pnEI9YtwNnkpg4Ycr0wtJ9/hbpZdLnrC6lIcDzCKr63PZZAitPasr0qCqmYq4PHi4eAJB9zYUpcM1f4PSdTyyqsCiBA6w1/PfhwWBuDdunak7Q90f2rPn3CSygK2hAfqz50rXNSfR1biapEVhcWXsgbvmMkw7oQKXAhQtYRMYXHwDTYm/KTptF9B7DzNXJRjEgpTQwY4CJxrwyCHi4zbc93WCpLVs0BWtOYDQUQE+tAFfMVA== 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=GHxPmvKVHX3NIeUTQKvpfBxCyfCEIpn1BvmhiZqKnxo=; b=FMl+i2cwH59ZYP/hVFViBUAfLoewb1Z4JkfW0r3PRxa4mZZE1kBf9jI2G5nut+yZrGpOY7bnaGYDJDzVk9wpYGxLUaJwImURE/FVccObmfixzvbgExv0xJlz2QsQiTca+EuSboW1X3oeq0gSKxa0aRC13OwJR89JptokQrdJqMU= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by BY5PR10MB4148.namprd10.prod.outlook.com (2603:10b6:a03:211::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:20 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:19 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 7/9] mm/hugetlb: convert hugetlb_add_to_page_cache to take in a folio Date: Thu, 19 Jan 2023 13:14:44 -0800 Message-Id: <20230119211446.54165-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0027.namprd05.prod.outlook.com (2603:10b6:a03:33b::32) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|BY5PR10MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: 45c14585-b4ab-4e86-fe06-08dafa6244fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UXrgnV4XBQKY7vcaJu7VArq8oNHiY1kLHPKp3aNTYsUuP3daXmVNrVas3kQHOenYswfXRZemWHLQpRnC5RmRo1IYM4KhtG/e+o9aVvejs59nUcWhvaWYi30TrKZ9WMYUYMkhZi9dPjDy5o/WSzsQrkBRrWUPE0/9bqwrfSDWEK5tvxkeX5oCgRh+6Dp8WmEEZ3cYAQbq0C+354IuH00hmnxtCN9A1ei2IhwhU3bvteoS0n2OPjqEsmtiaDX9U8ij8Vv5NPzdIX0d7z2fQg0Pjy+PTC0yamoV6jUuKSuQqoSCk3WAqBVOxBuQWyREWuk0J1MA273Rl/dkzw0KAQKshQRQ18ajy3fX9B7ERkivUfVAt5szRF3L74Q0TOqkLoi+jNH/5E9P4qnr5ixBNMmML6HwFMyH//WLe+3AjaFcB9jbCUn6pe83wVLy4xB/T4MTOEkOsYMYpqXs8m77z8tQDHKA3svLWIaJBPQXvWnj+HZ9VByAXE3uDK8jmXk7V51Imo7PDCGwDzga1zKuiy0OA5F2t1eUGfaIUQNTLtpg99Opel0GiKZiQO2yic5EcpCnsAIiXryUdbygJ2yiuu0qDeSH+rIe2crL93DZI4j7iotAD87oHapW++oYp+3a08JfIyytuKReudDONfrRej5uJw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(366004)(376002)(136003)(346002)(396003)(451199015)(6506007)(5660300002)(86362001)(66946007)(66476007)(44832011)(2906002)(8936002)(66556008)(38100700002)(316002)(107886003)(36756003)(6666004)(478600001)(4326008)(6486002)(41300700001)(8676002)(186003)(6512007)(83380400001)(1076003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5lVvvUCyZ03KMSv32MLtYbA+KFkC0XLvSf7HMvLVCW2taqt9+27oZ2/ESufQtGkBNpOQE7UjzKo7zQkta5DLtlZQz9T9NFJsQ3s9UcI8oqreA2DPU3oZe9q74fD9MKRiwuDa/tjw8xIKC9IOLcdmtquH9yKS4NnI5Vwc2hmeZLWnW+qbGoEc6uOfEAeO6TeK6yFG//g9uvc7tt3Zk1OjfglsieJRStrWQSfRo9iBQ/l2eVcILU7LtdHWQSMvGFzAJUH1H2tT8Ii3cCZMK8zHDyn0vPDt6fsmAZRFmglTr9JRWDB8gciyzQ8kN6eiASlE55zrsXe+9wkfh3IutbSqMQRhOZPz1jbwbjK0HhlDqTquVJli3+ra2v5xD22D/S8TAn3muaM2aI+IiH5jlmowZWI6N6j3LPxQVXFKEuj90mQWpYWjknF4+qAxc8B60d3EnhZii5prKMHOEIsnbosoemjbId+RszU/DakWrUbY7QPrSd3GzVCU3WZEq1p6oyEsfiqdRT7HT0OAWmOXLRpufAbsVzFVYB0FyVhRF5wy1cwlyagLubLnGOa0M/ODXqr4nEznf0COsdaAuzjGoauxpNg/xVffwSFKoMj4sUGjav0m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op-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: xNh26DoQ38vYWrHyesRPzkqdi45yGMo7KA7/BYxByTgzPS4nzPi7IByteZjpUlHDB1+whNpovOGwATGCIJ7uVmvWt3eGIOtTUlwy2Rio1o2+vtAG3JS6/EkAxH6D4itOxBl02bQkbmZuaafcESUV5np6I4hXPODWK6ZafHHGe78xqTk0f+5N54Uk+E2s4cuqSQDJOC8QDVG9XCjiGB2s9464KMh7w2wM3UVRg5ntx1u/JCGBcjugsDyccEmEBQ1qaqI9vhTP/V5Hi5KbY8fAYxsFH+jkpjcMWgzYxtZr1tmKRY63pm9P0UiwQEIkUU8QqpqCYS553ZNgOoLJANw4crFq0oUn73bFVSJD0sDt8LBOmfunehiA7qiBCttiLtxC8e4g0NxPU6SkE2iMIV/UYCc6YIUAg2osj+a+vJhrxN5BydR6TaQIOP4w1kYqHrDdvvo29BEpqX4+BWfVf852YYp9O3gnV3z3QCDoKmu80oPYucq+sqOicipVYZ6BI408Wi5d26CCXgcNztdGyldd2W9kj+GVhLvjU/J+xbta4ADNJ5NoPc0K741kDmyA9DPaTn9W+IsFlf0x5uSNxXJGbrhMjMmvyg+ZBNQ4+gqyChxYliBMP1ev0QRvqPqZeUDIyX99GjUsXlEz8xbtx6Ho5y715dsXuVAuZ+AboTO8gyYpADpUBVo4fl0tWihHf2JpFvzacAYBEVC1tIXvaj/loaEzTp+wYnggQd5WoMvtxrY8OdrcQMu7B5sHLFg7BXD9vX+RyTnLLxBF7DuqeCpsfCtZEiCfbL+Dtkh+qLEjmseU5CwU3+s4GDomz2T9AL8kEgGz+5iGAnBW04eSev7Tja2pfd5MUsi8Zkp2WFLSLsLjIWY4gqPd0PSlMHgEtdeEmefQkTdMeY1YyVvr0JyYZ8rtj0HfQ0a9ZVrZjea7L7jt1JydTzlxWzABMF24FW4M X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 45c14585-b4ab-4e86-fe06-08dafa6244fa X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:19.8791 (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: 8t2SXeAGisKmM+7/ZbUJtd9lZGFqioPX8M8kiIKzXKKzmf9DdnwMuV+V/w6/hMM5YJyQCC4L2EcpAgU+JYmdOYq224XRnMFhy+DBWYR4Q3g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4148 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 spamscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: 2CG6b7mzfqCGAf3OkUnxrzOGJwckAUeC X-Proofpoint-GUID: 2CG6b7mzfqCGAf3OkUnxrzOGJwckAUeC 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?1755488143916506515?= X-GMAIL-MSGID: =?utf-8?q?1755488143916506515?= 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 880ebc58f330..76e146bdcba0 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -869,7 +869,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 e76be7e8df2c..2dcae9bb4495 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 9568d49c12d6..4ab3eda6db18 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5663,10 +5663,9 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, return folio != NULL; } -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; @@ -5678,7 +5677,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 @@ -5837,7 +5836,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, new_page = 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; page_in_pagecache = true; From patchwork Thu Jan 19 21:14:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp555022wrn; Thu, 19 Jan 2023 13:33:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXvXgJKaVIrDY6d6jwVZX+KeGoRFYnlZHk0QzqPZbWtEqvkzgd1CqCznbKtgCzBWJtd4ZN+1 X-Received: by 2002:a17:90a:db12:b0:223:7910:95f8 with SMTP id g18-20020a17090adb1200b00223791095f8mr12414780pjv.36.1674163984727; Thu, 19 Jan 2023 13:33:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163984; cv=pass; d=google.com; s=arc-20160816; b=RQtSb/k/1aGt19jA6Bs90q+uU6fCR3IaxXeOp4aoUijNDeRRsnDTnVnm9ZgbaYFgPg pYuulSBFugwA0yCJh5gJA+DYrJAjSXZ0x8a2GEeKgLEpQgCRLKSTKkY5N1ruIjFDQIqz mBuGQ0F2Ithk6hpbo772HeqnJNzbmmcqfONH1WQ2lkj8wVCS/h4FrzLfBCoVTYvUZhNG hzVOOGkmbnBWjQ+BT+7mAtim31kr5X/GDIGVcuJxWh5lnQY+CCEfI3Bg6RmvmT3dZvZ5 vgCDLtPHpbRBqShINmBqCVaaDIqa1ahI0muflGb8DhVZLffKXe3PSk+g6pru7zvHAsRC X10Q== 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=N+yn86ESbBpJl8IWFmBr7oglLMvx4RStv5pLlKp0ZEM=; b=sSqB+i9SzPvMS3L3pptkow4HqmjPFzznPdtXbYZm/9kbKd24bpDCjwTIdnV0pM+4qI WjXb/Msw7H3RLQ/LSNhRIiCgEAk4XS66YqRwvEd2dyFCFXYHLaoemK3J3aE7dJ0FYaG+ TnmGFoPfEQV4jOioNMagTdqh4/aJGBZRt40WmzEnp2PTYpLj3QZLeRcpFsH34Zg9Prac EIZyp/XpCjMrxxC4YsQU1DDav35jTGn7paSR9CAHXGL6n2YnFwgNuRq+wmcx1cuFBDk0 hqaheTkFll7XDPltMFjphvTjFN4J4D5Kgf8152vWuY1x0f7vJ9I5C6wtKlS/EiRuPZoX MOYA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=xZLVvhuv; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jnh9FoxN; 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 j7-20020a17090a734700b002299b3cd7acsi320969pjs.83.2023.01.19.13.32.48; Thu, 19 Jan 2023 13:33:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=xZLVvhuv; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=jnh9FoxN; 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 S230147AbjASVXu (ORCPT + 99 others); Thu, 19 Jan 2023 16:23:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229820AbjASVV7 (ORCPT ); Thu, 19 Jan 2023 16:21:59 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A9609FDF8 for ; Thu, 19 Jan 2023 13:15:42 -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 30JKwkre010055; Thu, 19 Jan 2023 21:15:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=N+yn86ESbBpJl8IWFmBr7oglLMvx4RStv5pLlKp0ZEM=; b=xZLVvhuvysCfuePvrw3nVMGtQyUcFRkEzBxdH6E8/TJOuOt1VVPn5wp2lce2E9/BPHY1 coVjbV/X0JhCr9htvQW52Aihdt6FjjQYICxi1LI2Og24fMyM76faibbIr+HThnzsHaBE SVe7FRDCLLWQKzMuFq/7s2eg2UTeSy2IUP+zs4RS++3ymq1Nr+JS0sc91jgXHMAPPI3m GPTYAvn4eC6lyMru3uv9gwGLVPyuNBuYrRUvJuL9gWEvxSJgLxjtgygxVF/iA2Mo4EZ5 TCk8mVV9NSvAFiGha6P5eyTubZuGH7shivNRXkW0cM9690Fgi/pioTT31626CuYnbIpB DA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n3medkdw0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:26 +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 30JLEQkL013443; Thu, 19 Jan 2023 21:15:25 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1nam02lp2045.outbound.protection.outlook.com [104.47.57.45]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6qme9njw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=exHkHQOIWQ0dqw8IYbZWrnuaH7fDww3AjSyE1yw/z7hyRZLp7+2VCvW5trJlcEfq/Y4fBhWBtbhAgVFALZPd+dCUmL4GxuKG3CJkh7v7QikALwIucBu5imocm7i8zQjiMtGHgc2ogKeqHKBzhF8KXsGZljQjV/5wLVso2WieYWpgRARTexX3G9jqHVhuuG+l9fisjTXXi0VHBpzHHM6Rhj6SqxC6inH4D+7vIump1DORMxzhV4UC6dL7PEtBcAFKDVAlaUew6E+aBGBQtMaPAdaO7ixTamFIZYF14hi/xYML7aTPUdgqBL4XgVnp75MnlJnE4OxmVjXjNjJhVBDjhQ== 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=N+yn86ESbBpJl8IWFmBr7oglLMvx4RStv5pLlKp0ZEM=; b=Eog71K7bZBB5H8VWNwjxmrqnHji0HH44ppcD8BUkO5cFdAQEaETxHUMH9F0YvGcEJrRmmgNrul+/LjiS8hN89XrKbRYvPOvEmFYSd77hB06JcJ+uIoUGPmq0+xkVAN3PNdsDoJpyFitXTB4GQboas4KQqTdat8GLPz3yOtnbWFO8x2/AYkCKo++eDml8muBh/h1F6iypf7nYRSKjtPtj1IxOVmy2Gjzo5avIXpK6ZTZBzy3GvEgnxvoZYYPDaVkclUum+uxq75UTYjuMJrHe8ffWM+um4X7X9EW79nlwbCCr/rTAAfAoleXha5OTN/rTjKzF9bScMaFm2jW+MUhtqg== 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=N+yn86ESbBpJl8IWFmBr7oglLMvx4RStv5pLlKp0ZEM=; b=jnh9FoxNITU9cGwKPzckjSdvYFMaW+EQL2Hkb56M7uIlU5HJeI59/E19Q4zOaRndAj/ZzO3TXBCk4purseLcDeIfIsCJ5egckH3Uro1Qf0udYOi1mzlz23EjnV2/Hm6dTY+8ween9fyOkSUH7H+tOzyQlcd7eTHU6g2K6ZTC1dw= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by BY5PR10MB4148.namprd10.prod.outlook.com (2603:10b6:a03:211::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:23 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:23 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 8/9] mm/hugetlb: convert hugetlb_wp() to take in a folio Date: Thu, 19 Jan 2023 13:14:45 -0800 Message-Id: <20230119211446.54165-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0011.namprd05.prod.outlook.com (2603:10b6:a03:33b::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_|BY5PR10MB4148:EE_ X-MS-Office365-Filtering-Correlation-Id: 913cc73c-1485-4e11-d31e-08dafa6246fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zVmMkJXFS1s2aZ2tefNuwmks4I5ZCiWA2CkghMlp/jYMkaqwDSUCMHHsnN0Z0XaIn2z8WGvtevVkMEKtX0FjE+yFcDDMSddomZdB3p0ogHe8eLuov75S+XpZOWr6GHhnopZhoRidVkWHSlymBEFB5qFkkuVt10D3tED9bKgHHwyhtB7k4KthLyi1TIhIirdlWOWLYsLJPvc+mVlZTbwVTVUvp8rxkB3zlmdw5iaWnLgP3UJQWFjTs5D+RClmzkvGESDeWEV8mQ9ugqQrNTvn2LAC4ObxIedzR72Ia5aWKkZ9c0JyOEw12FiKGm/HH+ErPDYVLjDxolDf7N0Vhtw1BAmCIbUj4V8dqN7PUzCMXhcKge2p4j7vloSvzgBEkjm03HOZ5omhdt952btLRdTjeGrLzDw+ymhU8Igtb09TEdqeL3zLzbpTufZbQBD+juQxtjkYrlC4aVjPN50pAUbeKbYa+MpesH9pjYYYuIyqQOT8sWjffghtjVURukI1x65Qynhq88pxhA+xPK7l0oOK9+/31ucb28gJRBLdYq84QYlRebhuM7eIiEi8KgRA+7jZc3Vz7HCSpkuPg7csDK7DdF3sACXP3CxLUDI3IwGkDjg5k6zbWhSZ6uLu+D/ltn+aoZQkTnAQSycpJ5+nHr1xXg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(366004)(376002)(136003)(346002)(396003)(451199015)(6506007)(66899015)(5660300002)(86362001)(66946007)(66476007)(44832011)(2906002)(8936002)(66556008)(38100700002)(316002)(107886003)(36756003)(6666004)(478600001)(4326008)(6486002)(41300700001)(8676002)(186003)(6512007)(83380400001)(1076003)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: m1pBqf6B8SMfFm0UNvtkuo81SiUbVhSsCnu85RCz6JCU/JXAT3lNeKEhmEby97wbCXISV6rEOqzP/4Ho7hXxS+s263ztjBvrfMV41vwOxtKm4EqFTmUGEzls2yPhVqZ+PeluimzXUQvLdmEpO6242m8YGXXMtGkrhIy2OQtW7qtqqbeM77q0mpMWTdx0I9TgRGK28ddvpQ12EQVnIyHPr9kYYn5Ea0VGMXiDwTUfnLy2UcCREDNETUg2c1WpOg3HstWGaPJdx+jxKctrGMHTKixaqyNzot5wsVoqcYkkzYytDFZTaDAMbH1G1inzfCTPi05TkxVbIHQmgT3siNlM5oqMivHWF153BVE3niSU0GWXXocm6YLw9NdTZgTfAckUOvJJfrxWhyCi6GR9R/K7ZbFJsXHd29Xfp0Y2uBy1sQ8z5Z4AAe8JkJDIidfUUYw3eesLPSIaYjmSQUOsrNSydz7tOPeVs8x+jIYR4ETprgCQXg+VrQjtGTrn+ErqKu7O5pJPb/+PMd4pD0itMbaHGJUoZ/w1R7+/AGV9OKZJ/PJuTwhcG+H7DauQrLuYQT1LKfVz0E2oK3vKMpZKLiQYO2vjKQt5yINvkECMN0+HHTiHPdJYh159X6q7fchFnAQjsUUIBGgqHfzy/wz5WHJt+M4IAsIZ9sjgcL0IX1pRaju9AWkVI40FVrRFLcSOSxDyWGdpVGzbHl/j081m1j3ieTbJUR8eqs01fDAJMWy6GARPWXRFgJFmmKLIlGQLtrXX5GXG3HtHffoHDLKh9iLpoD5y5GvIJujzsplgDsz0PlkzO34vk7Vd+HLDSoCU2FJjaEdQxcXkDXUf9QglndHfPdDUnf8skjEj5ah6k5jqP783czqVeDli4cK/C6mJSyr7waKUvGV8a5y1ooWkvwJcOCanN9Aika177g9Mc0o2G7G3QuFZRKbNvLD6x6zQkMxPuNuZzGzqhD/T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GTNarDkQ2woyJMhMhsnGxkSw2Tqf3TwEP6knvf6xSynwTct0OHHhhrUxXb3VChJCwk4fl8xTZItAhQ/zklLP9q+KuXoxbarhzfENcUD3hR1UpTYhQqgLG+/f7V556ydDsHlYTZ8AcZdc02+9riaV5F4oVLcF2zT8+Q2+RC408hAMgQ2nNqJFgfMx1diDycP2Je2MpPOebLF7EgDOcz7/0H8EmY/lW8kYkGT01UblBl1ivDDFtljNgJ01VxByMm1MVW85Q8REiowir0yvZEtpP7gA3iHxw7AxvFObVgxVPg/LFfAXlcRBr80pZ4GpLcA78tegIPGbKBVxzMbE8cTnC85FAfxitFPA/lkCvPBPGnlOp14oANCtsRIm/6UYxoBhN7u676rmcrduqr/bZMbEQ4acWZ44Y9vqQVPJ64ruO1r9QGQBfpTCt4lnnTvtrwhYsDEYeVbyLN+FLeGL/q/ljcqdT2Mbmn/Ejsgox7OvKrD52NQoPnzm8boSxkVQehLvroGnwS0DF64WkPcRxQlvP19pyTlQcCBAH86AySPaCoFn/hp+vSrC1x7XnJ9451oeG87V0uquALkXTHPCiQpTIWfwwXg1EDplgmBlbKBsCzPaPzEvoj13gYo99XpyB4G99KWuMLsc/ZdQQ7qR3ShHG+v8GwvRC/bt X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 913cc73c-1485-4e11-d31e-08dafa6246fb X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:23.3025 (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: RLzOi28GAyrYTvKS83yrpTiva+q9SMI+mlFCriPDHOJbNTWREg1Tkt6IQzDAIwgcYQt7Dta+LjNRyXQqImvJus3xwJtipyUQa9EmrvFfdD4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR10MB4148 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 mlxscore=0 mlxlogscore=999 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: t8iyFIkF5VwWwoQvov5nVgHRYOHmEaa3 X-Proofpoint-GUID: t8iyFIkF5VwWwoQvov5nVgHRYOHmEaa3 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?1755488174517200289?= X-GMAIL-MSGID: =?utf-8?q?1755488174517200289?= 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 --- mm/hugetlb.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4ab3eda6db18..20127271b64c 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); @@ -5923,7 +5923,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); @@ -5986,7 +5986,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; @@ -6068,7 +6068,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); @@ -6088,9 +6088,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]); @@ -6099,22 +6099,22 @@ 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; } - get_page(page); + folio_get(pagecache_folio); 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); @@ -6125,15 +6125,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 Thu Jan 19 21:14:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 45971 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp554712wrn; Thu, 19 Jan 2023 13:32:19 -0800 (PST) X-Google-Smtp-Source: AMrXdXu1lyAWM60FhJkF22CYoyMLYXAuuuvTcnsgrs9PnR3ydrqoyg2WYNLEzO7NxjzV+HpjYEiq X-Received: by 2002:a05:6a21:7891:b0:ad:79bb:7869 with SMTP id bf17-20020a056a21789100b000ad79bb7869mr17783604pzc.56.1674163938889; Thu, 19 Jan 2023 13:32:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674163938; cv=pass; d=google.com; s=arc-20160816; b=p/WyfTs6kJ6grTPbbKMy1QqygToor3aA1eEQAWYmbSJbKFPQ5t4N95g6e597Ae2eEV XECwRrnNPoRVjwMpYX7bf5rMAPPnZj3EiPubt+W9UeZSOPWNryfk3/FHxl9qqmz02hZM yw1tQX0FbaySoEGq2qZ4uM1SO0OXC5eyPBP6rNk6hbeH30sFWNVbbjmjbhdS3CjRbE1Q HgIltRbxfQj80t1cITZtGU2xSFoKHQZQfbtr1kI8q8Flrd/EhijlGPuZDwIj1tEimsnJ L/fjQ6JJulCAunRaEIaTlnfBux/YLsi9ciNMXnN9xmCsMpuXlKmEsBlflwD1MXJ5epWb wHeg== 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=8YPmBgiWXHv6nshpCJp4+H8Ty8HRSgwtJRlGF4JM4EY=; b=d3ZEywhzu222JXrvdGui9cuo7q+MUeOp2vdwn3B3D8QwAU+nYcGZAxQvw6/XD8RkyS L6bIQtfuJDN/q9i//YpgkS+4nVqD8U8WSNg8LUQB49KVaIez58UMKASn+sk37AlIDxZK I9NzV2OCKxOEoRXmWdLpeS+M27n9e4UDRidj86RM5sjZvIE/ricmT67Xd3HQTn+XU7zz y5+L5FuGCuBOIw6IbbxbxbFr0+Zazo35NMK+9jZdBlhZft6ABemcqjniVoKCMO6rPqgm ESm7O2cnidmx0eKGik1LgZvGWfjafMSpGQxB2nktE4wHDjxAXBMk6V0c71OeNrQrSHKW pN+w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2022-7-12 header.b=khvChgNx; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZysFuDSz; 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 w8-20020a63f508000000b004a2d9640cd1si44855888pgh.168.2023.01.19.13.32.05; Thu, 19 Jan 2023 13:32:18 -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=khvChgNx; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZysFuDSz; 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 S229895AbjASVYE (ORCPT + 99 others); Thu, 19 Jan 2023 16:24:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229461AbjASVWA (ORCPT ); Thu, 19 Jan 2023 16:22:00 -0500 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EADCA1014 for ; Thu, 19 Jan 2023 13:15:46 -0800 (PST) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30JKwx6L008067; Thu, 19 Jan 2023 21:15:29 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=8YPmBgiWXHv6nshpCJp4+H8Ty8HRSgwtJRlGF4JM4EY=; b=khvChgNxrgMXeqe22fvI+I+KrESMTEsHyArPzt1Kddn7SmTTwGVqDB5Mv0FKFK3tfG3k IHiuFYNVg7dHidiP71s68gRfbNMKw6+MyQn4eHlA8Nk7sifl4Pj+IFt1LBgQs/upksdk XUojjGnsKbEy8ZQDT+oL9+WDPRc+O8UAk3gJ6z/0WgapyPPQE0YG9U/gx8Ou6FWviarR 9z/Y92g6z2DO/KsC01bfJ017LFz91wraINrgRbvg6FLS416xSq1EA+tHguUAicEWjNMn HHeGPfWJKNy5GyQxbr5UdnHGwH8s9kKBKZWhf43HBbwbhx+geOTBGhDDYX0fEayiyz3h IA== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n78958xa6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:29 +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 30JJb3dh004704; Thu, 19 Jan 2023 21:15:29 GMT Received: from nam04-bn8-obe.outbound.protection.outlook.com (mail-bn8nam04lp2043.outbound.protection.outlook.com [104.47.74.43]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n6r2v088m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Jan 2023 21:15:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GzRHy9A/itwLFxpVgKayhawUN2lP19y5iJGP8Rl1EcsrZN8cp0JARYNdCgn8VHgjKs0V3MT6hyoAjdY1hiuJktG7qhUL7N0mbKwc1btHz9mGeq8vgqXvF0neCAPue0p8qzDtHMtBLZEzV//fCRW/qH3kU75vEicxvmzu88bqkEOOuEo4+NnA2FCi7BlhYaUoYCP8yEob2BJefwqV2Vd5ZG3pd2vf/kM72/oLFBL1/dKxs96IDwNlUo3BGGL6BLN5xBPkr3XwBSo7TuZ4PB2sY5ymkvz+pYS7Cv3S/j1YErR2n3IREiOBwpmZ2UhigHffOkRnEHy5vzQDc7kItQ6oCA== 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=8YPmBgiWXHv6nshpCJp4+H8Ty8HRSgwtJRlGF4JM4EY=; b=VkBAuyQ5d6+IVbNRwtfQSLUJsYbkBzpshsidGYWquvIPfSVGCsbGQ55MH3DvGWvZjHJZPNyKR6WfOCIw4GC6nbzxkx94BWzYIh4RKe9s1oHl/6a13pO38VWULM/T8fbjVEnI61OKWMopmrEkk4K0PL2PtDVqMbB4N8eUSNXE3fPHF3IBwK6fcZpo72+lj+V7mrJjf9PfJp0LwXlCc7hF9uwCOW++bPWVxvxOqGY83OrpTQ85PrStGiZWUCHZ2jYXMgCUCzNtIP4/qc9Xhvo7xiCpDXEMNcUh8J7aLbpPDwUZiXRm36DH+cV6TOWkeT9tVTsCTM37wZtqqvhUGjDV1w== 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=8YPmBgiWXHv6nshpCJp4+H8Ty8HRSgwtJRlGF4JM4EY=; b=ZysFuDSzfhJulQkRCWN5mqttdXCP0X+Lcygc47Cup4kYLmpnqkgh/KeJOrWjqhSNM63pd+8M8ixmazzWf04QgDmTvGwGS0nzd5YyJDayPExY4k4RHyTJchz8sxi8n5nMrLY3mZKePp8+hGZMwPXqaYzb+lfdCE+ulZqhzOkHxdo= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by SJ0PR10MB5600.namprd10.prod.outlook.com (2603:10b6:a03:3dc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.24; Thu, 19 Jan 2023 21:15:26 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6002.011; Thu, 19 Jan 2023 21:15:26 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, Sidhartha Kumar Subject: [PATCH 9/9] Documentation/mm: update hugetlbfs documentation to mention alloc_hugetlb_folio Date: Thu, 19 Jan 2023 13:14:46 -0800 Message-Id: <20230119211446.54165-10-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230119211446.54165-1-sidhartha.kumar@oracle.com> References: <20230119211446.54165-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0158.namprd05.prod.outlook.com (2603:10b6:a03:339::13) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|SJ0PR10MB5600:EE_ X-MS-Office365-Filtering-Correlation-Id: fafc298b-5b38-427d-4351-08dafa6248fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ONeavsU7A7ykjoRuUpzt7m35SIiIJVwpufzluAsch8q6Nnh420heKnL5ZhBNkckfbDprN7xabLKCMRg1anPm9Ri+qadC4vfs4ghqRWaMSfJ0Ehw1AOm5i5dXy2wuER4DpIIhzyNpGfec3swS4lMrrRiddu5mvsNS0OZctur67zU5Oa2rVxZvVYvUm59G5YRJHXZgcfs5LFjbro+FsWd0+JmtzpSAFoVawgDE4nokE9cnXd7q9B60NilDj5cdcTp8ZSJCshsK1qVaZwVu3mWiQ10TV7bDZpphhMjRzbgLtSQJmpyeCxmvWpo2UkxTjKPUcDEj6JkJrg1GmveRZR60o3zrlBQEGpf3kes2OnSxXrUKJC1KfNAElf0b7iaTRVMJOLBTdLh04/SgK4w1eFOBfoTxN5PLPuFA6OZIjJT+/hjPD8FNrobi0v//cYZ8fh4kihwVdWAEAqrq27f0t8R2hZdFXHZsonvPQGQiU5JJ2GUmCx/ONtgbmc17ZnPufVUdAgZ5lE9Scpt5NN2qiqFhbjWmoAjACt7ADnSrcT1N5wH5Xo+i6fHeyxf9f/PyqI94XEujWCHc+03Joe8jGK1EyizELSmglbrR+pJAZhsPWxDSyrcX6b0EzqYLOZTstj3Qsz8+50TKeG18Q2JTfsfbWw== 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:(13230022)(366004)(346002)(396003)(136003)(39860400002)(376002)(451199015)(66946007)(38100700002)(66556008)(66476007)(478600001)(8936002)(44832011)(15650500001)(2906002)(5660300002)(4326008)(8676002)(1076003)(41300700001)(2616005)(6512007)(83380400001)(186003)(107886003)(316002)(6666004)(86362001)(66574015)(36756003)(6506007)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zr2rkX/IeYmgyYwPidSjZMeCUyjE?= =?utf-8?q?X0MPwsvX07pfEnpd/BgRHbbvZpKExBSpbf1zywsncqGeqXKvJ9xiCBOOuTaqjN8a3?= =?utf-8?q?k+Fp37iCuOe9qEiTv8xVnYCDgpAL30s2slQRhv9o58csVIAWylw+Z03mVtGKx4VU0?= =?utf-8?q?+ZDslkN/Mk4MQHcGvM2L0PqwSFcH/v43+HNBQdb73WY09y2uHcBx1IJgBbDNNb55S?= =?utf-8?q?OKnCE/G7aoNMS1rIM0gNIEM0QuR8vmaH4UiVx2aKDul49NQyd52Fw+cv+rA+gYbID?= =?utf-8?q?rMg/qojZBce2gVShR9QpsRYXcHZiXC2O1/w9R1jqTTj1+NTBCD944LnNnQFw1GKIJ?= =?utf-8?q?vK7FDnp8Dx9yrkafRhfwBdien/bybIv70fbEvsXbS5diH66PBWivi+PKtHbOQsaN1?= =?utf-8?q?De3gt7Hmfk9zX3HmkNl1BicjmCSMkQcR82m0vxYM3MajaGclUGdIyXELIQ3oMT/6g?= =?utf-8?q?U3opqXYvcUG0TwzVArXTgggqqzOVKQiHRTRoFiRLAKISsP3nd7rGbjTIe04mxMloz?= =?utf-8?q?/fC987TOT3jXsdbULwilMKtJfRT6II6j9m4T75SkD0b4RtjU745gp0Ve9uLXRc0cL?= =?utf-8?q?uqYivTjvedLQiffBpJ80HiCvu/ZCpJ5mqH0eE3EiLy52sCQLJMkfU1siSzCNvE/IO?= =?utf-8?q?FoMEtj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vLuDIkHZKr7Htz8rVL+DAOOnGz8O9MpkX6ztZFBrbR2Hl?= =?utf-8?q?ONP5kotqVIBEx5lYkmocmf81aGz0JnBxQ=3D=3D?= X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: =?utf-8?q?gunhsmeK+rGoO62I?= =?utf-8?q?gxJs4jHzGjBDriOS9t07XH0OYppWt7H10usiVSv7CABUSHSw91TlkkgzQaVRQqXb8?= =?utf-8?q?osg7OMpv+ssyF2qwcrqjM/nljs7mIyQGYYsR1wvagSr75ySSgoEI9pNjc/d7d4mZD?= =?utf-8?q?ERIcu9hFvbHWDgTxva27J4T13vU//RDe8Azkran9JtZuUsklFF7LyBztT58LpcWC4?= =?utf-8?q?FND/tmLIun+8lPFvxnsZYfLukGXdhyHAG3kIscNomXRgMLxBVy3NIIt1VjUWGiz2M?= =?utf-8?q?RlXXxzFnVW8VobjMShALLi1c7IL7M+/eAuYeLmZC0yACqPToA5ImwvCZeTdm8Jfm/?= =?utf-8?q?yY7Zh3O9K45TshfmoY2XmLSkEZ/uKhZCt1E+ahNAlvUdb53s+k++quc8B13oWJZ07?= =?utf-8?q?K7WtB0AR54/XgN7PsM7hcm+vbld0TzSrHKZez1J+jqYVYFnlEJnzaV/lms8zcjjEI?= =?utf-8?q?tKeAW/gjeqdlR9P753dfnlS/p+hjTOvbKOFcwBWGZ0ItTxeXs40VpdA1HiZ+l/dqM?= =?utf-8?q?onv70TtLcx+SrvrGJe3gsKTIn/mUhwyCw+Ike3fKo/PHiFsCfHRLdW5lm8yMUAq6b?= =?utf-8?q?Xpjm9+BsJ6P7vLs3ONs7mKZUAkhyKpngkKtnhKyS5/2fKMVNacUaCscN1r64i2Xyp?= =?utf-8?q?Nkwmie+UHr7jzgkEgVI2lxcRFH7ZE3ebTLNlMpSyu1qfPUVf30b0C/4Nv46PyrIUh?= =?utf-8?q?lzgUUi+lgx6EW8/t64QsO89aYtNweZnVEYH+tqVJvXMgNQosfhaotMYrdjxIOsexw?= =?utf-8?q?uRpuKbs5+fUZBN/mnudq00Z1KNvpVr8UAgb6p6HWKxzzAPkIqVHdIHiyD8913tSTQ?= =?utf-8?q?6lcQddC7mBL2RA5rTURqSQMnyj5wBEdVC66eDSgwR1GH07Pi+o3ToD2EZt9W9Gcc5?= =?utf-8?q?rVo2qA6yR2YO8ie56PnXd4jrt+ESKwuKcD?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fafc298b-5b38-427d-4351-08dafa6248fc X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2023 21:15:26.7076 (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: vngtJTHiHIr8VwNwNobihGHe+9MapskawYYSiWD7gt4bduK1Jn0a+V1nFU032BxN9/TutaVMh6Aiwi/5EpB4do5cB5dQpMwe6md5KMM/ez4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB5600 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-19_14,2023-01-19_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 phishscore=0 suspectscore=0 spamscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301190178 X-Proofpoint-ORIG-GUID: mk9yI2SgoqrUBZG-z_Taoy5eg0hBg_ug X-Proofpoint-GUID: mk9yI2SgoqrUBZG-z_Taoy5eg0hBg_ug 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?1755488126423592362?= X-GMAIL-MSGID: =?utf-8?q?1755488126423592362?= alloc_huge_page() has been renamed to alloc_hugetlb_folio() so update the documentation which mentions alloc_huge_page(). Subpool information has been moved from page->private to having a dedicated field in struct folio, reflect this in the documentation. 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的返回值来