From patchwork Wed Jan 25 17:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115868 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56571C27C76 for ; Wed, 25 Jan 2023 17:06:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEF4F6B0071; Wed, 25 Jan 2023 12:06:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EA1016B0078; Wed, 25 Jan 2023 12:06:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C31DC6B007D; Wed, 25 Jan 2023 12:06:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A65F66B0071 for ; Wed, 25 Jan 2023 12:06:09 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7918840D7F for ; Wed, 25 Jan 2023 17:06:09 +0000 (UTC) X-FDA: 80393949258.04.39727D0 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id 1F804140026 for ; Wed, 25 Jan 2023 17:06:05 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=weBAscDq; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pdR7EP4Z; spf=pass (imf23.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666366; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=7j7oYsOMcVS1GkJ/030P9Sr5vty2N23ijnTmkY6aTVQ2JU7TZa7JN6NAZxD2IO559ERcS7 1m1AZKDE9GnIMnboCSNq87SSKin64Hyc059BIIjxM2+ltdwby5DNKuQbQEA4tHcfUtzqRC vMlXPk4pyDslJMp3Arf/uio5mC04pWw= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=weBAscDq; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pdR7EP4Z; spf=pass (imf23.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666366; a=rsa-sha256; cv=pass; b=ZFHMGiwcAbvkUO9mpA01FhPHE8BczacnDmZDpYou2D0m8+6mDyGtvRgfFcMq0vleB+Jw/L dRlk2RP60gJ9+to7jOwXQYd75ryB/u8zzE/gIiRcMe26K10qg16L8FBS/Ehmx8jw40yXBO 8Hii+UwnvYb5hmlpbbr2gWqi/UJye54= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNkq3030139; Wed, 25 Jan 2023 17:05:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=weBAscDqaZV/8NAMqJMNfZOp5wFLCjfImg8Dkcv7A64J1PUt1qQj2ITGpdaCJFyUS+PR aTNX/PfVx8/AbJrH56mIXvH6BqU6qTOrwLVHK6zpQAoiuflQbtIKDHnIfhjVHwycc23g ffXYldvMh2cMu4MyuCAlFaNFdmu4zfdkuWnjk3H/BW/jwNu0AqaGu21iZAWYvGO9aCkB nWaaGsxDyyqxYKkqzhDE8kmxRWNPHQ+c+MaD4wMEb5Zh1Lj0IiE2Zw76ocDpVNXhQ9ZP 9BWKwks2Q0Ry8fnLoKLaaGf/l5Y3KTMf9AqMw07hpcxpAXp4dgdWdhXyWh65jcSJWkmW lw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u30hmt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:51 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGC4Ur025091; Wed, 25 Jan 2023 17:05:51 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gdnbf8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fiRTkGqsWH51E5mo04DLC+Vj/7zYmwcQBme1+OeGjBU5C6QN2o0jx4kkH/zUu3thJqozKPrQFlt18uND5D88YflAPwOZW/1wGA/FpQEkRp60JcW3xA+gxOzJfqlms6fRERrxj+dgMzYaon/haqZ7C4EmChZR2ZPM8GGiXxQJIVBnEhWEcs5TU6lJLqDTlINUNTQZ2ECtkK0ONsLWt+5o/pyY2vofs6/nKm7gCumzzuhK60kYLcKdTBQi74bNJ4KHAjQvX9T3UHuit4/VQe7uaDLk2N4+CcoDIoecW4DA6um86SPYgAL0DAb7xfINRA26IwZm531SN1PxSxb/fm3tuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=iOnpOwVAMU2/R27Al7uTUaTjngv21mC8KTP5mnwXhutu0OpKn5gZOJRyayp9IrqiRcIjfSsPVXltyqphUo47fG6LgxVV+VcZVZ5M2lyKN2SJqe2Met2XhE9xUYnOZvjQFHJUksaDuC/uCYDxxZQGJHUvoqr772wKt2EqY5U0DklxNy/jv0dR2NjEv5qID/JrIKNRX0hqgnwrc9tM0nEpNfw00GbCeiwKZBqiwDFMl7Kj1KmEdqGowdf7fLgxNmNV2E6pbnUB9J5EMh4p9U/StzLWHSM/bYfx8gxLIf/7NPnwr37SMptH2jNHsVHPAcyy6vrp0h/r2boNlp4tAwkKmA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GihOQ5fsCQtG6jJxaROz1R0G4aMEaawfbkY9vobb0oc=; b=pdR7EP4Z21NkbT+Nwx6V9q4hJFgneZBjGe3RNQ8FY0vpfZdZAHgD2/Bcl7W3LtdjAzD7J2Iyzo+eGPjp0Pbw7q6QARFCry+/slJctg0L9rTouH0B69/FcTE1ivxuyvZYkOGzegPvI53wNTBYQEvBn8fUoQCsV0BGWn8BTraBr8Q= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:49 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:49 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 1/8] mm/hugetlb: convert hugetlb_install_page to folios Date: Wed, 25 Jan 2023 09:05:30 -0800 Message-Id: <20230125170537.96973-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0007.namprd05.prod.outlook.com (2603:10b6:a03:254::12) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 612d9d1e-082b-47b2-160f-08dafef66831 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tVYIDJKxjxX1ITFVMbfPZh0tHM/gIPi/lSsQjnZv0N9QK+7SoPly57I4GlBNdf4yuYBM+Si6l33yv1UqdBQRaSLVvq7zuAgwsrN1mAAW/MAF9vFwc2ifEB7fTflmBHq+H8ZeGCBxRPPwkw974Q1R/gfKq89GCiuXKdiVlomQW0VHG1nHyYAP7TCccMHeAK4Nx/6ONG7MYYZ407/X0CHBEe1rd4MbMGecB6bSqrB8pB1q2Xih0Co5tbEaMmUruvPMRA8BC+dV4UEGdAA6hfObSBiUP9UfZA5N4r2UW74DN13gTWl6cSkims+APqK0p0wFz81YXqDFxTxfZJb45lbkSRhdN9wKq06bmAzd8Gu0I9M66XtRCJQGiY0Pr2FT+UiT/G+kse0C6SOS1ddRF974e0U/qLoeEoRek9diCk4/SWUC27QsQ+QmrQJxwtPrLCf59DUK90ES/m8XpNOjJxIu7HVAbmMnX2OOmZ9jzOtdzfaMyxEarBFCFQkYYGMRcrvezwdORmS9CIMhrtbqiD1EXrIelTc5p0cxVrL7yV9U5nTDOSDDpBa2dVHLBlcLBjn/sJJ3UMVQuYa1eR3gV+DLKT/Od1a8MVvE2f28PIvhAB9NdOE4ib4FfG9Y2eKIUIQuS9P2s/eqYvpR2C4Ka96gCA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zdYH2L9NW2lIHJSHRXOEz4gUWJ02FiE4oEtOent2Nb0F7blbmTpeZ5wMP8P4bvNulgS55AhZhWUTDcSMlZGQRiqXyzR/R/YqgJ47gw4RwkeQbc69JOFjMCnD5QSKu34NdEb8gMo+bNcGDReMM8QpEHSRx5dJ4f+ksk1Kn4ApV7I3EDlcYiX39lWOW0oYSMtP6+J7sap1rXZaCUjD88c7Rgum9h1hGd+X9tXQy54Ew8+XGOc7nx8eRNTEaFoig2VVkMy1sjRZiPZ4KHTq3RRn/iUPazeFgWU8nL7qkM2jZE/LfZgAWiBqsLGgHyNVGej2ZmCUEuCz/jWdZ4qOzhzAr9oppmtlwg7ZaoMc/51MdZbivW8CDDnR2vYItq30tH5Lr+uAyqilc8mwF0p8vwHb2yyKAnFqE3urJf9o2McbsUVHAZcO9gwpk4FTlBlidUZSmljSZgCTTUXUQiPCuOghh3tZmJwcX71vA99FrX3LYF7g/AEw+gybE9km6bjZXLqjte+0fER45Qx5k6+vHYqf7/cLaejUD/l9yIsl0TZ3Ih6fZl4z8/u4OqMYgn3G/h7nFLv24S5f718oTlAFFsQCROIrX2L76SESvv4oR7B3hypemX1Fc5YHt1wd/RXJw1aHFaaWIhWRhmxzeaoR8Ja6dUgSMyscP63QnXbasorM1nP4RnqfkF7Z34uc21XJiDrzC8cDquD6Gaj/M5KqVjQ41AQt4qv/Yf0eQSjGu+3V59SI+6WIIQYG5yoRhU9o4whEy3vCImwZ6Lln/SiQ/Mgnqevpp0S/V2DqQwMAwjBFS8FuJJ5wdB+FakYfkRGGbMxLi8cgJnb7j1sIXTKv2mYjyLpISgHk4JyS/a2TTCg/NZ33RHR+IfsKpMagS3t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uwNIOcbwdACJybvPpSqG6KVMVGTJhB4LLqS+2IsgtXRqp5mXP2/mBLiHOz+DrHxBqCINcT93l+Ejc6KpztYXFV8+mOCPGBscac3uQ0zqHvm9q19p3qESUBRJPniDV8zXTzed/iKllBbApRhuoWHONy1yC/vQmNZUPXdM/ZsN8w7sc9+jzOvpWrXeP7wzLBK+kmUXeTCrKWJC7Is4fZyLM8nVEw9IG0gW00Ce236hOh/41x5YPabu5x6P4diayY5/XMTdrpcEGjHPtcsQH/s3GOBidKnnPa74RmdbxdJv6W5Y/+TixKa+Ycy6DLvEXV5+VkRFFwpIXOsodBh0g3QHwryUDxuUaED5obMcp6qkk9gYQb/zbxgZQXldS+xsTQLSeSguKy7tcvdqNJVP0JpguAlfJ8d8ZVgXbjZMcx2p3t0sCbxrWHGoapwUjAZCk9vDRZI6Ln1ex9RlApRlWoTrIabK9l2/GNBwFsIs25MSwNqw5bp9fjQgoM9rZJKpLkNsWJH9p5XwaFrXjh4Rh6GIoKA5W1nwmZSXUwaUG34jDT91XezxXoTF+/SkqwKRsd712gt+wbYNRlHrHNyyFYYACs34sFW8yWtck7zL9VimAijjwdAchJ1nNu8OAjrD96R4i4jE46lDBvFn2XjNVywYhowL214CVOk8BdvB80fclqVtt5KJwjuhxcX4ZkB/gnJ+PFT2fx4uR5RhgPmrwyQsUOPQDsSWtSFfI= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 612d9d1e-082b-47b2-160f-08dafef66831 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:49.1522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: pK9CZ+aXwKBidi7Tto+6eXjw9PldWKZTvLOI9WxmGcY5U6JmNpIcm5YxvscjczIz7yhjUiOVMNgFtvan8p130CzU+EGGu3K2dbjIMVv2vv4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: IcBZ1j0OaSwGt-kMqukEJkwn7--uYOsb X-Proofpoint-ORIG-GUID: IcBZ1j0OaSwGt-kMqukEJkwn7--uYOsb X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1F804140026 X-Stat-Signature: 69j7i51gnhozshbbyw6showi6fm9g5u9 X-HE-Tag: 1674666365-527728 X-HE-Meta: U2FsdGVkX19+656iVhGOfMYpWrjPkEwKOpAgCpP6f9VRPXgZ69dO1xyDX888JFmp2uzklPla5f9ZBj+vMayR4jaoBC/ACQNk48PS2IWGXlCicKq88FNO/uiGh8iCNDT9yPr95rdboLxLPzJh4pWnrVPMPw5W/P5owuzpSwsKKy/XGTcmSLDkeC3A5Mbho1PQqWFqxYTytzqU/bJOb3VISdkN6o0Jr+V+CiSEnwbtyJW26J7LaD9SKQ4cjEjhskFg5NlSMKcSDYAofxJK3C7do8Ces0Ujpebahh9F2m2q2Vbydz8QnqH2Uqhq3XXIitZ7Pxh+kK/5QR7hNIGYbUw1EkH0SSp5pNOhpP+TT0GQdri1rTp/SST51CgecrEP4diVim2GnkG/Q8SHB1zm0Gi9tHTLNO/deYBLKGbJokZRxLfUqPBJa1ldb85fx/Jdi8yNCFgMtKaXzJ6L9X/YfmbdAvOTNL9+In/b8SCE+UXu97/u9SIFprSuaEm9l/vdbisuaM5sxCuF1fQC5drtvcVGUnv0XTBIcmV9jlRrXcMCkbcGTt7mLeUoTw7HoAeIH4pzEoR9BZGng/UR30W6fJ3lVKcq/tv1hQilBOpS46MLgzNsQNCrebU337i1ev+3Y3oAHcx68ua6HxSF7YfZ4hEgWvQOd4juW7rmzgCciupDokZWP3pwhGkoDFuecebbsW65SMpJFpja53/yLplFrIyREMLJVrubCwDtQO0l/qmGxHTh5QnvxLAuaCZnh6o04Fyzx9FvCmQ6X2Wp2hTkFWp9UMN9j5KnNmLnSWm1PVd7tiRF3qgLGFJVaCwslGFPBWZI5vA74SBOntNu7q0wVsprxTUZIWABfW6e7/6UvuzprQhDGLC4k8v/aNuZOWeEPWkCWTG5WU/y1td98VA1NSc0lnZjer3VioqDYz51E4f12ZHgXCAET48Vh3HoJhNrF0syxm7i9VHMM9aZWSvmqRD q+W0YTfe 9j+F8VPN/nd8nR13zJCY58EHa411vXWoxKFTNof5Ok1mmW7sQAgqDWNCH1cO2IPb8yb5UUUNH4KiHWT53WEebA7BFPe/8yy9C6mqm9f2EtoQSisKnPcEuKWI7SnNQcwxlo37moyswPiaGHdlHDNFjsPc48fJbe3Hz71+doN40fwK8ppHLCsvOPZgf03YA5jEf7YCJc0pWLRtyL5/syaLNpirBNtOPPgaAqRgJ2ebBIXXHDNhi3SJVSHY0ipRqEQ99TpXty5zRROamMmMh+jsL6BQb5wpqEwdk0+HzOCACE36ns2+OignPdU7Vilwh6pajN5lX0SlSEVMDYdbCbR7hn8xzt/shNzyTY+ACvqzFXZu4UleJ3bUEQMaVBKqQ0Z8NG1/MJSVTjKrBrEbMr3djQn+swu1lN4j4PBihMjWqTC7fbn9nRGp/iZ0SopsPateMJ4Rw X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Change hugetlb_install_page() to hugetlb_install_folio(). This reduces one user of the Huge Page flag macros which take in a page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d20c8b09890e..849206e94742 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -4946,14 +4946,14 @@ static bool is_hugetlb_entry_hwpoisoned(pte_t pte) } static void -hugetlb_install_page(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr, - struct page *new_page) +hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long addr, + struct folio *new_folio) { - __SetPageUptodate(new_page); - hugepage_add_new_anon_rmap(new_page, vma, addr); - set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, new_page, 1)); + __folio_mark_uptodate(new_folio); + hugepage_add_new_anon_rmap(&new_folio->page, vma, addr); + set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, &new_folio->page, 1)); hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm); - SetHPageMigratable(new_page); + folio_set_hugetlb_migratable(new_folio); } int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, @@ -5107,7 +5107,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, /* huge_ptep of dst_pte won't change as in child */ goto again; } - hugetlb_install_page(dst_vma, dst_pte, addr, new); + hugetlb_install_folio(dst_vma, dst_pte, addr, page_folio(new)); spin_unlock(src_ptl); spin_unlock(dst_ptl); continue; From patchwork Wed Jan 25 17:05:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52591C54E94 for ; Wed, 25 Jan 2023 17:06:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E07056B007B; Wed, 25 Jan 2023 12:06:17 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D904D6B007D; Wed, 25 Jan 2023 12:06:17 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BE2646B007E; Wed, 25 Jan 2023 12:06:17 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A357B6B007B for ; Wed, 25 Jan 2023 12:06:17 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 6CF69AB3BC for ; Wed, 25 Jan 2023 17:06:17 +0000 (UTC) X-FDA: 80393949594.09.78BB196 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf04.hostedemail.com (Postfix) with ESMTP id E02984002B for ; Wed, 25 Jan 2023 17:06:12 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666373; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=oRImIQH6hXz0fnwIgh7cu0HTcEIEEaropzJE+PfwXdgCm9NhXIc44v//uu21WdztIDC4sg G26CWtUD+F9LiknPY1T2uii+GYwSB6WOi6+kuWskPC+Dsa8nLHTbyvzIbkygBfXErWARyj W/nNDXpPQOEuWJaubjtHTLQG0CSDWsM= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=qqwDUn7p; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xfm7MMGk; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666373; a=rsa-sha256; cv=pass; b=tU2kn+g2ejF3jJeLpBnWUw2za5CE1UnsesIUu23YSx66CGO1AOAqR1bxKLMa24yZeU6eli XoomduCSpCJWZ5f0HgR76gkziyhMuGh010l8fmWxKuc2lgigSv4sTnL7mdoeQAhZlXk5/D UoUzIkiY3ZR+g0UbwP+bSisf9ad4+cI= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFQ7nM029151; Wed, 25 Jan 2023 17:05:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=qqwDUn7pjd4SAw4vIsCzQGgdiTvQlp3SyfQUqV/vqJbb4t3+R027AzXFB/1Q6lfhh0eQ bezbtha+MC2vVrEdRa+/H2oKtJGlDFSkbdQ8TADa6rjQAOoqR+GBtozPWFLmNGxnxyYE Lw/Yg0us4RL6TtqIJVwgDFEd+X3Xq9/KsaVjN8HKS0OY8carToqA6M3+U/aXZOxnAApz HgHvc740n5UaACxM/sOdVdzRK/QWqLjp3J0hTdxIDclr1XHGEyRIEn/nrMbciNJT2ZVE Medouw399I6UpycrAF5bCuu6FXZv6HJE16+fuc+2PLMM5OxxDNczw96Q/MEqdRC7J/Xs BQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n88ku0dts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:54 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGGUXF034229; Wed, 25 Jan 2023 17:05:53 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6tsq3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T3E7m6wmbp2JkFAaDQyZowX8XHkUMpisMmHAk9kF/wXYM+i+EXDaPHjMNGKEy2n08AG/tCjfNAI4dWEHK52f35OIYWfr+//HqiWMbiladbx3ARVfzwX8bqap2e+qgeudrx1eUmjHngzoVbg+kDytMak6xaxA+pL59TQNvRtRslq0SIjCakV045xbjJWGAJ0MH2LxrRgdYZKDxlrtieTmfMX+8QIeGX25z/rLfVA00vC1DwLmQNYaRGwG9UxkW5vhimZjaD+b8jFvvkEVwhZ1CRNR2K9MUZ2Uxue3Vwb54JMSaXUXhI6S055uOdrMhFJqtYgs6fEyyTqLQ7UsP0OwJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=P4tPLbC3Mux5ApNkCS+3ELHezme36v1vWGmu0IUcseb9ic3+yAOpMz2eedN8HTX0jo+SlD64ASt/NYsWk4qw3zSW3gMBKS+KeBY7GDgdD6Z2w7emQHkgpBEbEECkIUxifozfcC1fymNe54TlxNYrL1cIeBFeJIMyqu4rkYMF1lyfR/2+khCJODdt3o7BTByH/xcSUrD+LeeC908/wKReRe3EbMAjHBtvDbNtiSciqtd34jcMAGpHxHtSgyzSb+XNmQoOmoBaRnuEkIvAMqCxizXlVG9zAUAiu886Hw9BamYQXyzMwGa0cgu5iRO9DF7eOIOOdmXONk0yNxk4cEt3lw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kg6K/uovRnrO0MaE25vLuqZe0ttrD5ZD9baHCb9erk4=; b=xfm7MMGkauoejhQzrGTMEBpiXF3gL2srrRapX2BS8oVQF1wJWGrGmn9Odhq/RU1KUmGKMcV/S8U2mqQQzfciTBFBxN0VMdOQB1LcV1RsIon7SjbYjgddT3lDyNWHsiDPr8n+Ej+DS942VmBRQN1d6khBvN93SSIVpqVaqRaJslA= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:51 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:51 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 2/8] mm/hugetlb: convert hugetlbfs_pagecache_present() to folios Date: Wed, 25 Jan 2023 09:05:31 -0800 Message-Id: <20230125170537.96973-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0029.namprd05.prod.outlook.com (2603:10b6:a03:254::34) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MHh4HTrhPWV+gNp3KC1//UeEonEAbQoFsyQbNNelWonqzQaI3y2vJs0kavreh1hxfMd7k3giJA5Js3ApzHOhNwXbbCWtZfEQEAwe1B8RjbF2o7+30zNTmKT77moKyLto091VD+IU9TQMMABHc+u2e8tenMGZSYHkKpOzDKxvUWcMMB0dKwHw/QCCNG22SiZE9MADINwjuGErjNWzBQUUNVQjhTBq3ldjd7SxMLZ5rbfZ1iOoI7yKmW1to1RmdIzXjF4ng4e+u2SHKf2qZkZT51otWHvPm4Sv6UHn3//y6OT2hvLal+E2cRuvwlj9S09mU35MyUHSc8GsNMh1nZxh0/EvTiXgDqMf9MAfhWzP9m+mjCu6uAgJQEWxy6uioAUpA04TK8PJXqZQ/7nJZmscqKFmTyszd8wDTz0vR+jyijaFJ+V+F24z7S7OYkIRnq7kq4w1kVUkSVQm0cSXVMCkeMP10ecYukTT2L+/KaukCQRhEBB48I0f/bnC+FwJQbDgbzsz+V91QQhH4yTO5IJ93KhE7P11kdO1OePBRiBIJq3NMGJBZz8OvkWdl36LB2jOFNAI0rFbTh9IY8WGjkKFazto+Ja4dsFH54z2E7nsbuGIe1/UmJ3Ob7fgmSqgW1P+2TlkaxEpuqpnA92Nn2hVwQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lRwKCDUhY0v5II7Rh8aU9MIVFsCZlkjnRuPHUnB5d2+j6oCriw7SNPOEuB8IM1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n7lw7LIwacfPv5jy5wfjvG/ds8HhxaXhP/ayVtZmKLmxpTUGPt+MqOKmGqMITpiDQ1P+pJHsFM9pu0KJBfUmGAkjkWNkW64sr32eVvYpOPcNRViSnAMEGTwxCV6zFE6TLoNnzzqQ3MlHRxrMhiNP62cYLqesJ2KDA3p6ZXS2OZLjlzg8fHDN3vD1nq4fiTnhI14ljJk2c/HDwdCnMDipL7qq9baJIR32FaBTBDxu4ihGDENU3DA/sLf72u7jzvBa7YZCMN9b3mANvImsuAdoymDTtLMIQcgxGktsG4pMkm0X2XjoOyY40Kl37NQgDmswSF37/ylsszPaL504az2C/6XuznIoP04fZMOO1Tf1fJnuOJ5GZmsKxAp8NVzATmbYCZfcbiOHeSNxiiQV1SAJBsiNFjIdHbKXskAriDfzPgt5AHYQSzPQJemIRThcC1+zHznvB1nZ+tnFIbDUUpkVVR3S/bHtq/qPju70LftAg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9ae529d7-f5e3-4f42-46d4-08dafef66999 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:51.5283 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ha5phOlvjnGgBhLAySqbvJNKXk915/EAvWTmRJYgAyInj0OhhpdeJsR+f1jG3SjvH8Yj871ueEUk6NAb6XKfPK0w0qmKfxcnxjb6uu8rmaE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Proofpoint-ORIG-GUID: cEHhU-R-nztFGelfKgcaqYl945ldQ-Ei X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: E02984002B X-Stat-Signature: ootcsajs9qupcn1dyqsnsonckcecprg7 X-HE-Tag: 1674666372-236948 X-HE-Meta: U2FsdGVkX1+cdZC2xnX32A2hSJpiGS8IzVzyB+TuvCwQc0VAjOvX3WImCEDd83JzU55xFMTuPSa2yRKFcpisUy1gXbNMaCNcnCRqtgLYZ1uZdDwmhuMtduwcn4pz4KN4pFU6xf6bbyWjzlRW2b9joOKC6XgN82KxzefvxxAuF5B/AJ1Kn0h/ekm58utbPteLR+WRPyZBs0b8BiqoxF6rzMJET/P2ZZeiNQ/KUYij8JtbGEu2O/bReO8Ae7aYMJsvrc2/2C33j53OtO8B/Yu0UlMHOfDdGf7ZThiw+p0Ym4jZp89+jfJd7QC7vQDxHyWZgQuJ8aTE7+pOOBSOJDzEwR1FAe3H8MwUrFOepxiqlx1MtGJkt44Nb6fFUoWhxFdNBaYUhEkakwiQUwvS/HKZZwbl7xR25YxRB+UQwdcJWteTqFuoYBF3KpA4BXbk3b+A8a1ETOOrgpCsFMbuDy6shERVG0fqpv5lZrLgiZ3ReQdholbJ2do6VMVKsgPPIDRuHlfgKoxtBFWrHYYNhGufr+L2v2RiAHsJuY3EtxhJTHRWGhYEt42hC8N6wIxiJGx6Ek/7giT3Aw61/M8T3mMvuUlHB6aYKaWU8gRVGZ9eV9GgE43fa3witVnyihuP15kYV1QXvHM0EvYMS6c/eJDuHxK/1mvP6EMXjVvnutaTbFfGCTc1kIP3EttJ5rJe4QiAdb6MkbD/o3ZoyjcAynPyOi30zqMm29BSVn1zXFrUJBjxNz9px+SKkhV8k2MjFQbkUvVdDFsst+VfqFYSHXez3XxPb9p6TzxCIpsUK8TeTmExrFOPGDVq7COZdKp6eD1Z+3K06lWBnkkMmlAp/OErgeLhnJ8rERmrBWLdDUyTHePeCurtn8WoDjRmAG16ktSU0PchiifVVeckZysqU1AEWeN54FDJob3LP6JzO1tjEqL5Y8XeCpPSshwNy/FkFguEoqS/KQr+wWgvdjwew/S wZ5yg1dU DcdTyPr7oQ9UKZ8T8fEW+c9gXUmp/iRLWAFbf5nmuxXDyw8wQC9KyjqdDMZxewTnaxoeDsH86eq6SyCpXWnHND2u4wv+IcLp1Kd4U0jV6FF4YZeamGiwCBRlsMEytiWq8JFWcwCsShEsDrmzQ8ou0CyB7wQZ/xgpbUYCEoZd9Kuj8rS5y2ruzm+BcgBfyMB2av3YUKIz9MdTX7ZGEsv/LMWAraQDo/kUtP1MvbBg37Gsa8miEOWByQWZ1Uy8F2hUge3vaXyUCDoWngrq51IK28dxVeOZAf9E3qHeHVv7999vVGZDH/zv/TttDj+TmPsp66sObhMQpYumV9LeIy5UtNIBbEETk9kBUJpm33fNotyhWWDooHgcFN46rgSnwVI8MbZ2yZU9kQ+M7wkIcgmTQG27EsS1w6IRM6n8TZ3ezYml/4wg4SkNttRwn0HatdH5TGeoz7ZKJ7AWdmDh2RYLOFyOsgxlDnzeOkoh3+KQHAk8DhhVFNHqPFG3qhQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Refactor hugetlbfs_pagecache_present() to avoid getting and dropping a refcount on a page. Use RCU and page_cache_next_miss() instead. Suggested-by: Matthew Wilcox Signed-off-by: Sidhartha Kumar --- mm/hugetlb.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 849206e94742..e506a46b7871 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5651,17 +5651,15 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, static bool hugetlbfs_pagecache_present(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { - struct address_space *mapping; - pgoff_t idx; - struct page *page; + struct address_space *mapping = vma->vm_file->f_mapping; + pgoff_t idx = vma_hugecache_offset(h, vma, address); + bool present; - mapping = vma->vm_file->f_mapping; - idx = vma_hugecache_offset(h, vma, address); + rcu_read_lock(); + present = page_cache_next_miss(mapping, idx, 1) != idx; + rcu_read_unlock(); - page = find_get_page(mapping, idx); - if (page) - put_page(page); - return page != NULL; + return present; } int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, From patchwork Wed Jan 25 17:05:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115869 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE70FC27C76 for ; Wed, 25 Jan 2023 17:06:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 775C16B0078; Wed, 25 Jan 2023 12:06:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 726256B007B; Wed, 25 Jan 2023 12:06:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 551CE6B007D; Wed, 25 Jan 2023 12:06:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 451626B0078 for ; Wed, 25 Jan 2023 12:06:16 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D787F140694 for ; Wed, 25 Jan 2023 17:06:15 +0000 (UTC) X-FDA: 80393949510.06.D7B9282 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 6013818001B for ; Wed, 25 Jan 2023 17:06:11 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=hvMBVF+g; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=R4sxQCaG; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666371; a=rsa-sha256; cv=pass; b=1/6pIHGCGOlT6n485B2KhlptkPWQm2Jg78q067nxiT/h12nsaMmEi7Onm3JKNX0v9Yh5Su UhXnDGlhldk3jkp2ru470FiBuHFV8+cZhdmaQWYsHZ74uh0AgdWj4ZkaxaC6MguplTX8B1 f1NGvd4Ckj0bWpVPSymQ2JwQm6GqahU= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=hvMBVF+g; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=R4sxQCaG; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666371; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=SpXhQ6VpXgpT8yIajjW64uwVajgZEkKEArMKfuMMktgvtsjGom7+KSyYzoqggtYU4tZIvD 2KyLi7yu+v7HAtyB6zvt/zZVkfyp0EqbNwWWk86XNrCLUQW0NUPU+LuZJYzQgq9M8NTyXb /Q5i1rFzZetknIctG1Vy9hevoCq4zaI= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNkKQ030134; Wed, 25 Jan 2023 17:05:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=hvMBVF+gs/A/eqnHZGDhEpbeXE6XoyMfgISh+MSjc/o9l6uMBPjxSJFzwXID8/D9cM+7 UUEmyN+GtiqowSMSj36bVsFJOLOSc/UP2OMGS8cADXmdkpQnNDK+7YK8iLjcEOZNfVIA gXW6FSDlSylEkg2NzTnxe+t0QQ9ldMQGQUGOAIFxyOjIXun4zb6n5E4ceq2mn09y449n E5Hb/iXoJazJEqcBluc4znqinoXcc19KG4ETQ7UszaoQ2+mym84m6Z23UnGLCBcaWm9w kVK/IZ2GUHz0Tw37fNBXybvgEGILe+BfoSrKodrYg9lbMhba2rZTB42nhElB5t5xoDgC bg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86u30hn1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:57 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PG6rc7009131; Wed, 25 Jan 2023 17:05:57 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2106.outbound.protection.outlook.com [104.47.58.106]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g757dh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:05:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uz9q85aCf0xJUJKEksmbg5MAMo9M+DpZ7RhrT7bRg7/yqH/8lMceEcxQofQ7Vz1HbK6HGCk1oqX6E4LlRFRzWDpg/otVpSMDRzRLlMjIaKbnN3Ruf4sf25EUWAhrFAHKZFyL9t9imCqKHPfl9g6y3+UFu7VlDI01oeR+n6++/pvjq9cJYcmF8xC5J0Ryv5edOpsgG1hXbdUHJJaV8N4wL6tqRqKBtODB+dy1bk8ou944RzS9pyJZXH49TcLY07aCWibca4E0LDdmB5zjT6cYPK3TMsC+4fJm1q/naCBhri6ixpXwUrawDlOTyZ7uzrjwNsrr0RhvI1mi7EZXvahZLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=UFSzzQWUxRWBuivB0uUMFtmSgwcyisUIfjXklqinpe5yV0pDOr8ETS5S9Y1IVZlTiNzzWvvdLb8dhMG7rtwTCptay3E/W8Ox371+jtg942/dUaxjdNiljZheWqFXuUyxLmitmk5NtmJDZ7wFCiKrdT6uiDOn1OPeuEjA1iRPh5S7AH567ONLSajf7/FkUlaTMQE6yHNIF5+TfLxjMry2i/Ng8r0rEuygg7PlvB+xF0tMVg9hycki7E82wFQmDPw8KdRJT7SLZoxs7ewYEUYPw3t5mSVO3mIEJ0vmk+IOSbtAfCSydNzTe63oLoHaS6aakVPf7M+yeyN9BDS+R0J8nw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=u0dwxiObzQekk8PfUp1TKaT7RYCgdVPTJRur8yXbulk=; b=R4sxQCaGVFWqJoBZVaAb0uMOrpYTO/wK2d1IFItPXaTCJjw3x5cK20S44m4bHEPmoYLTRhe0jwueJJ8bl7nW3I/5BcfJR9+ufPAowQfcmtYY6rUcp/sde3KAicLnFF/ytPNr9CIxE1C+OXO4tGxmisXVgIcHRGQgjyflcqtzDUg= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:54 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:54 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 3/8] mm/hugetlb: convert putback_active_hugepage to take in a folio Date: Wed, 25 Jan 2023 09:05:32 -0800 Message-Id: <20230125170537.96973-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0041.namprd17.prod.outlook.com (2603:10b6:a03:167::18) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: f89f6fde-83b6-4c7d-f006-08dafef66b8d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: viDzAjOblUKq7eIsGADRaM/lyXhKv7oOmyiD0pgt1+xyiRYZsGXDofdIiFq66DIAZnk2+aOOGD8b2Kx/gXHIFiawnVkJIx6Xb+QxRNFjLelPhN3WKMZ2CMJh1CwgBlfKL8CQjFmfd7oCugxG1P3jbmrxlewehbKHbOlyr1Ql7YbJR0lbICg2Et7ADiW/YzvU08+r77sN7DD5TqXKV/BfG4UoqTlCjCsqx8/NuS3tyERga9yS3O0Fo4a5tccDTbY/zdNtudLEZqS2P65OGND8/03CNhmbDwzMSY46W7RdzYk/Dx1D0G6GEAiguFpkId9QBD4bXAdgBwkJ98SNQDclgtT3viTMcJ75awPb2B86qUavSl/wQ3NIqd4wJ3G35fvl3O6Fo305imOonG2CBzuXVpufqLefPGn5A/WYJlFsND/84dJ3GNnov4m4yV4ZfemvkTlfKvDeBMO+39xCeLUSsfWbFoF9g2S4rCfShOi6oIZ99LKIb/P7flIMNAZ1koJWPq8PT9XO+shnJQujKymaV4KaOX8tep7dW5q5QlGdwOZu11j5X+EChoVBnuEssxY8Zar1M7x+f2ZXIzXyeEqfUw2jLo1/StleJPA9iXOnYyAPJK52zrVweOlMbZ9OdPdgX5Qh4rJPqVsRwUHU7JiTFw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9sgAYD3gdXxS2CRN9w2rlxC3xGPdd9uuYCRpvYkm6X5on0epumjmGR2ItwphYaBEeHffyb9/lBvqZCDrav/FRxncbMZ6vY1kRuxRDlSfhE8mAMSTWwgD8KspMTPXZmizufSmGc7l0X13+hIHj/KwT99MStWFj9F3LEMM9pnz1Tl9x11xQ8oCv7nyeY5y0LhKX69KRWXqcQvk3OXavNwvQesuZxTr1nUrmsravImCOtUu441AjlUcKVgILnIj+NuW+JXrlSz/cBsX3FcJ3aSFC32cHl+yA4ZbyMDgYFK2kSTEIFQUom3n33DW43Yg5iXBsla4lSbKLcu7tn/7obdBV4Uww1P1Wi2WytmvVc1aDm8OYyqYXoKo0tDmEyFi3e+zqYdiYZocIQBlm4j98Q27nVcUhCze0zio3TTTt08yUNlxkNX9YfU50zbdgVi2gWxafvKdFC2FRlpnMTkkWhNsuaHceFNJV73yQ7BC8gY//VQPV4hD1b4uteOdVtiSM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jMKbsXSXCljxCo1VR50CXM= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f89f6fde-83b6-4c7d-f006-08dafef66b8d X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:54.7782 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +57xr/a8geWzW5upmnHPiDNri19ynodnV6mqQ+D5FFodrPPB/VBRIStU0wAC6g83cTbTjM31J/oRH6mzk3fCXhY+5R58Ix4fPoUmtc4QhNU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: P_ZwQ1rLJe-OcpQjGYuDE_1D7vSIqOLi X-Proofpoint-ORIG-GUID: P_ZwQ1rLJe-OcpQjGYuDE_1D7vSIqOLi X-Rspam-User: X-Rspamd-Queue-Id: 6013818001B X-Rspamd-Server: rspam01 X-Stat-Signature: c7cj5841zj3fioh136jiojzguz7qotkw X-HE-Tag: 1674666371-462303 X-HE-Meta: U2FsdGVkX1/0X1oIW5vN4b2XjHLvIAtUN024GkLeCWwvVHFj2kdoyoPJgjifVJaexqbQX4T14ihmhjFj7JI/2zQ4f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Yp2ugyFMHxURRcB4Ph32wlI/T+mmHq3VfabdgtzY4WC4bsplPFKHIxTvuCV/Y8FhdRI7AiNmljTUnArEChb9lHxpqkDjDtdzGvv9nzw+Z6zv/teqxmYmqtHQPZuQabSBYIyx/6URRFK3hcjClIQs+9obc7c3ZWSWNKkoKdUlvK/4jbl2S92Vkhsr7zeb3F1bYJwg1aNwGE7dX9lcAVx+fHbJE56xQbhOWXFmPPqTEuzO6anwOtiuGkl66CWHkFb72wqPzaeL8bQx0R7XT4RYz3keKJxD9 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert putback_active_hugepage() to folio_putback_active_hugetlb(), this removes one user of the Huge Page macros which take in a page. The callers in migrate.c are also cleaned up by being able to directly use the src and dst folio variables. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- The call to folio_putback_active_hugetlb(page_folio(page)); in putback_movable_pages() is being converted so that a folio can be passed directly. This patch has been sent by Vishal Moola and is currently under review. include/linux/hugetlb.h | 4 ++-- mm/hugetlb.c | 8 ++++---- mm/migrate.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 06eb59711e4a..1170db8e7831 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -174,7 +174,7 @@ int isolate_hugetlb(struct folio *folio, struct list_head *list); int get_hwpoison_hugetlb_folio(struct folio *folio, bool *hugetlb, bool unpoison); int get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); -void putback_active_hugepage(struct page *page); +void folio_putback_active_hugetlb(struct folio *folio); void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason); void free_huge_page(struct page *page); void hugetlb_fix_reserve_counts(struct inode *inode); @@ -428,7 +428,7 @@ static inline int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return 0; } -static inline void putback_active_hugepage(struct page *page) +static inline void folio_putback_active_hugetlb(struct folio *folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e506a46b7871..ded5fe790c79 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7300,13 +7300,13 @@ int get_huge_page_for_hwpoison(unsigned long pfn, int flags, return ret; } -void putback_active_hugepage(struct page *page) +void folio_putback_active_hugetlb(struct folio *folio) { spin_lock_irq(&hugetlb_lock); - SetHPageMigratable(page); - list_move_tail(&page->lru, &(page_hstate(page))->hugepage_activelist); + folio_set_hugetlb_migratable(folio); + list_move_tail(&folio->lru, &(folio_hstate(folio))->hugepage_activelist); spin_unlock_irq(&hugetlb_lock); - put_page(page); + folio_put(folio); } void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason) diff --git a/mm/migrate.c b/mm/migrate.c index 92d53e0b609a..b971edbf32fc 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -151,7 +151,7 @@ void putback_movable_pages(struct list_head *l) list_for_each_entry_safe(page, page2, l, lru) { if (unlikely(PageHuge(page))) { - putback_active_hugepage(page); + folio_putback_active_hugetlb(page_folio(page)); continue; } list_del(&page->lru); @@ -1374,7 +1374,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, if (folio_ref_count(src) == 1) { /* page was freed from under us. So we are done. */ - putback_active_hugepage(hpage); + folio_putback_active_hugetlb(src); return MIGRATEPAGE_SUCCESS; } @@ -1459,7 +1459,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, folio_unlock(src); out: if (rc == MIGRATEPAGE_SUCCESS) - putback_active_hugepage(hpage); + folio_putback_active_hugetlb(src); else if (rc != -EAGAIN) list_move_tail(&src->lru, ret); @@ -1471,7 +1471,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, if (put_new_page) put_new_page(new_hpage, private); else - putback_active_hugepage(new_hpage); + folio_putback_active_hugetlb(dst); return rc; } From patchwork Wed Jan 25 17:05:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115873 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3DCFC54EAA for ; Wed, 25 Jan 2023 17:06:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C82336B0080; Wed, 25 Jan 2023 12:06:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BBA8F6B0081; Wed, 25 Jan 2023 12:06:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94B6F6B0082; Wed, 25 Jan 2023 12:06:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7D6956B0080 for ; Wed, 25 Jan 2023 12:06:23 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 52D60140E3F for ; Wed, 25 Jan 2023 17:06:23 +0000 (UTC) X-FDA: 80393949846.20.A9D05BF Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf09.hostedemail.com (Postfix) with ESMTP id D300D140022 for ; Wed, 25 Jan 2023 17:06:18 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=ECGeHdce; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=T+mx9ZQj; spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666379; a=rsa-sha256; cv=pass; b=FqLLqyGEX+n44T/YY1JOqhzkwe6D2oBP4btroJQp/VwwSt/41v7UVxnaqB6PeRjUOpV52R 1FGV5l8ghWQUTgWJhWl8oyUUpcZg1ulY0uomVgCIWiExwhE9xar1iEbObMruxKlsKzDjl/ PFk+NwfDczLNRKE0f2HWrC8LYLrIQtU= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=ECGeHdce; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=T+mx9ZQj; spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666379; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=AWNs2UX1wv/NEP66yqhyj4Oo23aOVzyK7so231Y0QyFDma9i8OhQ6eB6KC0a9Lv3MLzXTI /kaoEZO4om7nj0XUFsAzjHD/dja7oekEAQoMeeG2DRhi9LWlJZrWm03Z7K6053TVeDCNQQ 7T0dgY8oS+9N8WPbaVmTRDiQ8dQYv+I= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFQCou018592; Wed, 25 Jan 2023 17:06:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=ECGeHdceuC0AOPOkhE0mG3KO9w7i75zRTJ/c8D/ibKLqUji5gOgctae2KgCdtE+zP1Yl 4XH2IqV5c3imG9hC9NXdbmv7rdKmHn2Ql0jDB7OgdldFJ5Kap4BXxfxWWBYl9mcj7AG0 Xf/We5e9Mm2wPrz79NrRoasjDnWZJvko+lkw77tvnztJFyq/S8azuo23UNlrWKITYCtJ 5vdl/HOYKbPxJpwrAd53WNP+Oj2QTkON8azhg2RnXfUicyhyNhQXqC7nWZ5jS3HlfvR4 iLXnjoEuyEQAK9AzdsgwIIwAKd3WipWRgRBvWg+koZ2k3jHwPa58XlHKJhGQNErA+ay1 ag== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86ybggha-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:02 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGAI8v019113; Wed, 25 Jan 2023 17:06:01 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2103.outbound.protection.outlook.com [104.47.58.103]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gd5hdw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JojxX4xoAPdovAkofWLkGrDSWx1S1XOowMyCVJFE9oLbMvG7YJQs2yV3HMaLTcHiumwGjod2inLXkR5NXoC9RcUikHluDHrA57cWV2xIRuIbSkqWu3gS2bUy82F79eJbbrb2fRJOvxHgYt1fCPr/wSExPdWZLfN5nGug866hATJnT0YfPIpL1B234aruE8spaPkzrUtGJA6F/eLf5P4tuDaB9kyhRx9UPP8telvxkb1EV8qQnSE2KV3C1Nu0gMZQFroIKks2BXo8LFECH+ksTNOjAyvfCDejyAB/U2W0kG1SrVy/yn3jkUPqt2YjzPjcnNGySM4oINY8mqXraxC8oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=e8q2j89Z8rNyY5AHsbPLW1Yt8GmbqZZjRpmX/CGHZijHXR3LPCCf6IUSXJ2CDwN5Jr+/2mSMburZ5XvglQ2cD1Q7rIvXU299ZWd+fSXsCCm3XdhZ2X+8CqYL7aDlSM1vRFm7fLrvnFaDDc2V1/6MmaKv8Yx4oOlO0JEzep702bZOcrizsgMIfPKQn+AoaWWtqxyXZpirH7aBX3FYDXbN9/iRBmQ2dHh1Hy/K2/ktzXyFE4uVjflIKdFANSF+josXUeHz20LJo9Uv5KfJnDPFOxGYmWPOSs0zBxagzICsQ8p+SjI4mUC6nfBHXoULVjhfMlf7+FJ/qJ3/9c1HWisuDg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=94lBh0ooEc80+xdbQs4bs4zXgqJnvhVf37ugpDePoN0=; b=T+mx9ZQjRzJKe8Qut8zD88J7rFGfdFPXrBOkFt3E9WjfisvjB4hn9RpPZ1gloKS3OS/18fgbvMoyERnkEyNHKOE8tJPydglb6gZNGhxJ6S8FaRCIC3eOe+xz0Q+hHbVvQLd4RG3tTNuE1v3JBE8eAu5nLHPSND/gR2VuFepaqZc= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:05:58 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:05:58 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar , kernel test robot Subject: [PATCH v2 4/8] mm/hugetlb: convert hugetlb fault paths to use alloc_hugetlb_folio() Date: Wed, 25 Jan 2023 09:05:33 -0800 Message-Id: <20230125170537.96973-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0037.namprd17.prod.outlook.com (2603:10b6:a03:167::14) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: c2fa5dd7-d744-496c-9e75-08dafef66d42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +s9eGb3d/uZ+MhhFG9PRCqWpl/kXQFJTFT80gcJRr2+KeGaWn0PMFX5lF0pux5V8eD+uMrnt+VXKa2bIVQeGEsAUEvouOeyuSqRyAO86B7Bmi3UI6eOLRmCYSa0NRxHTyd+nlAoAFCIQdfy/12erFksdGtCeofThbuqhgCyVvr/TlPiT9bLBH4Hmcu0iTg6iBhQ4+5M+HQYOGhgzye7yl7Ie0SX573oy1S6/x/2/796SS4YMmuu5F/1sP3u/ytP4S3ry9ZNGxK5xOy9iYPlOhzeeBf4HeG4/2MAHdVp5C6B5gf9qnvrLZrLYu/bB3QQQ/vVsJSvbIA4rRII91QJ6fMIkqCk3q7XssybLFHkm6q0NTAbdpuvDs2CtUUcp6RjR+RPmX1j7VpKGTJ1Kaa9wmyedcLyLDYXTRoL9H7TgQu37hDsOTyGeAVZ5LEn1M5r/JAlxfl0wReuqOCTvTiJ34vQjKV6FbiKqf8WUbVYiQSQ6eFWfVmwd5WlePg7bJY8TdIyKrbKY71j63x/stxRpAjc6cYcJ48yD5ZoyYmdsAbof2kXlG5YpzobKWr3x24z7GUwUpKuJBmePEHGAhdLo5WnRZ9ccWUXCLJBGAfcF/Rv2nLcR/Ut1aEBDJPt7sYYR2XY8FsbWFncNZqw5+OChlw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(30864003)(44832011)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003)(54906003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1tr7GkweEPn6m2LC0T00DwUlLCicYEGPHsR8+x/dbhsfjK2U7ahS4x159AGX/NiizUktdcvk+Sh+hUmNC0WJxX/+D7bwI8RcW+9D0ZUZ6iXZtdTQYBb7gntJiFFHWI0q/dJ/zXiND4f57AlMN7Bm61DKARznBxp6ARxYtC2ESLjLnQJvSdUuwEqsME8vD4O4YALWP70/W2WcFmsWu1avHKLlLcn2h1dfkWDaB5eq6ghfIoooMPsqKAkAQ0ODtLXTVkkOyYPEN7Dh6U9NHPhYVdkH7b53/cUMfaT+4vupIKbhja0UcvKA2n6w3fhWrEh523qG/eWLan1Vm+Bt3T7+NKiDBSsOSyEodEK/BWLGL27httipOFKUmD93UiQWoWRhp9Qztm18ohN7zT+OTaS9cUtgEX29lktgyaOMafC9NXnZlxPQ3Uhum8OEfEjs0zZPeZn1hnsGvxlIim+EiaUWgW1/nuP/WVA02MZyOO9uBk/VIiS5GoravUvwKg6k7tzBv6be7co8SVQ79gtBIIilrGhivE16q9jIlqAz6TASVxUUlk64h2J2FPjycKQEjGRwZec3UZyDjZX6+uqKEBae+lmo4rAwXvaw2yKihEM80fArcJqlj+dmYGpmmv1t1i+6pecW36SizfsbJNmZW9MK3/EPxshoJenLti5mXR7Oe5QKg7YW0Z2zcdGJSYRblC3Vb+daeM+kxyT8fufpbvWaaXAFuKaB2cxctwoZQ8yFuMltkQYl8WgNGKryJwsReV7NviFfoss3AYolirke+a1pt+hpUnFp/LEdoLgoqRGuYYA9ui2fmPweQZBMv2AVzWcWijToGBz8ak1F6kEshRUt0Dx30VShIGl+99m6cvP+8HSuKsHrOtQKkUIjEM0z/7K8mybtOeRew1a2H5SNVPEnHm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IhUGYXjmDYonSRE8SO0T9cO/ndQRyy8HzK/AprwHNS6S31bO+ZySTzZ33hC6DnNaeJZcRC0vQySbIqaeMKUZDmrkAwVVUUgoEkJAzN4EIUZ3L/F48blP6vXImR69tyGVUUYrsZYuKSeS4qCthYf1VDF/Cpq582rD3RWmiinaMCV+66qF5VM8HWBSXMxnk670hCPjbxjrYTUQd4f9bMKjl7D00x9rADJIPsR517srkF7iEEN8IzzbTyK5di++jBTO6gpV019gZxpN89GgSY4P1fospatC9QW4dWxSIafDTCHhmbNtzkdc7jMgr0IBQJ9Hjku8wWPxxn1UiS7Mx5h0bOV2yWRT+l/ssTe/MUWRLL9b7GrurUp7s1sW7J3Qwx/n1zqOj+jcCBedRRImII0r90//lVnEsq++puEWpPEbFz2jKlI1gGvHfQ0oQMJgcO2OnmgwpjrregPVgUFp+Ps8RVwNklBqsuXBfuj87l+CA+tT+SSJqMqZ5nHlV1IHCM+CYzjsyVBQiNxTvmM850NzCRs+zB0bO58h8NgMKBTETkNCJLhOBsp6bvARDBVa2T6gFgyLjXDD6t5FYnX0J8XtaZfswDJjdSFmqCZ13ThItC/0YgrCxshKKPQPteCVhHVbNs2zl9rNOLSouB8Cvb2+sdk8F2/hzD4p0AfBDnGXu9PwNWpFpPVbdwPKGkGBf1NQKTKUHf4cEhJkM X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2fa5dd7-d744-496c-9e75-08dafef66d42 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:05:58.6704 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: axf2CwCC05RZyPJ+dAmn4wsI7MY9I5S/GIPZ6A+DXNe/XljiuiaC6Kh8V8IwjGsW2+W1jmFFpRFN4N4Yd55JItR0TmVegGCdGGIaMYGqmCQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: 0cUQtaBqS45hEWh9cKhVQokPEOI8jnEJ X-Proofpoint-ORIG-GUID: 0cUQtaBqS45hEWh9cKhVQokPEOI8jnEJ X-Rspam-User: X-Rspamd-Queue-Id: D300D140022 X-Rspamd-Server: rspam01 X-Stat-Signature: wpnf8wpyw9e4o171gtt8yt8on8ycbtt5 X-HE-Tag: 1674666378-118352 X-HE-Meta: U2FsdGVkX1880AyNlaxHIgD2TQXzOMDEOsayC3qq0/B641sMfRfN2xVVJxAkjwb+rafbti22KtxrG3ezovggimlh+bgwoMvFp+pEH/bH6AwMu1pdvBfFv1W9AdQsF4DYFNy0Wt7ZVT7kA80escCoR30SNqSsRGoL8IL/EerpsEwz1mvuox0n6NN+sHpKb3bPAylzfhVcLrHEA0jWscWgfPgAowWhx7UucYzcE8k8o9EwTTEzmtbmvU2vBUubdwPP2cZF5pCiVT6b3FmflwnJCr/ABR4Nk9ZD1eSxfW7mAOQhKcQktaNwk1jRS2hq77l5bKYRIX45vHhYTWO32n5BKLVB8XJS55b2xShkjAsxFxrJiSNTJpHHIt/AQ6AwQetU3QrMxt15/383dUVsYP0oYv39YLVPT+jGUANB09bVG9Ev/nC76pcTFVqI5omByLkC09XEDuxhVaqDokCswbWFKa2/AinEVHbWyurC68c9aPASrOTrtpt8z0ybjcWpoBXxRunDfomZJzac0QUvVf1/Hy1t9DE9C0Td6bC2qmkIiwOO2dgG1q3J+31Y2EdGjzyxmYT0RspdFMt25juAf8v2uOP9QHtH1FHg4u4Yw3RNC7J3GMNBQ4zXWVfggUkvinayXchjZ6PUNBV0tcTHM3iqFbDn4mTZE/CoijcZPfPq2VkvoRaWQdmm2Cu8ZJDnrHuG8jhkLCawUPj2ljCUrbZb6lGcp44PleIo7syOVaNZrLrcEfb2JZ1W8XTWuBKftk44Yc6ogdoXqlJ4/5D/6/WeurRaV1lRGyYOtXEeYrgGY/kw2t7R4U3io99LEFTZvkuFa4RYwaQnE7BVGPHNfjY03wxgcADfN6YaGM8pq9Fq2aJ6Tfk9u7qkhFSq8Ufdnka61q7o4wy1lrqQNKPYWCegIy+Dom7R0CK97t4kyEFt+7EWtzniuxcPDtNAv785EG7Zih6M+XomPgS37OTpJOW 62X2J/wx 0OCDKg9ERFkCUhZb0NlAQ/Xv3SOhOjlcHlJ11OgtZGYwA0DLT0zqDnVHpfh/x+6PioFWUQ0+C/CMS+lfGq35A/CR1vRidgX3ziQL89azyi9uzxO5nSHStYKNZ2sExpcbFYw0QbmlhjMgANmiYeG2liDWrI+nLoUxPgDWNFIegZ8znAEgHe7qBREJ3ALCCWA4wbUClqx8qi9CGJ1qNW8ux+k1nnTkNzuGDijQK6VHm+3989Ih8CkcLASgt2S/KjGOOG/P/j8c6+VTPk9V0637RNHYc+db5ZVIbP4DMnu8ryc9B+nHulUOoqwU2LJvuRjBI9FUqk7L0AmItRnzv26GXlKUF6L3iiEVQ+wojhweME61kBI+0Hkq1+hp4OHniJ8i0S2Qq0U8gWdCoN5n2mIvCi9jvRc9uvzRNeWiqQs22kLaPv11Do6ApkpCRwFugzieaT9jTx4ENawLHaArX3R50CJFLrg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Change alloc_huge_page() to alloc_hugetlb_folio() by changing all callers to handle the now folio return type of the function. In this conversion, alloc_huge_page_vma() is also changed to alloc_hugetlb_folio_vma() and hugepage_add_new_anon_rmap() is changed to take in a folio directly. Many additions of '&folio->page' are cleaned up in subsequent patches. hugetlbfs_fallocate() is also refactored to use the RCU + page_cache_next_miss() API. Suggested-by: Mike Kravetz Reported-by: kernel test robot Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 40 ++++---- include/linux/hugetlb.h | 8 +- include/linux/rmap.h | 2 +- mm/hugetlb.c | 201 ++++++++++++++++++++-------------------- mm/mempolicy.c | 6 +- mm/rmap.c | 6 +- 6 files changed, 133 insertions(+), 130 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 48f1a8ad2243..ac16ada48f75 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -819,8 +819,9 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, * This is supposed to be the vaddr where the page is being * faulted in, but we have no vaddr here. */ - struct page *page; + struct folio *folio; unsigned long addr; + bool present; cond_resched(); @@ -844,48 +845,49 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, mutex_lock(&hugetlb_fault_mutex_table[hash]); /* See if already present in mapping to avoid alloc/free */ - page = find_get_page(mapping, index); - if (page) { - put_page(page); + rcu_read_lock(); + present = page_cache_next_miss(mapping, index, 1) != index; + rcu_read_unlock(); + if (present) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); hugetlb_drop_vma_policy(&pseudo_vma); continue; } /* - * Allocate page without setting the avoid_reserve argument. + * Allocate folio without setting the avoid_reserve argument. * There certainly are no reserves associated with the * pseudo_vma. However, there could be shared mappings with * reserves for the file at the inode level. If we fallocate - * pages in these areas, we need to consume the reserves + * folios in these areas, we need to consume the reserves * to keep reservation accounting consistent. */ - page = alloc_huge_page(&pseudo_vma, addr, 0); + folio = alloc_hugetlb_folio(&pseudo_vma, addr, 0); hugetlb_drop_vma_policy(&pseudo_vma); - if (IS_ERR(page)) { + if (IS_ERR(folio)) { mutex_unlock(&hugetlb_fault_mutex_table[hash]); - error = PTR_ERR(page); + error = PTR_ERR(folio); goto out; } - clear_huge_page(page, addr, pages_per_huge_page(h)); - __SetPageUptodate(page); - error = hugetlb_add_to_page_cache(page, mapping, index); + clear_huge_page(&folio->page, addr, pages_per_huge_page(h)); + __folio_mark_uptodate(folio); + error = hugetlb_add_to_page_cache(&folio->page, mapping, index); if (unlikely(error)) { - restore_reserve_on_error(h, &pseudo_vma, addr, page); - put_page(page); + restore_reserve_on_error(h, &pseudo_vma, addr, &folio->page); + folio_put(folio); mutex_unlock(&hugetlb_fault_mutex_table[hash]); goto out; } mutex_unlock(&hugetlb_fault_mutex_table[hash]); - SetHPageMigratable(page); + folio_set_hugetlb_migratable(folio); /* - * unlock_page because locked by hugetlb_add_to_page_cache() - * put_page() due to reference from alloc_huge_page() + * folio_unlock because locked by hugetlb_add_to_page_cache() + * folio_put() due to reference from alloc_hugetlb_folio() */ - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); } if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 1170db8e7831..f6849e67ffef 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -716,11 +716,11 @@ struct huge_bootmem_page { }; int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list); -struct page *alloc_huge_page(struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve); struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); -struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, pgoff_t idx); @@ -1032,7 +1032,7 @@ static inline int isolate_or_dissolve_huge_page(struct page *page, return -ENOMEM; } -static inline struct page *alloc_huge_page(struct vm_area_struct *vma, +static inline struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) { @@ -1046,7 +1046,7 @@ alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, return NULL; } -static inline struct page *alloc_huge_page_vma(struct hstate *h, +static inline struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { diff --git a/include/linux/rmap.h b/include/linux/rmap.h index a6bd1f0a183d..a4570da03e58 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h @@ -203,7 +203,7 @@ void page_remove_rmap(struct page *, struct vm_area_struct *, void hugepage_add_anon_rmap(struct page *, struct vm_area_struct *, unsigned long address, rmap_t flags); -void hugepage_add_new_anon_rmap(struct page *, struct vm_area_struct *, +void hugepage_add_new_anon_rmap(struct folio *, struct vm_area_struct *, unsigned long address); static inline void __page_dup_rmap(struct page *page, bool compound) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ded5fe790c79..e104dba1e5ea 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2493,7 +2493,7 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, } /* mempolicy aware migration callback */ -struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address) { struct mempolicy *mpol; @@ -2507,7 +2507,7 @@ struct page *alloc_huge_page_vma(struct hstate *h, struct vm_area_struct *vma, folio = alloc_hugetlb_folio_nodemask(h, node, nodemask, gfp_mask); mpol_cond_put(mpol); - return &folio->page; + return folio; } /* @@ -2798,14 +2798,14 @@ static long vma_del_reservation(struct hstate *h, /* * This routine is called to restore reservation information on error paths. - * It should ONLY be called for pages allocated via alloc_huge_page(), and - * the hugetlb mutex should remain held when calling this routine. + * It should ONLY be called for folios allocated via alloc_hugetlb_folio(), + * and the hugetlb mutex should remain held when calling this routine. * * It handles two specific cases: * 1) A reservation was in place and the page consumed the reservation. * HPageRestoreReserve is set in the page. * 2) No reservation was in place for the page, so HPageRestoreReserve is - * not set. However, alloc_huge_page always updates the reserve map. + * not set. However, alloc_hugetlb_folio always updates the reserve map. * * In case 1, free_huge_page later in the error path will increment the * global reserve count. But, free_huge_page does not have enough context @@ -2814,7 +2814,7 @@ static long vma_del_reservation(struct hstate *h, * reserve count adjustments to be made by free_huge_page. Make sure the * reserve map indicates there is a reservation present. * - * In case 2, simply undo reserve map modifications done by alloc_huge_page. + * In case 2, simply undo reserve map modifications done by alloc_hugetlb_folio. */ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct page *page) @@ -2844,8 +2844,8 @@ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, if (!rc) { /* * This indicates there is an entry in the reserve map - * not added by alloc_huge_page. We know it was added - * before the alloc_huge_page call, otherwise + * not added by alloc_hugetlb_folio. We know it was added + * before the alloc_hugetlb_folio call, otherwise * hugetlb_restore_reserve would be set on the folio. * Remove the entry so that a subsequent allocation * does not consume a reservation. @@ -3014,7 +3014,7 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) return ret; } -struct page *alloc_huge_page(struct vm_area_struct *vma, +struct folio *alloc_hugetlb_folio(struct vm_area_struct *vma, unsigned long addr, int avoid_reserve) { struct hugepage_subpool *spool = subpool_vma(vma); @@ -3023,7 +3023,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, long map_chg, map_commit; long gbl_chg; int ret, idx; - struct hugetlb_cgroup *h_cg; + struct hugetlb_cgroup *h_cg = NULL; bool deferred_reserve; idx = hstate_index(h); @@ -3130,7 +3130,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), pages_per_huge_page(h), folio); } - return &folio->page; + return folio; out_uncharge_cgroup: hugetlb_cgroup_uncharge_cgroup(idx, pages_per_huge_page(h), h_cg); @@ -4950,7 +4950,7 @@ hugetlb_install_folio(struct vm_area_struct *vma, pte_t *ptep, unsigned long add struct folio *new_folio) { __folio_mark_uptodate(new_folio); - hugepage_add_new_anon_rmap(&new_folio->page, vma, addr); + hugepage_add_new_anon_rmap(new_folio, vma, addr); set_huge_pte_at(vma->vm_mm, addr, ptep, make_huge_pte(vma, &new_folio->page, 1)); hugetlb_count_add(pages_per_huge_page(hstate_vma(vma)), vma->vm_mm); folio_set_hugetlb_migratable(new_folio); @@ -5080,34 +5080,34 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, } else if (page_try_dup_anon_rmap(ptepage, true, src_vma)) { pte_t src_pte_old = entry; - struct page *new; + struct folio *new_folio; spin_unlock(src_ptl); spin_unlock(dst_ptl); /* Do not use reserve as it's private owned */ - new = alloc_huge_page(dst_vma, addr, 1); - if (IS_ERR(new)) { + new_folio = alloc_hugetlb_folio(dst_vma, addr, 1); + if (IS_ERR(new_folio)) { put_page(ptepage); - ret = PTR_ERR(new); + ret = PTR_ERR(new_folio); break; } - copy_user_huge_page(new, ptepage, addr, dst_vma, + copy_user_huge_page(&new_folio->page, ptepage, addr, dst_vma, npages); put_page(ptepage); - /* Install the new huge page if src pte stable */ + /* Install the new hugetlb folio if src pte stable */ dst_ptl = huge_pte_lock(h, dst, dst_pte); src_ptl = huge_pte_lockptr(h, src, src_pte); spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING); entry = huge_ptep_get(src_pte); if (!pte_same(src_pte_old, entry)) { restore_reserve_on_error(h, dst_vma, addr, - new); - put_page(new); + &new_folio->page); + folio_put(new_folio); /* huge_ptep of dst_pte won't change as in child */ goto again; } - hugetlb_install_folio(dst_vma, dst_pte, addr, page_folio(new)); + hugetlb_install_folio(dst_vma, dst_pte, addr, new_folio); spin_unlock(src_ptl); spin_unlock(dst_ptl); continue; @@ -5478,7 +5478,8 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, const bool unshare = flags & FAULT_FLAG_UNSHARE; pte_t pte; struct hstate *h = hstate_vma(vma); - struct page *old_page, *new_page; + struct page *old_page; + struct folio *new_folio; int outside_reserve = 0; vm_fault_t ret = 0; unsigned long haddr = address & huge_page_mask(h); @@ -5539,9 +5540,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * be acquired again before returning to the caller, as expected. */ spin_unlock(ptl); - new_page = alloc_huge_page(vma, haddr, outside_reserve); + new_folio = alloc_hugetlb_folio(vma, haddr, outside_reserve); - if (IS_ERR(new_page)) { + if (IS_ERR(new_folio)) { /* * If a process owning a MAP_PRIVATE mapping fails to COW, * it is due to references held by a child and an insufficient @@ -5586,7 +5587,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, return 0; } - ret = vmf_error(PTR_ERR(new_page)); + ret = vmf_error(PTR_ERR(new_folio)); goto out_release_old; } @@ -5599,9 +5600,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, goto out_release_all; } - copy_user_huge_page(new_page, old_page, address, vma, + copy_user_huge_page(&new_folio->page, old_page, address, vma, pages_per_huge_page(h)); - __SetPageUptodate(new_page); + __folio_mark_uptodate(new_folio); mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, haddr, haddr + huge_page_size(h)); @@ -5618,12 +5619,12 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, huge_ptep_clear_flush(vma, haddr, ptep); mmu_notifier_invalidate_range(mm, range.start, range.end); page_remove_rmap(old_page, vma, true); - hugepage_add_new_anon_rmap(new_page, vma, haddr); + hugepage_add_new_anon_rmap(new_folio, vma, haddr); set_huge_pte_at(mm, haddr, ptep, - make_huge_pte(vma, new_page, !unshare)); - SetHPageMigratable(new_page); + make_huge_pte(vma, &new_folio->page, !unshare)); + folio_set_hugetlb_migratable(new_folio); /* Make the old page be freed below */ - new_page = old_page; + new_folio = page_folio(old_page); } spin_unlock(ptl); mmu_notifier_invalidate_range_end(&range); @@ -5632,9 +5633,9 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * No restore in case of successful pagetable update (Break COW or * unshare) */ - if (new_page != old_page) - restore_reserve_on_error(h, vma, haddr, new_page); - put_page(new_page); + if (new_folio != page_folio(old_page)) + restore_reserve_on_error(h, vma, haddr, &new_folio->page); + folio_put(new_folio); out_release_old: put_page(old_page); @@ -5753,11 +5754,11 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, vm_fault_t ret = VM_FAULT_SIGBUS; int anon_rmap = 0; unsigned long size; - struct page *page; + struct folio *folio; pte_t new_pte; spinlock_t *ptl; unsigned long haddr = address & huge_page_mask(h); - bool new_page, new_pagecache_page = false; + bool new_folio, new_pagecache_folio = false; u32 hash = hugetlb_fault_mutex_hash(mapping, idx); /* @@ -5776,9 +5777,9 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * Use page lock to guard against racing truncation * before we get page_table_lock. */ - new_page = false; - page = find_lock_page(mapping, idx); - if (!page) { + new_folio = false; + folio = filemap_lock_folio(mapping, idx); + if (!folio) { size = i_size_read(mapping->host) >> huge_page_shift(h); if (idx >= size) goto out; @@ -5811,8 +5812,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, VM_UFFD_MISSING); } - page = alloc_huge_page(vma, haddr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(vma, haddr, 0); + if (IS_ERR(folio)) { /* * Returning error will result in faulting task being * sent SIGBUS. The hugetlb fault mutex prevents two @@ -5826,17 +5827,17 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * sure there really is no pte entry. */ if (hugetlb_pte_stable(h, mm, ptep, old_pte)) - ret = vmf_error(PTR_ERR(page)); + ret = vmf_error(PTR_ERR(folio)); else ret = 0; goto out; } - clear_huge_page(page, address, pages_per_huge_page(h)); - __SetPageUptodate(page); - new_page = true; + clear_huge_page(&folio->page, address, pages_per_huge_page(h)); + __folio_mark_uptodate(folio); + new_folio = true; if (vma->vm_flags & VM_MAYSHARE) { - int err = hugetlb_add_to_page_cache(page, mapping, idx); + int err = hugetlb_add_to_page_cache(&folio->page, mapping, idx); if (err) { /* * err can't be -EEXIST which implies someone @@ -5845,13 +5846,13 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * to the page cache. So it's safe to call * restore_reserve_on_error() here. */ - restore_reserve_on_error(h, vma, haddr, page); - put_page(page); + restore_reserve_on_error(h, vma, haddr, &folio->page); + folio_put(folio); goto out; } - new_pagecache_page = true; + new_pagecache_folio = true; } else { - lock_page(page); + folio_lock(folio); if (unlikely(anon_vma_prepare(vma))) { ret = VM_FAULT_OOM; goto backout_unlocked; @@ -5864,7 +5865,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * don't have hwpoisoned swap entry for errored virtual address. * So we need to block hugepage fault by PG_hwpoison bit check. */ - if (unlikely(PageHWPoison(page))) { + if (unlikely(folio_test_hwpoison(folio))) { ret = VM_FAULT_HWPOISON_LARGE | VM_FAULT_SET_HINDEX(hstate_index(h)); goto backout_unlocked; @@ -5872,8 +5873,8 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, /* Check for page in userfault range. */ if (userfaultfd_minor(vma)) { - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); /* See comment in userfaultfd_missing() block above */ if (!hugetlb_pte_stable(h, mm, ptep, old_pte)) { ret = 0; @@ -5907,10 +5908,10 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, goto backout; if (anon_rmap) - hugepage_add_new_anon_rmap(page, vma, haddr); + hugepage_add_new_anon_rmap(folio, vma, haddr); else - page_dup_file_rmap(page, true); - new_pte = make_huge_pte(vma, page, ((vma->vm_flags & VM_WRITE) + page_dup_file_rmap(&folio->page, true); + new_pte = make_huge_pte(vma, &folio->page, ((vma->vm_flags & VM_WRITE) && (vma->vm_flags & VM_SHARED))); /* * If this pte was previously wr-protected, keep it wr-protected even @@ -5923,20 +5924,20 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, hugetlb_count_add(pages_per_huge_page(h), mm); if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { /* Optimization, do the COW without a second fault */ - ret = hugetlb_wp(mm, vma, address, ptep, flags, page, ptl); + ret = hugetlb_wp(mm, vma, address, ptep, flags, &folio->page, ptl); } spin_unlock(ptl); /* - * Only set HPageMigratable in newly allocated pages. Existing pages - * found in the pagecache may not have HPageMigratableset if they have + * Only set hugetlb_migratable in newly allocated pages. Existing pages + * found in the pagecache may not have hugetlb_migratable if they have * been isolated for migration. */ - if (new_page) - SetHPageMigratable(page); + if (new_folio) + folio_set_hugetlb_migratable(folio); - unlock_page(page); + folio_unlock(folio); out: hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -5945,11 +5946,11 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, backout: spin_unlock(ptl); backout_unlocked: - if (new_page && !new_pagecache_page) - restore_reserve_on_error(h, vma, haddr, page); + if (new_folio && !new_pagecache_folio) + restore_reserve_on_error(h, vma, haddr, &folio->page); - unlock_page(page); - put_page(page); + folio_unlock(folio); + folio_put(folio); goto out; } @@ -6173,16 +6174,16 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, pte_t _dst_pte; spinlock_t *ptl; int ret = -ENOMEM; - struct page *page; + struct folio *folio; int writable; - bool page_in_pagecache = false; + bool folio_in_pagecache = false; if (is_continue) { ret = -EFAULT; - page = find_lock_page(mapping, idx); - if (!page) + folio = filemap_lock_folio(mapping, idx); + if (!folio) goto out; - page_in_pagecache = true; + folio_in_pagecache = true; } else if (!*pagep) { /* If a page already exists, then it's UFFDIO_COPY for * a non-missing case. Return -EEXIST. @@ -6193,34 +6194,34 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, goto out; } - page = alloc_huge_page(dst_vma, dst_addr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(dst_vma, dst_addr, 0); + if (IS_ERR(folio)) { ret = -ENOMEM; goto out; } - ret = copy_huge_page_from_user(page, + ret = copy_huge_page_from_user(&folio->page, (const void __user *) src_addr, pages_per_huge_page(h), false); /* fallback to copy_from_user outside mmap_lock */ if (unlikely(ret)) { ret = -ENOENT; - /* Free the allocated page which may have + /* Free the allocated folio which may have * consumed a reservation. */ - restore_reserve_on_error(h, dst_vma, dst_addr, page); - put_page(page); + restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + folio_put(folio); - /* Allocate a temporary page to hold the copied + /* Allocate a temporary folio to hold the copied * contents. */ - page = alloc_huge_page_vma(h, dst_vma, dst_addr); - if (!page) { + folio = alloc_hugetlb_folio_vma(h, dst_vma, dst_addr); + if (!folio) { ret = -ENOMEM; goto out; } - *pagep = page; + *pagep = &folio->page; /* Set the outparam pagep and return to the caller to * copy the contents outside the lock. Don't free the * page. @@ -6236,25 +6237,25 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, goto out; } - page = alloc_huge_page(dst_vma, dst_addr, 0); - if (IS_ERR(page)) { + folio = alloc_hugetlb_folio(dst_vma, dst_addr, 0); + if (IS_ERR(folio)) { put_page(*pagep); ret = -ENOMEM; *pagep = NULL; goto out; } - copy_user_huge_page(page, *pagep, dst_addr, dst_vma, + copy_user_huge_page(&folio->page, *pagep, dst_addr, dst_vma, pages_per_huge_page(h)); put_page(*pagep); *pagep = NULL; } /* - * The memory barrier inside __SetPageUptodate makes sure that + * The memory barrier inside __folio_mark_uptodate makes sure that * preceding stores to the page contents become visible before * the set_pte_at() write. */ - __SetPageUptodate(page); + __folio_mark_uptodate(folio); /* Add shared, newly allocated pages to the page cache. */ if (vm_shared && !is_continue) { @@ -6269,16 +6270,16 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, * hugetlb_fault_mutex_table that here must be hold by * the caller. */ - ret = hugetlb_add_to_page_cache(page, mapping, idx); + ret = hugetlb_add_to_page_cache(&folio->page, mapping, idx); if (ret) goto out_release_nounlock; - page_in_pagecache = true; + folio_in_pagecache = true; } ptl = huge_pte_lock(h, dst_mm, dst_pte); ret = -EIO; - if (PageHWPoison(page)) + if (folio_test_hwpoison(folio)) goto out_release_unlock; /* @@ -6290,10 +6291,10 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, if (!huge_pte_none_mostly(huge_ptep_get(dst_pte))) goto out_release_unlock; - if (page_in_pagecache) - page_dup_file_rmap(page, true); + if (folio_in_pagecache) + page_dup_file_rmap(&folio->page, true); else - hugepage_add_new_anon_rmap(page, dst_vma, dst_addr); + hugepage_add_new_anon_rmap(folio, dst_vma, dst_addr); /* * For either: (1) CONTINUE on a non-shared VMA, or (2) UFFDIO_COPY @@ -6304,7 +6305,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, else writable = dst_vma->vm_flags & VM_WRITE; - _dst_pte = make_huge_pte(dst_vma, page, writable); + _dst_pte = make_huge_pte(dst_vma, &folio->page, writable); /* * Always mark UFFDIO_COPY page dirty; note that this may not be * extremely important for hugetlbfs for now since swapping is not @@ -6326,20 +6327,20 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, spin_unlock(ptl); if (!is_continue) - SetHPageMigratable(page); + folio_set_hugetlb_migratable(folio); if (vm_shared || is_continue) - unlock_page(page); + folio_unlock(folio); ret = 0; out: return ret; out_release_unlock: spin_unlock(ptl); if (vm_shared || is_continue) - unlock_page(page); + folio_unlock(folio); out_release_nounlock: - if (!page_in_pagecache) - restore_reserve_on_error(h, dst_vma, dst_addr, page); - put_page(page); + if (!folio_in_pagecache) + restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + folio_put(folio); goto out; } #endif /* CONFIG_USERFAULTFD */ @@ -6871,7 +6872,7 @@ bool hugetlb_reserve_pages(struct inode *inode, /* * pages in this range were added to the reserve * map between region_chg and region_add. This - * indicates a race with alloc_huge_page. Adjust + * indicates a race with alloc_hugetlb_folio. Adjust * the subpool and reserve counts modified above * based on the difference. */ diff --git a/mm/mempolicy.c b/mm/mempolicy.c index fd99d303e34f..945b41c245a5 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1218,9 +1218,11 @@ static struct page *new_page(struct page *page, unsigned long start) break; } - if (folio_test_hugetlb(src)) - return alloc_huge_page_vma(page_hstate(&src->page), + if (folio_test_hugetlb(src)) { + dst = alloc_hugetlb_folio_vma(folio_hstate(src), vma, address); + return &dst->page; + } if (folio_test_large(src)) gfp = GFP_TRANSHUGE; diff --git a/mm/rmap.c b/mm/rmap.c index 948ca17a96ad..e6d94bd19879 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -2547,15 +2547,13 @@ void hugepage_add_anon_rmap(struct page *page, struct vm_area_struct *vma, !!(flags & RMAP_EXCLUSIVE)); } -void hugepage_add_new_anon_rmap(struct page *page, +void hugepage_add_new_anon_rmap(struct folio *folio, struct vm_area_struct *vma, unsigned long address) { - struct folio *folio = page_folio(page); - BUG_ON(address < vma->vm_start || address >= vma->vm_end); /* increment count (starts at -1) */ atomic_set(&folio->_entire_mapcount, 0); folio_clear_hugetlb_restore_reserve(folio); - __page_set_anon_rmap(folio, page, vma, address, 1); + __page_set_anon_rmap(folio, &folio->page, vma, address, 1); } #endif /* CONFIG_HUGETLB_PAGE */ From patchwork Wed Jan 25 17:05:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A37E0C54EAA for ; Wed, 25 Jan 2023 17:06:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 468956B007D; Wed, 25 Jan 2023 12:06:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4186C6B007E; Wed, 25 Jan 2023 12:06:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26BE16B0080; Wed, 25 Jan 2023 12:06:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 14AA06B007D for ; Wed, 25 Jan 2023 12:06:21 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id CE6E316058E for ; Wed, 25 Jan 2023 17:06:20 +0000 (UTC) X-FDA: 80393949720.24.17F6E48 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 7DA8640024 for ; Wed, 25 Jan 2023 17:06:17 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RFB+VXA2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tK+jg2s1; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666377; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=E0hRKxyLXb8+hLOd40j3DCxw8rwGAk9ilTdBouGc32lRmHMlLRRbeOzTy1EqTDQW6uD0Z7 SCWEKVvonOFcbCA/tZN+Z58FXNsS7z8FMZf3o59OOjzaYfLF7dxKuadAi2zO0vItcsZEZ7 pOiVgl72m7G6gx8xaLFfBErg/F388Q8= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RFB+VXA2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=tK+jg2s1; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666377; a=rsa-sha256; cv=pass; b=YQti6cm5/CY1fmVY+CuZbTS2ZqoWyZWYD+WzFGKQaQ8Y9tBwX4aCOqRuLZN3Dtdc4HbE40 PiOElBkWHCjvgLmXSL4gmTSBb2Kcs/iOlo4kM8qZguo+/BL41nlcVmHlortRZVKI04KmSy usKqNs89ImXTumkZ0d5qM1EKt6yMEyU= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNjsp009509; Wed, 25 Jan 2023 17:06:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=RFB+VXA2TsBgvars8j57xB7M/yosiF6dfuqWEakeOamZW54xJtSbdQb2O2g3F9BPQrsg BHniVwWuCtfD2oKOdbt46/oX0Lm5bBCzKldQONtj+1KZUrLqzyrFA7bEoSoRjuzHdKUl R/Aj84s5mwV37eVAbzGCJ7CapWJdj4rB5nH5FFTP4/kQpfTbi4nyJ0FJbR6B+DsHSf4E T5VkDgTlkBl55HiiCzA5Y11RMA6V6+kOHCtuKp6YvtwOwoiUwLRbiILZfqcB2OGtP/uZ ymjJbuGufnkQKZzGhcpHdOZBqLCKMTawXnCmyQu4jIP7Wd0iTLgVVenxPorYvdyZsbpO Vw== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c8jex-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:04 +0000 Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGHiCQ031875; Wed, 25 Jan 2023 17:06:03 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2102.outbound.protection.outlook.com [104.47.58.102]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6t5av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RozPcP14nkaIIKntLEpVvR0NbZwE65Q8KmLqpe7FzHlGi1JEuLmNCTphRoMPHtP8E/yIU7vJNVJxklPjTkxaqSvNnDoU0rrDQsMiIxgX0s4rdlOKFKi4EK9oIViQNsBoGUxPY2GwQCalaRP/UM7HfRb2daj/B8kTIaUlwTtwN3eWXD/3Xjj9Qtiu/NmVpWhgoX4gmRrqn4TZmpzOmgYYuEEOmF1u2AO3KIvC45HpaGbFgYuaHleCDN2i5OGC3LKIlUO8vjiIfD5nN6UE1un0bAfraE/aG4RuNZZbDSDBT62wLViIgeZMDTV3xtFZb3XA3Lyxf3mx7FN/w5SbKypCHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=IMLwNDIaNL7LL+/yyCwKHi1DpfpsITtXqgOW1HA0HOBhJjOQJOtKMvfW5H/73otEdyVjsK6cnKa12FooMdM3axqO/adBxMEymuboIRR1IEQ1AfZJhUjPWxEFoRfQU9/37UxSjrMPcaM1rXUNRwTVGkHR93FzteYDPunYKyKDEt5kx5WtF4I09EZ9MNC6IF372nZ7aZgh3SJ/OBdz1IwvYT8+iEaGVgeSSz7dEs3xw5ScVewVUOV21LDlwDb9ICa7Hjcrl7ajVvjUiH6LbBhKBvMsQ9BaKA196ZMhUHRUjrsTYb/UoXxIdWHzaizV7nLxLejl4n752XNTMwvy65woaA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=z3ea2iaVPYZ70tiYGbEI73RrGrv+fSL+A233vkE/EZc=; b=tK+jg2s1Jy968/mkApRhUKzFSIqRp/4wv47U/4vwPPUV2HBNtQRXXa2CJyA038cA6YEDIF5KdyhtCXpBWzsuQ3tkS4fKBb7moqkEJuKG3TgcuMuoBpWVPuFvIQ2BFxWYdmaUbiOhyGDgSkglk4SOsHjHXVu+Qn89lhVwbTKRntk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:00 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:00 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 5/8] mm/hugetlb: convert restore_reserve_on_error to take in a folio Date: Wed, 25 Jan 2023 09:05:34 -0800 Message-Id: <20230125170537.96973-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0113.namprd03.prod.outlook.com (2603:10b6:a03:333::28) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: edb7cb53-3212-483b-b3ec-08dafef66efb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VoFzedH55IxCXfs994+vmKyLkCt/LlDNMQLY3tBZtJLSdUZPcp2x3O/TRH/28jq4ZpywmFHA2lCdK4Z9LXjL2KfYQ3XkMwLHHNkeKPIKelE9TOCC3GVOHQPmNEOcr6xsV7ZT7ehpbRlsCT/Vc0G+AOFN4Yolh0Gz1zuQZetM/6iXSCp9kdJmRjDAI2L8ZYkZAEH09tkQtQAnj9MzwC6duB4pltWubslUgt8g/5r8ukVyrm2a3LF/0V8ahRmmIPFoVbwIONx6SeFv3LcEV/RDHydPfeRAxeoG0fpmZ7JcwRxAbQPmJDpwOJ2E7FeoTdlnAMgYzdSuJkJMyBlfQFYnEpPOQ8boAiAao77COphlJ+2LkSU5oWMKAg2NBQq4NFKrQgn7i0fBs2s2ckEIGpZeD4Oxbb95RPb19ABFI7uyC8FbBAgYroDunMCVH8Yd5BrhdCVoSe3SX/LWkb8tc6IwgbfJ3NJWE1HiAXT9IxZPCB7PLwLs0XCv1a13+hzP7b3Qj/EIuyc9ybHymHr/iW96n0CBZiS8poBE7VmnA0qhCh7gunY8jmg8NsuR/bW7AgbGxcQMgz75yZZXeXvnKyuZeI6/uqBOSxJ4HTtn9HAIvSbl83ubfuo3P0ojE22/n1kwfozK/Z+4ZupiCbKDx6HWBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YPhLAf4DVUj1h4TmYkHSr8/shIEAgSHcEffxPtTP9ON5EHyGB7Id81zmPj9XBYVgb6AeBqj5qU/L9i/P9Bhwotn2UyxWOLDvgECPKg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lVaJ6fsz9vNLR5Ch5N2o2fTaREW+PR+ds0dKtwU625WmtTzwBvdDROFe29ROVBLPNrLu2QccjHqN0tt668t1aEtYALjCnmIKutQj2+XtC1w49wxv1lwA80BpFRVEQdq0MbUeI2ElKGW8m9N8eZAy+tvbT6mNkdWwGZf0f9EJpSO9jET/zr6Yvq6zk3+x4rQ8usiFZ/igEeqVACoak4hOAzetsvU/GnyFUT6TouvXC4PeQc5WdmAB/dYms6O/Uioh0CgGLk0j64KiZmwPcexUfLIL5PDMPSMOGyJ67gRxz8ShrWDZmbZaJ7tYdptOCiQJlSP8l6Dx6cpWXJz6OZHfBRopqoCRAUPPRMvS8uXlPfCCMwEvOq7Kk5BGyaN7OTuQWKX2f+nqq6n9LopGwrlDiJMPFmXU9UYRwePrwzL2sGC8I69fIXZ+8wBWf8QXvSwh1b4rbmr8k= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: edb7cb53-3212-483b-b3ec-08dafef66efb X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:00.7182 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9dUMvuj/ypICxdDliAPL+YEwgD0PWkwBOT++nF7AQQ4wz8NKVXv4xhft90E41J3eK2/2rZUmB19M7pTIBNrfrX40YeE1GHjtVwV16nUF6gY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: SVNEP9c7uXmuU6nQBfSepqD9lZtyfC34 X-Proofpoint-GUID: SVNEP9c7uXmuU6nQBfSepqD9lZtyfC34 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 7DA8640024 X-Rspam-User: X-Stat-Signature: 639jk51ni9udc9t74jr1b6kuqd1pjbyz X-HE-Tag: 1674666377-126017 X-HE-Meta: U2FsdGVkX18GRqvfYLQ/tgkKYCp6owXGgwKWUGkH4LxRuZ7an4S707OLuxVlS+ARMPs4vEa8gAhwxj/jMfOsLOQpKZDDJWeBiutbDuuUIKD0k0jBMbwWDtQi/NgIw8By7iHp6G+MljLRi2WutkRLJymPGmxhHYTpzQMOfq1+rPfE2aLJL2txbhV5nkhieieNR4KnbCbFXz9+wkMUcetQvb4tjazdz4FNrkF57tMBqbzPWi4dPsoP9gmqM2LGUiQZeFF/d33cn8+5Hffip8MSU79iMnRHhZnwEnl3Ay9ZOpC/Usmh58oQp6cI65h7bckVZSXSD7p0Q3ebUlEAD657TTwni/7lb3XNldVp0++Y0GMzQSEDxeM7HhhQX3/ObrJ4OQknTZWBOv+LV1SohZ1TXWvBkLsnl/Rt6LJ8YKaXC0m2eXWXG2XMLT3ILRHZCjMf1ElK/wlIZV1VQGqT4o1GJRKrWEhtkUIsvVcUk+56wOA3s/0ij50yTliPN+qWDVnRJaJGby2NZ3VbZdKAPwehz+98Nxqsrj4RXJ0tJUOOng05qxEbUIYK+YvyUFnqJInPyHnxG3goyyeAy9YRYWWelZbPiny5KeoINdHyofHrTavCFtKPvIXoPYhYjHNvYNHRb+1URimslLDX1BAIwHdoxn2uBm2MQaz8ZmPTVMLOoEEOvEaelaOP609JhaMXvBIRcD6utNuZkaO3mihmvl9zTx1H3Ky+GXMUTMzBa0BTW5lelJPnitF6qDJqyO610cjRbkJdGWX4gKINnAmLEsxfbXvSKhngjgLMd3AwJNfG62VMOqnyWJpBNproHKpWUVKI02+n/WFL3Per6VeVy/Y66qnx1iFLufQGDEVSp3Lt4kht2Ql8Sed9Vwt9F0eCmKRhLGvutabr1pImmzNds7ZMIxo9Rk+Og8PQ7tR4Gga/Hz8gDlW2bFqNsYXt6Xh1D+05bf0rG47dcfHcgElU6op sQZlibXJ gFV6ivMB5Zd0Cd5sJux6LW8XQfIEZtlbQr3FjxEFUEL5NPNjloaYtPbcwq4oz5aoAJbYpPcjLfFm3ZaSFZb1SERCFIM7CPcnMIK58tJSfyBB1v8QEV+sFEmijgfApiH11etW4zfrABV2dBfBnOZgCxGB82M64+5kWIEPSG0fXsVH2cS1noqsRIKRhp72RT2IO3NLrJUJ15xqcXX7I1TWtgBzhnD7SFD4SwCpfg/oO8nv4cHJX33NOqlxRKaOxtzuyh4yaiUtCU3XDwJfXMJ0XTKDE+lsKYzmD+8av+SuPGiAH8HZdZrpNYpUdmaT68rKOiAMEgSNIsDMj+X8O+R1iv8NSNutAsL+dKuYI/wQ5EgKRJV+L6Bwy2MhrM9cj/FEqCoj/qhLdySIeEUZsa0Z+Myv3OmId5Kn/Dp0VYmReH0LcY/MLcslw1ra90Ro/wjUHHosS X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Every caller of restore_reserve_on_error() is now passing in &folio->page, change the function to take in a folio directly and clean up the call sites. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 2 +- include/linux/hugetlb.h | 2 +- mm/hugetlb.c | 21 ++++++++++----------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ac16ada48f75..e2b8a00696bd 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -873,7 +873,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, __folio_mark_uptodate(folio); error = hugetlb_add_to_page_cache(&folio->page, mapping, index); if (unlikely(error)) { - restore_reserve_on_error(h, &pseudo_vma, addr, &folio->page); + restore_reserve_on_error(h, &pseudo_vma, addr, folio); folio_put(folio); mutex_unlock(&hugetlb_fault_mutex_table[hash]); goto out; diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f6849e67ffef..d46f9db09a2c 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -725,7 +725,7 @@ struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *v int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, pgoff_t idx); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, - unsigned long address, struct page *page); + unsigned long address, struct folio *folio); /* arch callback */ int __init __alloc_bootmem_huge_page(struct hstate *h, int nid); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e104dba1e5ea..aad028706fbc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2802,9 +2802,9 @@ static long vma_del_reservation(struct hstate *h, * and the hugetlb mutex should remain held when calling this routine. * * It handles two specific cases: - * 1) A reservation was in place and the page consumed the reservation. - * HPageRestoreReserve is set in the page. - * 2) No reservation was in place for the page, so HPageRestoreReserve is + * 1) A reservation was in place and the folio consumed the reservation. + * hugetlb_restore_reserve is set in the folio. + * 2) No reservation was in place for the page, so hugetlb_restore_reserve is * not set. However, alloc_hugetlb_folio always updates the reserve map. * * In case 1, free_huge_page later in the error path will increment the @@ -2817,9 +2817,8 @@ static long vma_del_reservation(struct hstate *h, * In case 2, simply undo reserve map modifications done by alloc_hugetlb_folio. */ void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, - unsigned long address, struct page *page) + unsigned long address, struct folio *folio) { - struct folio *folio = page_folio(page); long rc = vma_needs_reservation(h, vma, address); if (folio_test_hugetlb_restore_reserve(folio)) { @@ -5102,7 +5101,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, entry = huge_ptep_get(src_pte); if (!pte_same(src_pte_old, entry)) { restore_reserve_on_error(h, dst_vma, addr, - &new_folio->page); + new_folio); folio_put(new_folio); /* huge_ptep of dst_pte won't change as in child */ goto again; @@ -5634,7 +5633,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * unshare) */ if (new_folio != page_folio(old_page)) - restore_reserve_on_error(h, vma, haddr, &new_folio->page); + restore_reserve_on_error(h, vma, haddr, new_folio); folio_put(new_folio); out_release_old: put_page(old_page); @@ -5846,7 +5845,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, * to the page cache. So it's safe to call * restore_reserve_on_error() here. */ - restore_reserve_on_error(h, vma, haddr, &folio->page); + restore_reserve_on_error(h, vma, haddr, folio); folio_put(folio); goto out; } @@ -5947,7 +5946,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, spin_unlock(ptl); backout_unlocked: if (new_folio && !new_pagecache_folio) - restore_reserve_on_error(h, vma, haddr, &folio->page); + restore_reserve_on_error(h, vma, haddr, folio); folio_unlock(folio); folio_put(folio); @@ -6210,7 +6209,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, /* Free the allocated folio which may have * consumed a reservation. */ - restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + restore_reserve_on_error(h, dst_vma, dst_addr, folio); folio_put(folio); /* Allocate a temporary folio to hold the copied @@ -6339,7 +6338,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, folio_unlock(folio); out_release_nounlock: if (!folio_in_pagecache) - restore_reserve_on_error(h, dst_vma, dst_addr, &folio->page); + restore_reserve_on_error(h, dst_vma, dst_addr, folio); folio_put(folio); goto out; } From patchwork Wed Jan 25 17:05:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115872 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37503C54E94 for ; Wed, 25 Jan 2023 17:06:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C59816B007E; Wed, 25 Jan 2023 12:06:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C2F1D6B0080; Wed, 25 Jan 2023 12:06:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5ACC6B0081; Wed, 25 Jan 2023 12:06:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9508D6B007E for ; Wed, 25 Jan 2023 12:06:22 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 72D2FC0E0C for ; Wed, 25 Jan 2023 17:06:22 +0000 (UTC) X-FDA: 80393949804.02.24C1809 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf05.hostedemail.com (Postfix) with ESMTP id 2818D10001E for ; Wed, 25 Jan 2023 17:06:18 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=jKNrmtvh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MPejZRHM; spf=pass (imf05.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666379; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=o4yIO5ZhBq2tzkgua1gqF85VFkDpi9iuj+lE1zNBuT+ofHRlK9rhv6M+Y4stcXDPwflJfJ JJ6kMLb/WpCiGiJaiR/QeiDN8UW0fyViNgYU9Esd7VexgG/ZPtkJVSn7TbhWrJ8jLMzzZm tRLRWpmTGz1f0DZFzYjB0qI/XOzTngs= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=jKNrmtvh; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MPejZRHM; spf=pass (imf05.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666379; a=rsa-sha256; cv=pass; b=y/FKVGLkeoKvtObGZCJdF5LWcQAjkRos17LPjIWkSC0vKEGF7dgeavxtYhTht12CKz7zfG Rb3VqTGroT4uAogXJJn0VNRJLcDkMFj+WkVURQ9hC8GQhJ/+cK+UjWx5UP/SbxyuonDHr9 fQVy7XnXVbOjRIwfD7U/6ayFfb6sEVM= Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNnjV019596; Wed, 25 Jan 2023 17:06:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=jKNrmtvhKI9pKSkYgsTxuCi0xNesODe9k/r5RxlwbYpjnSg6gFkv5IvvIKdgccKN/2NO xiAWGkghNrpuw6ZS021KRlhdzMRzzxfOO19kLQ4bbWbmxGi4Zjd5Bks2RsrXgtUgxxs9 RwS2Fhcn7YzJ3BNQvpd9DtVwba5erh+z7hFf2EsVRg7dzb3c+gXYph3EWAlrGH6R5tD4 PkxOB/xsWTEMJ5WZDRoYNsaD2mayhdLWsOvr+IXNnRjIhQgaP9PCRV2cTkpiEHiVnfTa Z+DKoy3U9YymrBsQ+ksWWXgve6UkldRWEXAYQGJTpBC5L9ySojct381wB/TNEDojS3fV yg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n87nt8h0c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:06 +0000 Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGIZOT034260; Wed, 25 Jan 2023 17:06:05 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g6tt0w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:05 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=D5MNpyII+s/ltFr/s1HrgfmZJfmFFdkx2sDc+9a7LFlTnQDmM2JHWTb7gyseSyiN5xS+88sThKfFq069vkbYQzvlOoJFlqzl1wpe0cOUjvlJW47vQkgrsLM6SSDwTJdac9Md0lDgB7/gCpmOkAwIBMzzvLQmUbdMl3jA/VX8pIfLM7o7rBFvUF9n1IrL5lVydoDnQVbvPZZqQfriwmYAXDYsMzx1SZGo7BpkA5QibCHL72K0tJ+lBV2yVWWDYE3Z/q0CMTquB84mCEWE1vIak/IRWlrTg+ZIDFs8sEBuOPiDFMenHCPV5q5ROgxCsJ5Z9Tz1wxeeB8Bf1/sDez8rZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=NnkPzP3wCrWDPHKji0X39vgjJ5iP2rsuz94o+UlWgNK8RfOQrraCjcz3Dn//Vr2gL6FpuElnKfisuCZCm4RWtWoLr3FDl8+SvrZMsUdL1tjIHjTaVqJVRlJzVSD1VGGYreBlkDe18D3TcwJp5rISzeIidAnbglQeETyoJ3sNRhoTOWk+FqDlQdM/pACX70pySPZ1xTg1Wni/nFJ3EcTY8N/ZD9R3ZkAL0e0DQmlZ+++GlkmwZkAaCxcib0uOtY4VEpohUcJXFAiXqi/kMxj35RJ15daLHKfnVoDn51p7hVNHfV2+ZGvRbD3fxLfx1NVZOro8nnmVhs7SgH4mRYAi7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=yI79RGV+JS852MP4/0cLY/XB9AbILbilppgbzvJIoaQ=; b=MPejZRHMcHGsFAgFuv1iDzz6j4Y2hssnv8GuF3DR+Zr3Zl+okokegFy2DKp469VeITyeH7Q8+ZxdlYyhCpCcCpsWhaFLaBxuLmww2+niTgZTlJuV5e3+xTmyoktMs4moCnYYJ77V+oesyHIx/uDdaE0OuaHBCqCZhLh1hz0yBrY= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:03 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:03 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 6/8] mm/hugetlb: convert hugetlb_add_to_page_cache to take in a folio Date: Wed, 25 Jan 2023 09:05:35 -0800 Message-Id: <20230125170537.96973-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0108.namprd03.prod.outlook.com (2603:10b6:a03:333::23) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 4a4fcd86-f47e-4e5c-db2c-08dafef67071 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: IswZdBojMPHUO85Amz2DGUexXSkBxWHzKoiQ8k7hUucsfb4YNXeed48L9tczlFOpyRBL6h5TH4LmAA0VGJJoaBhCYo6XnV80GPDOreAckmaThj8XsRGSU2RdUykQQ+WwO+LJOyqcI97ErMIQPKYpwOSr8aGGPQ8a1DGKcm0ZfkG731beU1HsWfMdgCSPBrhBgmW6UpUlCB4outZxUpLcTGQ4jDk13rZeLf3YH/U5JdAbHUEavqKRtofv9dLGG7/ch2Y7xHTz0rGkkPyvBl1EpN2M5ou9RFX6cM85TQJlECEqv0MoU9aMP7Ogsxa+cU3I5HMmAbVll+pEcmxWyrg6VwFSQkMO5thu5J1w2i6kD20iSDoTwFwFZYL7tk8Tv9O3tPq8Eii+LJjd5JWE+QhWHGb8B3y0VlZizhbDh5yGZ++5+LsZXUd50jwjQ+RrV4OOYZqYseiQtAmiK5/B6AIiT5WBI89jAZPQHo5kB4Fktjvn0prGO/TR15h0ZyQ51cNuyKGM1pHdfQ16rnVy/NaUEIL66ZmWNA5zJemNHoC1u0YaIpKmIaZRgIyXAKQ6AEhSomYl5sRBKY/8voWUkk0kQVqNp8ovlP57ersH+PCnSrh947QEoUZzBkvBw8sqR9yFXYE2yqNGazk/KEjIopYaUA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B2PoJU9SE3Qr1u4O3T0zCWsoThdBIpG8x2cXsHNa5tE0btTyiYYU6YFx4uuGhdseCNc1teInjq2IL6dG6gK/kadvDQuKxLsNEL1hwHIRCvJyEvxaeJLgaMS6ROe1OyhQah55EHqls8AdVTNo1JgWSwnbKILPvRMlaLKVANmlb27q6rghe+WBKO+9MIk58EPLe+p5pD6Bo7pCMlRkl5Trb4t/q6F0g4HSeqKXkwBCvABxyeL6/T1MdOpfwmyodf6UJpf9wLy/4amCaw7673yyHxd8DTixrBSvDkk+95T8ot6K/5Vsli2I7KTr+vS5cavqc1ghoYDEJ+wv/PTo+vuVrt+0qNwzXlNRutGj2nMuyzizafS14l9uRARo36a/lJilKLeNRu+H9LmYZyyVggErto5Clxvesj4uf/Ddf9Un1Nmpc/I3It3QjSeh3DEcWVbmRWFz6+DhGfvPduQQmqjkBhj/GNrWBv67U81OCoz5cj/GtJSjvX13dZWZAVD/k7uU5YXMQEAdmb/rcyRhY/J3GrCezcPDU3Dk5S2KgY9M1jUevzAhpcsYOnc/aTykjA0ol34Anux5BQOt1G/KnVuASUH4D9ExJnXn6aVNbNbQErPcN9vIvEfKsbFBTV5m1nR4psJhLQJgR6qzAd0pbJOyzr7T1iKzJYtlsW//GiXwWt93fP/y27e2yMLZCEMTD2n/yxnjGyjgcoMdQlnHnrxEmQ8IYBQKX2oF9SQsYBmKIQhWZ+g883d1e9JgKED0XbK9u2IJWnVBvtiRW2V6WBykOhXFEu6aNinVZWG057QqUWwgoXc18r8JSotarJY+H6Ha50cwHnsGYPenzoPtb1ARSecNPagcMocpHLnALxQVwquphzOJmPedgEk0cNO8/z6Cji1YypjP5jWiyMPJS9HmtcZyahNnkep5wYqFIQJMgptxV7v4/bPWGnnlAVg8Cj12nfz2jdbiiBqZ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UHz1oFtb5YXGQtJakNAHgoW6oKdTDPmABZmDFc7zVDYu93RoMWRkped5q3rcThT+Xi5Bogoxz04LiIXvXD/8VwzM2D2DTUgunnGOAJ5E71GijET3EffvlkILtjz6m1GuvAUuz6GEuToJ9E8XFcE/s8E76KwALomwR5XvCLUfTGRtAK9IKOczjOjx1HnN3SeGuMsuw2HbBAulQriDAoOVpqO+aX6JcdeL+FAU7VXc5vkC6h5sR2AEE3dYq5ZoDYp1JsiNcYz34/MHQJkv25VW07Eluac7j1AFRaXvt44AhLoKSymbmYXAYeSLvQ89fl3WbnEw5XxuP85ScYitlWTFfcm4yyfS9DCLITW4KNTXrc9/QcWd07e2ZooCjbpe0mShBVqOl9QOaoQpmekz9+bZojWzp9uQ8UVS+plkyF3CMiLz0/4c6lHEhZ9HeVK4CF3dCpyLYWZfzYIbCU8gCMyCPb4GPGUWLfMFSY4Jb5iUsdRNCeao0SL6hcWvqWXnn6ufWHfgd94h0FbJdda7kUfsjIR67UyziDW6pvMtMVS7EBA2Lrcm5LotQgiC5zFN/besDqwXbMNMhKqsUbD2Subkzo/4itJMInJrOodKVgPpj5FJbleGxcnjEC5/KKtgHCSV/Zb0gPaAn+Ant48ZA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4a4fcd86-f47e-4e5c-db2c-08dafef67071 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:03.0140 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aE56grQRDHRXpa6Xwrl5wO5nzw3F5cx1AbVCx5p7LvRXX0fC40tpDhiNrNyU4oU4AWGuuZplhZudFvOnxuUu5d/tI98kQScCErdOv1KMdDs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 malwarescore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: KWx5RzlD4IJLLaHM_g8T15HAtQArYb4I X-Proofpoint-GUID: KWx5RzlD4IJLLaHM_g8T15HAtQArYb4I X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 2818D10001E X-Stat-Signature: bqb86x5jxa35tx4xpm4n6pi7fxkywi43 X-HE-Tag: 1674666378-9083 X-HE-Meta: U2FsdGVkX19ReVxpIFaAIr/M9hE1sdDYSOXxf73U3KuorAg4fUONFoa+bnBqTfn9YckOHIypGiv+/JxKVddXcE5q3xq9eaPqVETthqlfN0/RxOuLDrmo8UAPYr2FOi44h+OOPOHtNKeJ0neaNrpEFLg3HGgkF2O+y2ELkXYnd7VOfRCX182MHpGyoXoDgOHvOQvBd7Soxf0vzH0hPPY8a+3CTfpL/yAA2D73b1S7dpnG/uCNlYMX6UqyxsQRIRoiTgTUlBsx/jM7h4iRTCrYmfLNNHdYHeXtvqUbnlhiDN/h8qxXHyWgoh8CjfgDi7qS1tbiHWpHqDxO2A90DCJaNlM9KfZVIbUSwNBugntk92nB/ex2P4zsO5BRpYV35zwbjBCso0V77as7lSB8m/L4QMvwvEOywY9YeOF7oqlW86d+6iLlyQ0JCi9mTZ6au/+SF8QeVyDXVIVEhCD1Rn55b39yDUuyuvWQjypNygQT6hzlrZo5dc5DnkUMMvW9AqrUVeK45W0e2hz4AcWAtgCq+K2h/DkQGcqcf6zJd2F+3lJe08l6exFzPqQky+w+Oqw6ofw1MbfZTuPHCEz1IXXMRY+sV10E0wtA2q9gqLSW0wPi3CN6xm8XBdOKLVfgCbcAWOP5OZGqJgdbtYKRXw4urM6k7UIn8oeOfXvOfvAcZBzBR7k9pWnLEXsJv+Zln2UkFx0CDpVzM8wmF4BfXpGTjQ38T2DIxwaE757XvdF4T3qW6QDve1RGuXwJFm5Q1u4xtRGNE44DdEIp2S8zj4ZA1POUU0NnPjO0ce0bSF/TLQmXoBL7UuXhmCp2zcN4rWU40Eu3g9zNULONlLl0U+8cHwm2/geOsNFtrVTHaHWVluaGRTJsyweFxjFI836m1/+ND9RSFNdylDEkR5ifAyFhCjR0jCymY53zqLZiIpTMNrDthNEblNI+eNElEwYFGAfEvWvedtXQF/HQizuFeSD tG15nY2K sBsPNLVsUxxVzZuIIqe0aTvZlVMcllPzDYcJ7GNvY09G2yOD+GlB+q3bHm/IkS2Uqqa9pvw1WqF1K/4W9Ab4MGDmPEKvMsgUuY7UsMGsbURQJFteID98q3CFQayHXQatigdNh4f98lu3KhbX706fctCU+nuEFSi2hX4jDGKhK7h2of8y5Hezp25pCq/b189ZM6MObG6vMUNyfWfFZvxlzKqA9p6RfxecUyDvlI8aODXoZrtNZ/phSkdfgaW0edCTCynfLzf4xYUjz/lzHePeR3dLDtgCZFEB3AzQsTnPJhmEudzM2tszXHCREH0EM6uLwZhCnW58OvVNF4Def2AvlhPObZS4pr2dXL+IcLFThKDGC7ElJc/XYQwwhGtw6b3KNWb+qVKTsLdnlqQGGDFsVLUYGaC2usyHAQgT5TLODkNpZHIkomDEDefWZtg6keZqGq7V/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Every caller of hugetlb_add_to_page_cache() is now passing in &folio->page, change the function to take in a folio directly and clean up the call sites. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 2 +- include/linux/hugetlb.h | 2 +- mm/hugetlb.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index e2b8a00696bd..43af1753de5f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -871,7 +871,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset, } clear_huge_page(&folio->page, addr, pages_per_huge_page(h)); __folio_mark_uptodate(folio); - error = hugetlb_add_to_page_cache(&folio->page, mapping, index); + error = hugetlb_add_to_page_cache(folio, mapping, index); if (unlikely(error)) { restore_reserve_on_error(h, &pseudo_vma, addr, folio); folio_put(folio); diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index d46f9db09a2c..67cf712c97be 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -722,7 +722,7 @@ struct folio *alloc_hugetlb_folio_nodemask(struct hstate *h, int preferred_nid, nodemask_t *nmask, gfp_t gfp_mask); struct folio *alloc_hugetlb_folio_vma(struct hstate *h, struct vm_area_struct *vma, unsigned long address); -int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, +int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, pgoff_t idx); void restore_reserve_on_error(struct hstate *h, struct vm_area_struct *vma, unsigned long address, struct folio *folio); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index aad028706fbc..ab30f8550631 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5662,10 +5662,9 @@ static bool hugetlbfs_pagecache_present(struct hstate *h, return present; } -int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, +int hugetlb_add_to_page_cache(struct folio *folio, struct address_space *mapping, pgoff_t idx) { - struct folio *folio = page_folio(page); struct inode *inode = mapping->host; struct hstate *h = hstate_inode(inode); int err; @@ -5677,7 +5676,7 @@ int hugetlb_add_to_page_cache(struct page *page, struct address_space *mapping, __folio_clear_locked(folio); return err; } - ClearHPageRestoreReserve(page); + folio_clear_hugetlb_restore_reserve(folio); /* * mark folio dirty so that it will not be removed from cache/file @@ -5836,7 +5835,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, new_folio = true; if (vma->vm_flags & VM_MAYSHARE) { - int err = hugetlb_add_to_page_cache(&folio->page, mapping, idx); + int err = hugetlb_add_to_page_cache(folio, mapping, idx); if (err) { /* * err can't be -EEXIST which implies someone @@ -6269,7 +6268,7 @@ int hugetlb_mcopy_atomic_pte(struct mm_struct *dst_mm, * hugetlb_fault_mutex_table that here must be hold by * the caller. */ - ret = hugetlb_add_to_page_cache(&folio->page, mapping, idx); + ret = hugetlb_add_to_page_cache(folio, mapping, idx); if (ret) goto out_release_nounlock; folio_in_pagecache = true; From patchwork Wed Jan 25 17:05:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115874 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18FFEC54E94 for ; Wed, 25 Jan 2023 17:06:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D6BB6B0081; Wed, 25 Jan 2023 12:06:24 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 886F76B0082; Wed, 25 Jan 2023 12:06:24 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C6EA6B0083; Wed, 25 Jan 2023 12:06:24 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4B84E6B0081 for ; Wed, 25 Jan 2023 12:06:24 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 1DCF91A0600 for ; Wed, 25 Jan 2023 17:06:24 +0000 (UTC) X-FDA: 80393949888.16.A1D73BB Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf18.hostedemail.com (Postfix) with ESMTP id 301DE1C001B for ; Wed, 25 Jan 2023 17:06:19 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="qrRs4T+/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oxZeFp7q; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf18.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666380; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=2Urw8JyhtqNpccZCs8LNxNxXQoSPMGgz3yCYXh4h8TKY17hOmGrEPlpDwJCavk2VsDRHgc QqqNjeOYYLrB+puXm5a5w9FRyr4cSLsYGzQyUwISTfCpMyefqWiEYZncTte9iEFY48tE04 r51FhDn8Sw+8UJ3oxRnbdyJDz6oHVYg= ARC-Authentication-Results: i=2; imf18.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="qrRs4T+/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=oxZeFp7q; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf18.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666380; a=rsa-sha256; cv=pass; b=KxVqEu/9uDAFQjbIN3LaPSQf2XrjLxvjbducL+iA/8NdFLy76hMrcISOhrY8DSsdveetz7 sGWyXMEEID0JUgQjEYkr4CDREGf4SmWIRsVxwxd5i89+zpR3Qy7SlDwkHqSO/7wNsQjdm1 iPIQgUqoTj7LYUSbFIICLrvpU2ZvnQU= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFPxlv029537; Wed, 25 Jan 2023 17:06:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=qrRs4T+/nah5RKC3ZXPKGruglhSCbp4MPkpevczlMX7d+xBbNBjxcnFhhpU13k8msE8h x00wX1ycgaMKOSUQg83qGy5WbtTx6tt4Y2G2zyDLJFhRYQG8TNwBiqlv/jhMWo9JNMBw gqJ2xgoYIBdGj34/LqftAOWvBJbLzAik99RsqwacnH8FoihhkRXKaWK/boZ1IOEVWcJb uDjy5n60XoK3dDsJxNEM+okYd8A4PqeyBIG4Z8P0EA5QOyB2M3nhdwPZo0wVeuzDNINi jgixy3nWhWtpSKgz+XD9COm66NS7PlDSTJIieL1YE1DZzEvxOl3cp5M80CRtdWtV1cTh HQ== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n86n10jrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:08 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PG4N3F009387; Wed, 25 Jan 2023 17:06:07 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86g757r4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:06 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EanRIY8s+MJm7mY4NfGK1jfY6Wy+3QfQEqfHJjXu01CRJ7wfdJ0nkDJp+RVLMGaV2YPJ3mp77IuUpwqDBxUSQI1v488w8oYgfF1OxDbFG+y5wP6IEftRYs3cEQVqbU7gCcEwrsl8uuVNhOae4l1dOcYi0MShwm+XAGG8M0JY82pax42Y9XMi+qIXewa4VE+MvjDEKcaAFv1vCVQZqEM1HFPgdPFKT+03qb97RaQ2VHNZz6TgNAxg4OOFlf8x5hmYBAVL2lBpBbnHIPF1MCgv3x8QX+IVLXD/sYhHWxKsYx55ci6tV0zfwyFAS2jyxdRwtujLRO1li5a4+E46kFrWLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=oLTBs3rAtqrLZh0cG9FWdbrJxTBvdTLwaaQJ82AE2cpW+xm+mhEVoJGIERov7V+wgWQyJmD6jO2JfhPiqZRZUuvUECahRYIz6tacKNRKVBco8D0YuH2giCIMeZDAjCuj6eQuDyLGOwOOxdEfb6s4WgjFZX4quqN4YBEqv0zHa+q6DbDwERKDgxprAxNhfxOYQVrCiuHuQkbuxhkbpWVXVpC+J3n9cwXCVpF48taf7hgpZuzZzRS2NTXNGas5cc84r0aQ8LNOy1xGJ3DKz25aI9Hw0aepVt6tYNddOTrTE5LTAuQHHtVsWyiwBNQdD9MY8ueij5ddj3FnPG/yg/VhwA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WtlzYE6hM1ROsmIkU6D5BBeOZTR3jQ1kLi1nmizsNy4=; b=oxZeFp7qZYnhSiLhSuA909YCiD8VqTYOSNFBtsxGwRplwRhaj8/PLBA8B1h9KhigOoNX7rysVwAgPHx8JbLyekEmReGz/3+Fm4OAZuqfY/WQtJRYy4ERMrwrqB97TpA+1I+VWVCxw5kezKOhSMTkaqEerRkmo0aTv8dwiCd0688= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:05 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:05 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 7/8] mm/hugetlb: convert hugetlb_wp() to take in a folio Date: Wed, 25 Jan 2023 09:05:36 -0800 Message-Id: <20230125170537.96973-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0233.namprd03.prod.outlook.com (2603:10b6:a03:39f::28) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 7c7da166-c20b-4d74-a41c-08dafef67199 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RANY4V4l3gzGdxcpIJR8HhpGcu47zOXGBLvYbZsOOx3qt/3oFCmY3jdwbn/ALvk/1w3mt/UCYqHQTq8uYlUEH1VS6defQ1lQYUUpL96xEqU+hbSus/p+5N8Bt4VCiBZ4t3FvtkJ8T7L9yZOvE/sUfCNrH7G+z1OqG3Nll3R1X6fjV64ogIw8jqgZsu4Aicxz0bXWQSG6jksQVXPw/TGJ4d2cOElaKynQVktZjdGDfLCn9rYeSHfkhS4vaRMpsVMyHfhIDRJJir5xheaOo08CsaYn5l4j+BT1pVdpb95S+G2mSu3KAXwh72jojWv11xT48sB3s9XVMDtiJ2RJccEYsIdSBEQLqREcrORltfKuTVeXs+tMNV9D4Unh3d18rpFXQmm/IxsX+zIVYtn4nQB9s5Re+ryW9ekPsQ+ut92kh3UHrUK2FYyDSGf6MYPgdy6qNSbqc25sSq98NLH9RE5XIKqRW+1ZWUxhCkRBicz0uulhsUTcen+Wh9A3CBPYwMvfp3uwvrN42OHhygpfc5hHlC8TcicmYrzmYEg6qxVtCL0KB0DavBhyNS/kiEHGhWUqgylEnA3L8axEp7xgi912kW8SMNnDxHN0Sf7Zi5Bn/RjIkA33mGrhNBO+1N8bw13WKsR2Kx+2XUZG5MmBvKpBiQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(316002)(86362001)(36756003)(66899018);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SgFEj/uxRRUF3FaT1abQeHHo7F+41oc1NhAAiieXOLV1hXnZ2OmOtl/3rwsKgSB5xKwJPJV0pU2XtB4b3F2MV99W4I84N++hpvgFtNVvGybWIieL1ZkfiMVR6+dl5P3xz9s0L75BJUeLMNdf8ie5c1eNbrov1Mza8t+HPD3FtvQywaC7jNF/v/LWMJGQcbW5Rh9SaDWAd2Ly3Y0iffzWJvLd2OZ9hTBijLyHYR1ryzr8XnPpnAgJT7ef0V1yyFHQUV318yZXS5h31PFlDF1iLzOpWRugHO3mG6UlDE7VUP1EwegoD5KC3anAY8ASVtRKhIF28Qq6R/FD0DxjJhfe4hdclGv+NAH7J3t9vzleM2z/CbPXmrFeMnvJ1fA0hdCk9nqR4nu2pRXsT2fnn8JAsHuLZe4jVtnHzfjP9iY4gmTO4n9PhW/Z2n+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Vgo9UXF8q7Yv1EKjMAdhYoW+aNqMTeVg21B0bZdc417lV9sO5FNqL8KihkSMuaIyoTRLJWmNlBKglFMHc/YLdeTtT96BH/LqpvzeiJNA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: T57ne3MA2hxnmDUG6KHUrxiwyAbL1CNNvDx+ejbYauHFhtGkLjNbVYJSwP0IYIJpnTcWJtRQGc1OfzHi50PxmMef3VcR0vM5VDFkSww+drvZYHg6W0tgs/0EiqZhrGU2asHpnOLU+pgwj0zQJofq+a7IzC6+7mbEpRJ1fSv+W7aMJq6gJnPWvhywx33VUkhaG8WN4YIpkBDLVvnSNk9bncjESBMrZS9QgXTkomA7KYLMQl7YQZFlvg/SkQUD6ccnS68aJlmcJktyL+fI1zXdjRl4rz7k6Lr+z9/9PUkKNQ1337cEUTg8pTo7w/F7gYSfkq/T7hCz+l4/jrUO2e4N7q5iB+cDhTA+c5J+Bu7DpA5J6m68nySaAPi35TQKG/2lSzfso8djQz35od213swjdfHts3FYLgcOSf8Snesm3r144N/YScJpf3uc/5IYkjVD9+S7fdJetjMXi+wPbkMcOsgar1iW5LAJWHYt17eWH9lvoCWkaSkQUry1nS81SSRFaXNMzLEBHOuHl8YgU5HKmxAqInsbDYMNVg8/vaNZwXS2zwPhHasjBx+1Zq0kgsHNwoNvPEHSpeTUpybducaVDw0ILwTgqyj+UbNbkw5Q33OtMPOvW3HlaICdM8x+eVSDP08bEFv60uIlBFKTXHdFElGaGG2mtwIAROiEEqwUPly91LpeMMCQA7ZppcumFUUcqqRmwQCIfvEnO/ZGBZt0yfjc1tpgMeIcNk44xWM31civ+wAHZp4/ioRQfTysh+2fJmYaYNLqJUQPzCq7TgDsP4OtkbMUzX71L7mZW+XvVruevtITa5uQ16L/89UA/sRVlRsFgPJY9AT6H1J1Uf6RLshseyIz+/8oiRrkp7Aisbf0r6E3rL20+OID/9rAD6ox1Iqwgj2GJciV5wr3wJOlWZnhzQBllG9y3hfdFbcjrMwKqI5DTYdJ2gOueOgREICWvaQ5p3aYEiwRgadcnckZXGf85ZUD7LfKANO3PkjiPP0= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7c7da166-c20b-4d74-a41c-08dafef67199 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:04.9850 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oGzF/uRCxv0B4b3I7nDeJXnpr/DRe17aYBUEK3O/PCA4UlcHuSPtNgpftEN63psau/WC+Vvz8RIQJTbwxc9YlGE1leNNZWcyEn5jJglTIko= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-GUID: H4MkHNqU6PYG2fkN1Btuektho_ZnFs5T X-Proofpoint-ORIG-GUID: H4MkHNqU6PYG2fkN1Btuektho_ZnFs5T X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 301DE1C001B X-Stat-Signature: f9dbp9xqzr5auoiddfs7oqdn1gygr6on X-HE-Tag: 1674666379-77214 X-HE-Meta: U2FsdGVkX19Zbh0rFA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yWJyty61wOnhrL1YShQC+BZAufh3nFOqwyHfSAUrDfvW+b1oJr764UhqzvuUDd7+2SsTniNj3myTbSkoQ1+EuTYnKEmPFRop5Jo4DRXja6GimGwsrYDpYDe6zdd0OB7nlCevGTuH4CqKPn8m6ZcW1U7LGilvV9OpkEh3JHZYAEvczQeDw/dsZ0FQbx8Mp09CFCED6npKfQItdLahI90kYDu7ydCRr+Y/X/oePBqDMiKIio23p7JlTdePEO7O2+G95OMZ/O+/bElOG5j2feLzAAvH6a3StjsRQFBHlg+u37TJFM6s0VC3JViVYRE5f+vf44hEur6XvoEqWt2hTTIbvzstnMKzhQWwrVBBrWxZDydNOa6gXxcpPBWg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Change the pagecache_page argument of hugetlb_wp to pagecache_folio. Replaces a call to find_lock_page() with filemap_lock_folio(). Signed-off-by: Sidhartha Kumar Reported-by: gerald.schaefer@linux.ibm.com --- mm/hugetlb.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index ab30f8550631..b6cbba105ffc 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -5472,7 +5472,7 @@ static void unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, */ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *ptep, unsigned int flags, - struct page *pagecache_page, spinlock_t *ptl) + struct folio *pagecache_folio, spinlock_t *ptl) { const bool unshare = flags & FAULT_FLAG_UNSHARE; pte_t pte; @@ -5529,7 +5529,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, * of the full address range. */ if (is_vma_resv_set(vma, HPAGE_RESV_OWNER) && - old_page != pagecache_page) + page_folio(old_page) != pagecache_folio) outside_reserve = 1; get_page(old_page); @@ -5922,7 +5922,7 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm, hugetlb_count_add(pages_per_huge_page(h), mm); if ((flags & FAULT_FLAG_WRITE) && !(vma->vm_flags & VM_SHARED)) { /* Optimization, do the COW without a second fault */ - ret = hugetlb_wp(mm, vma, address, ptep, flags, &folio->page, ptl); + ret = hugetlb_wp(mm, vma, address, ptep, flags, folio, ptl); } spin_unlock(ptl); @@ -5985,7 +5985,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, u32 hash; pgoff_t idx; struct page *page = NULL; - struct page *pagecache_page = NULL; + struct folio *pagecache_folio = NULL; struct hstate *h = hstate_vma(vma); struct address_space *mapping; int need_wait_lock = 0; @@ -6067,7 +6067,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* Just decrements count, does not deallocate */ vma_end_reservation(h, vma, haddr); - pagecache_page = find_lock_page(mapping, idx); + pagecache_folio = filemap_lock_folio(mapping, idx); } ptl = huge_pte_lock(h, mm, ptep); @@ -6087,9 +6087,9 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, }; spin_unlock(ptl); - if (pagecache_page) { - unlock_page(pagecache_page); - put_page(pagecache_page); + if (pagecache_folio) { + folio_unlock(pagecache_folio); + folio_put(pagecache_folio); } hugetlb_vma_unlock_read(vma); mutex_unlock(&hugetlb_fault_mutex_table[hash]); @@ -6098,11 +6098,11 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, /* * hugetlb_wp() requires page locks of pte_page(entry) and - * pagecache_page, so here we need take the former one - * when page != pagecache_page or !pagecache_page. + * pagecache_folio, so here we need take the former one + * when page != pagecache_folio or !pagecache_folio. */ page = pte_page(entry); - if (page != pagecache_page) + if (page_folio(page) != pagecache_folio) if (!trylock_page(page)) { need_wait_lock = 1; goto out_ptl; @@ -6113,7 +6113,7 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, if (flags & (FAULT_FLAG_WRITE|FAULT_FLAG_UNSHARE)) { if (!huge_pte_write(entry)) { ret = hugetlb_wp(mm, vma, address, ptep, flags, - pagecache_page, ptl); + pagecache_folio, ptl); goto out_put_page; } else if (likely(flags & FAULT_FLAG_WRITE)) { entry = huge_pte_mkdirty(entry); @@ -6124,15 +6124,15 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, flags & FAULT_FLAG_WRITE)) update_mmu_cache(vma, haddr, ptep); out_put_page: - if (page != pagecache_page) + if (page_folio(page) != pagecache_folio) unlock_page(page); put_page(page); out_ptl: spin_unlock(ptl); - if (pagecache_page) { - unlock_page(pagecache_page); - put_page(pagecache_page); + if (pagecache_folio) { + folio_unlock(pagecache_folio); + folio_put(pagecache_folio); } out_mutex: hugetlb_vma_unlock_read(vma); From patchwork Wed Jan 25 17:05:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13115875 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5E3CC27C76 for ; Wed, 25 Jan 2023 17:06:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5055A6B0082; Wed, 25 Jan 2023 12:06:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 48D3C6B0083; Wed, 25 Jan 2023 12:06:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E0996B0085; Wed, 25 Jan 2023 12:06:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1DF586B0082 for ; Wed, 25 Jan 2023 12:06:30 -0500 (EST) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id E864B160E51 for ; Wed, 25 Jan 2023 17:06:29 +0000 (UTC) X-FDA: 80393950098.25.E00E239 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf08.hostedemail.com (Postfix) with ESMTP id 702CE16001F for ; Wed, 25 Jan 2023 17:06:26 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=kU9vQjFJ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=LzEdZil+; spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1674666386; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=jvHEHT8ML4S5lLU0h1EAqai+LKGMhrQlwPv0nY6giRl6M0L2hgWuYFpBaNwpApu+mtsU6C 5YBHzFBeuWrPCdw8oqf6fMc7L6Zy1axJ/PttXFzXT0PUbxI52G5NBAeWNdO+WU+M3YbSpU kQR6Kt6SpeDrD4WY5VP9B4Abp4HQ1c0= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=kU9vQjFJ; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=LzEdZil+; spf=pass (imf08.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1674666386; a=rsa-sha256; cv=pass; b=A4glgmV74z0s5JAgtMV1uUvIvji9o6kywyw+s7o3/9ej24ktZvyFPknvRBUuuXlJ/sCslK 3il0gRC+tARwFxpq5RhJcg6ufisxRFHReBdSTeA9NPdJuS/L1JzgAn58gKBAz4jlR235dq kVHTCJtAWmrN5ZOhzOE7S8jBEWn0pGc= Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30PFNj4w009521; Wed, 25 Jan 2023 17:06:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=kU9vQjFJ/qQYUDydbc6I8CvCgLX7PqEGdEh7pRKCxujMa6evhS3tAo4xqsx/vBkC47sN /uh8k96hVPKH3r/4gWXtInBJl2R46Zdo6YkqPDrO4vhEBiwfFnUyU/GtF8PGS/yf/utP rWxnF/72amaeB6tbF97J1ffhl4f4uDx3AulR34a9JLOfvS9dkmU7vVAg5YGc7MJuGeKb IF2nUW28UHDeUHfVlnxudJ/IMGKQsEQ/vUMYML/2HCon52h4m2JFQ7VAjgV9ca6G12ll 3gdlcKjx0G26kP9MQyxa9kRTCBP/lvuDXgIyB51M/vaCOSIIiWJZoT4RbYgJ/B3XjsRu yQ== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3n883c8jf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:13 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 30PGGDHC019163; Wed, 25 Jan 2023 17:06:09 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2101.outbound.protection.outlook.com [104.47.58.101]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3n86gd5hn4-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 25 Jan 2023 17:06:09 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b5D9QgTaoza/JRC/q9nOHq7vBJEeNn+PeQGQawEeFd8yBPuzsBZN01F+pMHImXtkgHIzlJz6HaWDPGIxa5KumVPaqHDJ/GFnEef06OTEPKdsAJ/PsFuQwujtSHMGCvVz4m+J0PIXjbG+Z3Z435Pz/BhW49FSnsRKn3HYzOEeeC6lAcp+ujsELD+slaaqZM9jtP5INuVhTKAkSoLvriYnsVY+CCeyDCWqcW7GuYYpxOPTlk28zkzLo2bHF35vJGYgESByDBdFzQ09a6ERfBPmGH0/YFEJahyRSJyJwnfHdiJDFz63XVztw4UZgHinPZJ2iNLpLTd3qIrmnGt+PEl0DQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=Uel6goyUaSBdF0FXFip4MAC4n4Z12kD1a4vxiFVr1HkARi792VPYdv4F1QJqsp9/0kMfzR6zEnq+ZmiFx02DTHwOfipjGBYaP+MrNCgntc6ceq1vI0QBD+mJIxHnk9vwq4Q29UGFkdJs4B6Cp7brtM8aS9HR8Y/u8EyQ8l9bohVDA41jLRHUheaY0LrqeCI27UYvNrG1DfeKdaageiYMxdT5ZBQ+2zxZ6L0XXdor5Htm3mP8CKoXZ0zpUBy4//L5xpd5MU94WWadT8KUdZNLNFj8xq77OGdSlbXkADwWwOBepWA7W2FrBm435zYV2XubhUOx881d3waKnAoWGm6gHg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=k9Ou4eNZgNrqDC9CsktHGFmSHUS05/MDzuaI34nkS94=; b=LzEdZil+jLIpjwpykLEW+b2Af6MtTX8FBqy5VfJwZzEo+Jk/j/LdDcq94mdqAXQaV5/Asul6puc9qSLWeM2N/PiUxAFNWAR71oMj4d9KJpfhPJLO9avz2rHTST10v5LWNCJwjbnBOjnjmwZd1pPVdmaXIVeO8k+P2WXVQ35fG20= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by MN2PR10MB4384.namprd10.prod.outlook.com (2603:10b6:208:198::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6043.20; Wed, 25 Jan 2023 17:06:07 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::93ca:e22f:aa6d:94d9%2]) with mapi id 15.20.6043.017; Wed, 25 Jan 2023 17:06:07 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, jhubbard@nvidia.com, gerald.schaefer@linux.ibm.com, Sidhartha Kumar Subject: [PATCH v2 8/8] Documentation/mm: update hugetlbfs documentation to mention alloc_hugetlb_folio Date: Wed, 25 Jan 2023 09:05:37 -0800 Message-Id: <20230125170537.96973-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230125170537.96973-1-sidhartha.kumar@oracle.com> References: <20230125170537.96973-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR02CA0039.namprd02.prod.outlook.com (2603:10b6:a03:54::16) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|MN2PR10MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: 82001441-0492-40be-a7a6-08dafef67331 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kJq8bQSJGDYZDqAVZnw1hx7Q3gdFLya899ow5Nl+QJenlujPH1TQubjOetPfSMElnJ4gbzTecTVh16gHFoJb33FK/6vnq0wiVMAjN/IBN3FYDwTx0GMro5LzcFEEKv+maxj95t7szfAQK5no4K4yjqdEQxOrqliNr5jEwpVuj4iJydPcqdAgVFJGFPYNV645k/soVn9dXG8zBNYOgpP6vLL025kBUm8iE1+8CZ9s5Z+TU1kvZN1IZ2OpJifWHAq9wdW4+UptqE3vmcNipuerO//OUR/DVlELYLQhj+tas0ktHC7NV831RrPcGS83PUlBMyBMVbKiD35/9FYNsXJrx+13i7Svbh+kTqYZtw++3HSDpi2mtbzNhTXYH4OJjtEydbPccAf+NsVoRZ6CChROe8NRvcRnPX+QvR9H/nTQ4rdpMhjOw4ocMUuqpHHzsQb9xnLF052loArwBoDOLGDVYPSa8A5t6gErqy68MB1d/0DB9y3Mq3QNMh+GnVqiyKooeErXtaNMKOIoG4xydRFqEBNOjC8cZ7SXcCa4K3v6Ta7pKjGJPqViXMJRf2KVSizvrxmUde6Mmzl2OwkkvUedWuPK09KJ4tdJCDfLcsDNl18G5Ja789lRxj4R7he0DeM0ylhVOmIoEZGuZMHYe0XuGA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:zh-cn;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(366004)(396003)(346002)(376002)(136003)(39860400002)(451199018)(186003)(26005)(6512007)(38100700002)(66946007)(66476007)(66556008)(8676002)(83380400001)(4326008)(8936002)(15650500001)(41300700001)(2906002)(44832011)(107886003)(6486002)(478600001)(5660300002)(6666004)(2616005)(1076003)(6506007)(66574015)(316002)(86362001)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?zC1ac90wAzjNHKlziAYskOVUKmv+?= =?utf-8?q?E9EIORHkX55RzxnTr7WRz4Obw9NPMhhXuCY9CIXqWjMijDhj4RWYo7EMOCheOkAop?= =?utf-8?q?SmwJEu9ECnDofOTMhLrL5RmrVVthmLsd3IUGyyh956uub4o38jIzmpzZ/qKNdSsT4?= =?utf-8?q?1EK7XuLyI8nSbfAodm+OtuXIZQOrfNRThM3r8Wcrd5VgTzSqKeiZzuZDrNgayOt31?= =?utf-8?q?eaaYCZMVTq8tF8bGJuID/hY5W1ZHy/zKGTVEL8mlCV9imTlgPJStyWC2sBs7oGwVH?= =?utf-8?q?+EiN4Es6kE0cFLDjuTIH3v7BGPcbxfm4gWNu2txbuGcbNLuh2MuxHlVlIOuduv+1K?= =?utf-8?q?3IDNpiV2g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Cs9D/E37f4eTtuCVETeoqE/M0LaoacQXIpGcEG2S0wc2W0bqnzOEToi0Rkr4x7U2j?= =?utf-8?q?AkdiEDN/AEfQLokbjdfMcHafri1CbxMVJEBHPMCA2fvqID7kCvv8t6f1j+fOwzWPJ?= =?utf-8?q?wGSVhaoD1y/jTNuMezcdzwpxrmaHZCf5cafMK9tWtslJhLjpL3QcjEwqAg9JjCKkv?= =?utf-8?q?10FsYEECQ1VFOjE260eOvwfqNde3DrdiqgnPedYLgdlCO7PbP6onbPUESlx9vlgw3?= =?utf-8?q?LvUU1ooAl0dtPUzfKGOwYdBc1blZ7y8YU4kt2lEEHYQKCrPVf8klyrumM27HCv/Hu?= =?utf-8?q?jHZQ0oFyOYGbgdVj7+zBvQRrldDs0t7xT7yTOud42cDulXktKSBzjMk7GLbe1Y43M?= =?utf-8?q?8WXl2xHKXz7I4K1bVjTx3Ue4dwl97Vcml9ijPrBv4UxPV6KjaJnqOGNVdFp5WRFUk?= =?utf-8?q?MjUCp5qX1ASAujb3O5j4BnrnN1g4F2G//imKLiNTv1lkzYygEAeFON06v/V5hSb7B?= =?utf-8?q?7N+nQVmFvBas=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82001441-0492-40be-a7a6-08dafef67331 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jan 2023 17:06:07.6244 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: smKWXfr8g+q7OiBlK7jcb7duTZFN0GKvLR98pehHC4Y/N/QVP8Upd5tUI0zSB1K3BtlhAg50BmmKIZ77LoKzFC4dO82ARlygJsQGh9vjJbk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4384 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-01-25_11,2023-01-25_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 phishscore=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301250152 X-Proofpoint-ORIG-GUID: Vlw7kiCJ9H6_bVndrEOg8GZCmStiFpAX X-Proofpoint-GUID: Vlw7kiCJ9H6_bVndrEOg8GZCmStiFpAX X-Stat-Signature: ajugr1fjsmdo95475fu7t9oxcraznxxk X-Rspam-User: X-Rspamd-Queue-Id: 702CE16001F X-Rspamd-Server: rspam06 X-HE-Tag: 1674666386-155943 X-HE-Meta: U2FsdGVkX1+2453nhpGLQ3AMZ4aS29oJGcfqJCSvb/9cdpaz8JozT1uewxSJOWQs0KQaujLxdTpp96CBw6S02f3xBzsZ6D20ZPgN7VHd8/yzS4v8Ut4Pi46jSfXOC267yvLiVraZrrWnV5rAe5zyB07979sTDF14Fo9YHhJUAg11WsCD97y2lngHlA14P7ZIw2v5TuRdUO1BV2LXcXvfbKnYWFR/ylsi88tkFT0//xSlIZZXUKTRUhscdkX/5FK7HZJu8RAj+EbiKX4Xi05gWd2Ze9YTnSBq8fQuAR66UXfdZMyzXAiXOsSOtG/TG4tlfOdVp/Afcz5biK3y+YMjT4bnhLsOWDFP6I3tt5tiCgTf5WS4em05mktBQbqnz7wSCm1ma+bBTteAssS9wjrN+d5mIdegTU4imUFbpUbVB8LLtGQ5B3yJRUWoV6OZ4oOCa8J8npzc7+BFyNEay2jmSaffXKYsP2+Y+pT9AcSGcd3G3K7iJTd6GpvuOlR6BIo26HyfO7g5OLW/hHuYA61dk3RYW2td24zOuuA+E1wGbu7xaYbswP26XCHJecL8dNrLq6aL9jgEsljVyc6tPRAWODjPD0unpfxmZnEIIRL4Ujvt7s4gHaTwmNkol664mxUhRwyCB1P2KljNrLjgMf9KjmS3paFFBOSpl4I6C+9sypzT0nI3B42Hggg4zbJAvIkFPjAHTI1mC4hlx04XKwQNH2uaamQje9oiCJb/HbDAT9HgXbPRdLxQkUgVk+rfsgxrbQDFIGFHUbzNlJbp1xfyaiKSH2JCC3MDaNRGbZ8IizU0OQ7vJH6iSGZ4srILW5kpT7CdIZ+dhlvnuMDTZlU1SPrjQkj0cBu8sOBVgOWYcwbNk8hpcglu3mtcNim37AheyvRydbomFGaidMUwu0fbKLKmpushLXKEL4qYkNtDix0sp4WvII1rv+/3aQ53GH/f15Zy9DJv0XHvHfJRDCg UUsAqPn6 gqWIS4mDrO8vTTIOvRSg2SzwH4b6ZDBtEWjx8SKRNM/tB2teBsqkT+nkvFF6CunzJzb2QkUW20GfLnrr8EE02zdScFBFAngXs/KWQXA1RO70r4PqS+R07fd8tnZr6dl6QRvYckA00oy51LAPj98JJJn0mYNrSpf5nOzHCuJh5DTeabkaOVJxPPd8m9vJVaaT3cPcRxoPCUeVY8GQFCn05I6CrBIc0twYhU/srYGKIAR4yU+N2POcZlER7yPtiMSi4YAto57SXSl6LiEaoTsm9KbxF8wCGgstJEvs5sI1uNItmY3QyVCQYr2dFx3ag1hUlndiOdMEbCgTjNsP7i12Bzi/hu2JpYpGL8mZZu1HqYUqORscuM4G8iN+LFqTToUx0xX6IeZJLsp49R8NZVXcvuv1HjvQf5aUzrnN2lrS5h+SROz5iEArjZnmG5WTboq2jljd/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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的返回值来