From patchwork Thu Sep 8 19:37:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970581 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 08894C54EE9 for ; Thu, 8 Sep 2022 19:37:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8DE616B0072; Thu, 8 Sep 2022 15:37:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 88DEA8D0006; Thu, 8 Sep 2022 15:37:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B9E78D0005; Thu, 8 Sep 2022 15:37:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 5B6B56B0072 for ; Thu, 8 Sep 2022 15:37:40 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2AB85411C9 for ; Thu, 8 Sep 2022 19:37:40 +0000 (UTC) X-FDA: 79889927880.31.09BE638 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id C79B71200BE for ; Thu, 8 Sep 2022 19:37:39 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJKVt011859; Thu, 8 Sep 2022 19:37:32 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=c+0EVrzC6eJUNgr02xoi5K17R/S39pBDi0+vU7J0Rmk=; b=b8CRLbvac5NnXgohH/RSfQ5Q92SZ0bVNPFjqJCs4kxjGFDSS3Jn2ZkPf0H770G+p6ndP 2gVGq3qCJGM06WVRn/AbEmNY/4UmBLW9QqWeTbtOKDAheUBO5J1rrvhK6jFXtzSSWFhh B3PdcuhVM6JqttPSdlqX0iWJtF8PMs0sAkFQqACb7tbcOn42P0JrU1T7Bce8r9ksLRr6 WgJYh+FDJKXoSCOt8zOqDNbTPHUSf64bRPrXP5XfcPLgWKjLo0mFzUeqWGiOctyaTQsc zGDdmO1W3K4EsFR3D6aeW1vlg1oU06JOv/HaiaEJeh9H94WpJJW+LAX4ldZZy+UV4XV9 CA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwq2mw39-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:32 +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 288IFDPt038812; Thu, 8 Sep 2022 19:37:31 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2048.outbound.protection.outlook.com [104.47.57.48]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc63y72-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZvwoBVjtTAMAfpxPj/UzcynJUH0gktP0J6EtN3ps/yHsM/yCW8xqvKiibqgloBnfCzNUs9GwPYxGkA5Pj9xEqjUFB3nLUh4UNZF9BNNWaBm+wa6iOQX2ZgMSW2KmNCqbP+uK2m9ryWQEda69DUFMWOz2c3UXSQtZNoTx/nEPIH+ZJKmMFaZNI7fwuEshu/lqCvkhF2+GbTVpBNtX7sG3cdhc4CWiSLXwmcCvpoZ/q0zXxcSxd4oxeQJklFLNY0gndbQCaCGOkIdE9ckoizFZnIXY4CA9XgUtBaw7D2+iJSvpPqap7fq089jrs7mgw0FsguwkrhW5qcpCts15N1Dsg== 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=c+0EVrzC6eJUNgr02xoi5K17R/S39pBDi0+vU7J0Rmk=; b=eDxPU+PUI3bD5hDIFBb6tiY/HILrFjwxWn1vO491gp5Ic+jYOwH8WIRq4hVguaOVKX+ECQ5cWCHt7CZ8ztcv2VS4/dEmveDBYIy5Xd0OalKITzuO2kGbYvpWZnyGMY7MZzXbgsVwzEt1X7B0j7f88VsIh6RqAGjSiIzEaLS2fFftziY4ULM/aV7AtSc4zfN5pL05X/F1W6eEbxWizGgsTxWjNTeNoQwfbGyfLruc9Y5kq9xlqARz/jiOdXjwtm07CPeABnr8EpMnc31iMBWKdalL+EqNlFHfyFVgngymchWX3SDKG4P7qacrl6y+8A1HxN3nFLPJv28cM+5yERKsRw== 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=c+0EVrzC6eJUNgr02xoi5K17R/S39pBDi0+vU7J0Rmk=; b=bMpi6K3LUuRMuX7zUq/siCFu9NXF9+bTjfpW9y2SQH/+iBg73m3SSgRumoXx4Z2frgKHWBNORa4pTAud9oLVWy0ZmVtDT41ksraAyf3YoDb0YkBuHepmKXbz4KHmEGRgVXm7KFSzKL8mtwkrF5WDCnOfiiI/cJTPvDRLMVhSV3Q= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by PH7PR10MB6532.namprd10.prod.outlook.com (2603:10b6:510:203::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.16; Thu, 8 Sep 2022 19:37:29 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:37:29 +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, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH v3 1/6] mm/hugetlb: add folio support to hugetlb specific flag macros Date: Thu, 8 Sep 2022 12:37:01 -0700 Message-Id: <20220908193706.1716548-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0004.namprd17.prod.outlook.com (2603:10b6:a03:1b8::17) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|PH7PR10MB6532:EE_ X-MS-Office365-Filtering-Correlation-Id: 117f9fff-f2ea-4337-b7cb-08da91d1910c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Cvqp8HL7ilNxJs+dPP9LNxZhOUQCCbAj6P15RY0BTAS2FxgBt7wcOuVI66CdHs9h4yZ1zCyHjm3jCS8/0XPZmJqQrb2nRGAF/FZhGACmXLPdmhVddrtqoropK75XNGfjb/CJxj7cG9wp0SL2fnvxufwjJdHUdRnl6yZyUNAi/oeXHueF4HeLtkIcLvkDyu3P2+XS+n4ixOmDwTxXPpR4nnWUeogMaeuLFHPnl3aiPS8oJ5pXZiea8ksiwlmjPsIcrWbOq7KqNg+jVHsz9Dx8POtECEp9qsEpP9Dt74JZrjegFlqocBcgha6ISWPtsQTnjGh+ZSe60OasLjvZClwh213Wn3eZtgZY5AOwrfvf/XwbttCsCTzsrfVB+NyIUgGXJLMR9WXenZgEk3yYNBTKW0vLEREXd8If0JxnURtcri8vCWIjbziOGEKvvmVzC6KqPD7+IH8CCvAcVkbx+NYaMkdvqu8QZO1V5eN540xg+80yZLJvCJlS0UXPlszuJHDdZfN+zNhES8Cyl6NO0qFiUvVwtwWLkigfKDJwsJbn8jZqlbYe0Dxrm+cvk245dENDCXKgKSVlOiP+kyy1DWV8xvP2O7aPkEBJgDMQgGFSpcJcuDC4HMIs2IItxKvKAw0jS4PSpVCWAao8fnmV05Sc2kb0BaGiHDAv1qNNpJ+HvSWzxgP8Ta1gtV28S3CxW+Oulwf+Ez9yCPZC7m3rwpd3BA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(346002)(39860400002)(366004)(136003)(396003)(376002)(7416002)(38100700002)(83380400001)(186003)(1076003)(2616005)(5660300002)(36756003)(66556008)(2906002)(66476007)(316002)(66946007)(8676002)(4326008)(8936002)(44832011)(6666004)(107886003)(86362001)(6506007)(6512007)(26005)(478600001)(41300700001)(6486002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c7ut+Ug1ylZbCjt7vZvcpV8HOMiJt+0sTnuubb/z5YQdRPdl9iQEgx3AscB/1DUyQMu95Yvv4CGBNRNyJr4tq2bPpAzS3ydgbMTqXvYOA/HDobS8MMa5+oV+3o0wF68OL3CTVHCmZR13vcftYm93drGnHyEvLhSzRmHr4mcOdzZYgjSkJpcZ9S/V5dcU0OyjEctH3k/+rF4tR7fk1UMx0jPXKOCHalFyWxGaFp4glThZC5PVfzgYKGJoVaf/hMpWWUNqIjmJTc9YSuZTTqggeguWFFbBl6uv9aUjpqneyMzTPuCOa41ZKrxi/zKK6+LZeMi5K5rnY3GQ+iY4DoT5oAXjE1CCWnX+fa/yPhGTMrdO/eQGzkpzigmkLg+kCEvmzIXo6UA8Qta3KpyJwbnT30fdFkUatJ1AsTg6Pd6+ADNd+0Ac+/y62+zBYkscPzTCwR5zZQYGW0qgy8iDaWcC8zjAe+fF6eJwx3fQ/qgJ16oFssbn+Jl1PxBdDQQtq6/A1HeoBk4p6bfV5gS6FrF97Ho5U5K2DXDdJUgvCjZFn00a3GFQqc6lRYYUqKVLSq90GAhKTMrw0J34yrWiudwA5ykcogqol+lLJJsGs0GHSK/PMY/iSTnfXQh45GyOc7/hz3Ba+3c5E3qdA3v8C7Y1iwjJnJzugUZenOTAowxP2jvmHyrLZb3cKsYSrDCS8DZS4Uwy7/XK0pgBsKo/IX/7nrXFUh/hTSAUSxkPCAJHi+M5OlHwy3kaE+ItKNtQufbqcKp+IP55IKVfoICjGv561EkikBFU7LoyWfWlZ2wMkpNXwjwy8iIYO53ornOvd5QDhbGda0+ROCSJUawRL2f9vmKb0I5VqEhgqWCNSso5cDOL2GZvbRV6mmU2zl6tj/zeNfBpu+WOkTL4GmLv+t5rVj/F4AZyU60c51q2dnoBWJIBqbcIUjnAO31coO5FARo/AXJpt6mAQ3gTNnWRubwp2HBOfJsWaYI6rrOg40niaUJeq+A2X8g713sMPRpf9Io1VwbkT1DKPmp/XBTbpzqTRZEGt0LwVD9LvPu+2Qp3eDfX36g7D93nmq7wW/lVOiFtEjhmMboYj/Ax/bON68Jk9fdkhxE7yjZdY9Xmm/mr8nKpbZBmu+gEj4tPEIlgfzwflmUGPbCKnH8OAJnRmH6+OBqGfv2csUaQuRWsruQQxwi5SiyJ3CARFD1YPHl7nrR+aX96SI9IA83o/4K10YMQp4PxZeyOwNGkeLQGJHtKjCUAAGQ3131dwhQiU/zb7iRkHV5YDd5figTEJ79EimNkCJn0umOBMQIuwAlv7ueZkmVsFzteJ55nLx8bsOfkQthCd9RZ6bFfWmzf7Tjdcb5VzYEh6mDeLty93qqvNm2UrEkepgeeAKqAhGpK+C6QInP0wMktBKXkgyAV2hWMVVbmmIyg5zFRIH5heQ3LJ3A0Q8N5XKcWtpx2yDsUxmarObhgXv12Wk0xFuPc0M6bw8mbK6ayo5Z/wZ6fue3ztUnWk0ILCmE4XffU6T/3YyejJsNLF7JiHFuAmZ3cmiz8N3GrIT6Ok6Lgq3byQCzEljHknJYYiKwQ9zhZM9k9IuXqs1S23r9bMrJ5gR38pPiJIbi3+A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 117f9fff-f2ea-4337-b7cb-08da91d1910c X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:37:29.5475 (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: JcAj3spnixROG+NSfoKq/m/vacGFKscgs32Be9x8+VSioiV0vfFZMWAohzHmzi7OqBjD3+GddRh2BObvlmAlOWf1BB+gzlr4hTM9AIQjc+E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR10MB6532 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 suspectscore=0 phishscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-GUID: WL5BrnCY63mb4Sx7NivenuP5kZNUuYhp X-Proofpoint-ORIG-GUID: WL5BrnCY63mb4Sx7NivenuP5kZNUuYhp ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=b8CRLbva; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bMpi6K3L; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662665859; a=rsa-sha256; cv=pass; b=eK3Lqb+LqQdDBD1/ov8owd/d/Llg4Qz9UInu1s/OXdo7mkvdIBTQI6Dni1A2zNrmWfgEYE w3mRgRzlOhEcNDyZ83muB5ISyB3yNdKP3mxD0bbtFd9e4JIDYchmWaAeirPJCswp5wKee6 /Vp+Z1ofX0EDHbhe9qLGX5EQbIPODKU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662665859; 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=c+0EVrzC6eJUNgr02xoi5K17R/S39pBDi0+vU7J0Rmk=; b=SU7uz0Uokgfb7cDYyDaqB2rYutgFBDhsAlTPvmknQES+rJu8Q5oN8IQIg3dx4Y2uIuq3LA cnaxB6GRuO2ZGCIcOynHOlQ/SCJOe9vZ/t/cOozWHjpd9hcH2Ir1kQ5jVzCUUVoM9mkJXG Xiqhpvg/N1TJ+Pyrg4N80PB19kn1WTA= Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=b8CRLbva; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bMpi6K3L; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Stat-Signature: i7msqxbupmgkrbbtkdtjed68zjxswta3 X-Rspamd-Queue-Id: C79B71200BE X-HE-Tag: 1662665859-845535 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: Allows the macros which test, set, and clear hugetlb specific page flags to take a hugetlb folio as an input. The marcros are generated as folio_{test, set, clear}_hugetlb_{restore_reserve, migratable, temporary, freed, vmemmap_optimized, raw_hwp_unreliable}. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 852f911d676e..0952ea50251d 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -615,26 +615,50 @@ enum hugetlb_page_flags { */ #ifdef CONFIG_HUGETLB_PAGE #define TESTHPAGEFLAG(uname, flname) \ +static __always_inline \ +bool folio_test_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + return test_bit(HPG_##flname, private); \ + } \ static inline int HPage##uname(struct page *page) \ { return test_bit(HPG_##flname, &(page->private)); } #define SETHPAGEFLAG(uname, flname) \ +static __always_inline \ +void folio_set_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + set_bit(HPG_##flname, private); \ + } \ static inline void SetHPage##uname(struct page *page) \ { set_bit(HPG_##flname, &(page->private)); } #define CLEARHPAGEFLAG(uname, flname) \ +static __always_inline \ +void folio_clear_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + clear_bit(HPG_##flname, private); \ + } \ static inline void ClearHPage##uname(struct page *page) \ { clear_bit(HPG_##flname, &(page->private)); } #else #define TESTHPAGEFLAG(uname, flname) \ +static inline bool \ +folio_test_hugetlb_##flname(struct folio *folio) \ + { return 0; } \ static inline int HPage##uname(struct page *page) \ { return 0; } #define SETHPAGEFLAG(uname, flname) \ +static inline void \ +folio_set_hugetlb_##flname(struct folio *folio) \ + { } \ static inline void SetHPage##uname(struct page *page) \ { } #define CLEARHPAGEFLAG(uname, flname) \ +static inline void \ +folio_clear_hugetlb_##flname(struct folio *folio) \ + { } \ static inline void ClearHPage##uname(struct page *page) \ { } #endif From patchwork Thu Sep 8 19:37:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970582 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 9154DC38145 for ; Thu, 8 Sep 2022 19:37:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 35F676B0073; Thu, 8 Sep 2022 15:37:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 30FF08D0005; Thu, 8 Sep 2022 15:37:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 162C28D0001; Thu, 8 Sep 2022 15:37:53 -0400 (EDT) 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 04A406B0073 for ; Thu, 8 Sep 2022 15:37:53 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CE62AC12EC for ; Thu, 8 Sep 2022 19:37:52 +0000 (UTC) X-FDA: 79889928384.06.7A09A56 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf26.hostedemail.com (Postfix) with ESMTP id 663571400AC for ; Thu, 8 Sep 2022 19:37:52 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJZvm013961; Thu, 8 Sep 2022 19:37:46 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=CokDxDX3VAQUgE8fgEHG3bJTJ+RnPpCT78fhlFqKRFk=; b=kpjRcfxLrDUgd7ggqYD4n0S+jSo1ASHpS11lLR7eCNfvFwDHXl1eY6RUuzNpnkqPN/no 6VKxByMwkRV1aBx3xDn6Ey0EC2WeP6H7syDL7mpeVjtgf4NT9tqFX7L4WZh/Oi4GazFm UZ3sv4361mj2/7WfVKtCTgJmfhy2/AFYymcZ2vdf4a4dmCDVa0M2z0wZOQQg6b9mwxfw aFDsrrxk0RGIyKgMFYei5tohP1BiRRtk2tTGjn9VRf17LNU+E0veYRfTQyrXT6prso0P SgKgWGHSoNibDpsD9dIX7rDiV2myiwvSQleTnehcXfrz7n5dXrUE7EE43SumP34k00E6 tg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbyftvy0v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:45 +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 288Hpxbs028932; Thu, 8 Sep 2022 19:37:42 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2174.outbound.protection.outlook.com [104.47.56.174]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jf7v7bu1m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nxh/JHi4Q7+WiuHk5GYKkjTU6+OSPmI6VS5638lEzRQvK7+FEGfjuL//n+cTYfLNur1Tfk8siemqj45em23xLzofSTtxpDClVWnCDk6Qusxnocu3xR6tNVTQ4P3M0tADUmYY9sWf7sPE7a/4rB+PePkFpOxD//DEzsYVGF6DN1NUvKmXq09ugbqVmM4HUqon9DHpY/4d8JU+IFrjWe9T9hd8GxZUC2hjh5U3lod0oV6Tj3w+W+QFoh8gVxV5DSOlmVixbM4zTlaos15LjZqod+nnKeHKRRJS8Q/qHZJ60N55rK6PqocTzecXElsMOZLmPthABOzCN7zweHFcb9tsBA== 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=CokDxDX3VAQUgE8fgEHG3bJTJ+RnPpCT78fhlFqKRFk=; b=ncGFCRgcocpBGDPxcNpUh2qPYYOQr7rz09oS2w+YGlqcrZmmSDOAkvW2j0Ut4bnEmJiUFp1qGukmqbSGbgroQxWm9HBmUP22OsgQfWWouAjUK2kSwS/tPmXurlioYLIPMzbi7JzKrfF6MddfA9wp5owwa1wDfFHSPRdLtFhXC4dHl0k+LzFd6wvc7nhyfPC+toMryiYZUTp+ek2HRvqXa2zcRVj1YYrRsMYl7jeaS8ZFITc8g1UyLY86nhgPfI72auwCZIpNoGogUQMmoxc55nBKEBwpwqyIWd/oZO+d1BHnp3rBMSiM3+bRzWyCuON+H5KEP2ZIZ6muJUf9q95dng== 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=CokDxDX3VAQUgE8fgEHG3bJTJ+RnPpCT78fhlFqKRFk=; b=DbAmWEjFmMYXaTOmGLS17bvcgDTR+1V+mwk/RVmVamUrIhQnXEygV3iabFjqdQFEKVyMuTUMLHmWSLJswpr+fviISGrgkiXjO/P58u7fz/vfidmgXeADjk6o9XT+Zr9ISBXcW1fNzWu+zbxiH6Z9SpD/o/wymUe+ZsH2QNUBZ7s= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM6PR10MB4249.namprd10.prod.outlook.com (2603:10b6:5:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Thu, 8 Sep 2022 19:37:40 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:37:40 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH v3 2/6] mm: add private field of first tail to struct page and struct folio Date: Thu, 8 Sep 2022 12:37:02 -0700 Message-Id: <20220908193706.1716548-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR07CA0001.namprd07.prod.outlook.com (2603:10b6:a02:bc::14) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM6PR10MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: b0001ada-1ec2-4a3f-24f9-08da91d1977f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b5YqnP7mZZGeHBmmfy8j9lIF/V9reY5DehiCIvIniaxwnvt2Ujq1QGKwK3RYvCRmxNk3MGZv+rESeXVEmzf5e1sjJGiikx6TE8L2lMMdWiPJOM6/YIuf21u0APCDp5d+v4JavQcOEPxm9c28WniHXl1O6ijwD9dCggATF8tOlI+BqUNm7S4mH2OE1nl3RFmJP2rKJP8NPQYynpKPSdT6TZt5L85yGxyIOfXIbS3HacfdSz/2PjXelSRRS/SqJEqiq4ssJmuT6KYjqPN4ccMUEkS7D6/WXsN9gO26dfPtcqv1s009sWQxbnPYGBD4q11658nT8h9hp+ZSJtPHinbNieZLu1vO/qt2sH/Krpc0zleer12yKMlhvugO+f/vG2aSe5BQH9FX1WPv0DuV3LdNsCKkCUKUmYZw2DtShkWvQmtJ/PwksOpGqgQ1pGyEDajx1WdBF2RgyMMrBAa8Bf+saWmuJga2bxvzHzQmw5KL+HIITjvSCBCqWINpiaKOhqK3jersUW3VcaoNQ+ltUjRPZTwro0N9VvuQvOZ2YDksDgtO6GuVQYOa2fbl4stLbWjyTRHPI7VnxNNDKg3OBMsoq3geARZ3TUWYqIEwpWK9uLlD9DRUALEl1CXKTSOEFJSumFmLROVNMxAw/ukK5WiW04ioYHEVCOF9CldThrBCdAT46RIPSlrNhKHokGwCgf2o0zfuZbkm92agcYi+SnNI4Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(376002)(346002)(366004)(39860400002)(396003)(6512007)(6666004)(6506007)(26005)(107886003)(41300700001)(6486002)(5660300002)(316002)(66556008)(66476007)(8676002)(66946007)(36756003)(86362001)(8936002)(7416002)(478600001)(2906002)(1076003)(2616005)(83380400001)(4326008)(186003)(44832011)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: /Dskm//Q+sa3eDGn991sJ3P/noJrGJgvoOrkOtiPgFmkT4vA8/4/aUA38ekb2lRyItDq7d7qagixlLK22ITXF/+NX6YDqvgCp99xQWSXr9gTmAxphgOk1r2XNhm+aIg0AoszDjXG4rtMbYoiX6ndEAX7WBMOjoyUI7kQCOM5BGz8JoEwinlmEM32hv4qWeQWLjh5CQZQMbi+HY3GLea9oQAUVJ5NsRpk72LjxfbxxDZvy/t1Pw4r+YuAnr04/byyJMmVZ69uiNTjiUFm5EJK1SimZ6EcbwQ/ppFr1gA4f75o+YMpzZ/mbz3ldGW+jmiR6WG4nuJzI/SKK3uNqGHDCTEoQD2TCkqLw4JuJX8Gu1J3s+gZJysmewVW9Wf5R9Gs1TE01r2m+P4HdguGW0M8ZFXNFpSU80FNozG5JTHNaRe9nlLurODqWg/eIvR01JdP68B3hF6F9HLmNuyKEdDJbLpypK6gUT38xTfXS8EtgFgFekhqVm9dwbRI7KzAQ5Mo/K5OeZI4VEqNrDZlhDjXJ8v48zwYRFq80U4QcVRja5zFZ8mimTTPNkQ6QlntN7mNehsKbnRQwXYzOuMbzG0aOX3zYtU4dz+K0UNOD+VUEmGzSjS2XqnDaHA8pY+hOIIKiFHED4JHaAYlalAOiqrV0WBIMWV7C9JOk68ZiNe7jC7Fb1ohJOxHbbT7DrYZYujFW85BOlAmVcsMq9RBHS0NwOG5oiaDxMWICK54qpJ/pRbRrlemAlWTkNaXy1jcvtugCpiPUTqWetbXmxrUIN8o96pOxP6TFO7LTrlXEPgl3rlyqitiWQeyR8BxBF6DfAGD7V4fvB5a/Nai0oU3+oHhMDij6LJesUC5kxZa/gRqGE05W7rUG2COK4tNfFkP1Vpb2QKj4RIwHF4KSi2nVSaBUeKQmi/FLkGo4RFF7Hk+l9NXg01IdH6n6FS3/4n2x3Domx2q7X81G52RxeHbsdbOuW0ZOb7H8oMObNUPgJ7XL09uVDBckzXJp4zJxnLE7RXRxdDyHQC7b1LFuZx+2s/EYDVEWZQXAHZXoQkkByLLOkcdZpmX73E9q9+EE9aY6de0VijeuBGiCEfKqWBWquGmdf4hIQH5TRE5M/xF5pD/Ql9NNhVRi0DdlXXlxYejixI5vWQAd+v9R+oS4XorGR6OyZfNAiwILVQZB43UNLb5HP5ZOK7eN8Sz95o9S5Ww0YMaM58fFyLunUHwxRYnaaqiRwCLdERN6ZV7RaX6YBDaNgUidm8oAaLkrXib3drMSr/TfqlK4QgbY0keq+Vj96BRhfaztPymgR9oh04hbxx2R/IB00l0uogt9uZc9koqYdi3c6dzLPcoUPAa0gTmXz5ACU72/2EWBzVGYkhJhJKmxkwv3gwXKRD0Ps7MFImNyQzMUrFzXNAb2wNx0JRq4N43876gw1Qt2xiZVakijWgnKN9sw3Ndy09YKPjWQryb7+YqgTFUaG9TaQVCvv6ccoGNBi8CeqHC6QUNr10Av/JUOCFCeVqPtDfAyGbCYsQT+9ETdk5cTq43AJZMcUuHIwUxKvB2TKtIBzh2ZQ3zXbBOF9gSrDJQ4NITYN1Ey+i7FIkl6VnCkpMRDaNqpS2r1WF6Og== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b0001ada-1ec2-4a3f-24f9-08da91d1977f X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:37:40.3324 (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: UMIcY6ojYC3S2Vtqh749yXtTgdAQNE0WlzGWDUyy0FdCs11ptzyaqtzXTE+4j8PlJE37NWjTTParNS2TXSbjfJNlrBfbkygELvcQjAT0T30= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4249 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 spamscore=0 malwarescore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-ORIG-GUID: cqU_I9yWzpnV2N0c839wxMHS9YPxYRlK X-Proofpoint-GUID: cqU_I9yWzpnV2N0c839wxMHS9YPxYRlK ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662665872; a=rsa-sha256; cv=pass; b=bk+JAOxfePjR6Ng64ldrXLMG89fq/5WpkYNU9CAk5V/AxTolvWM8GjpAa/pMhbPZoYBLxX UVtk/9Zkr21RBnsvp/GTVOPSUjSYIh5mIDvvcbd3QxFA73Ik+IRGdYKWGhKxfkycitXvUs pWvmKlWVD7H2AB6PU7UEyqWi3HQd1E4= ARC-Authentication-Results: i=2; imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=kpjRcfxL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=DbAmWEjF; spf=pass (imf26.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=1662665872; 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=CokDxDX3VAQUgE8fgEHG3bJTJ+RnPpCT78fhlFqKRFk=; b=WBrRrasyH8yNLhJdusoA23FhsZSWGCMo/xi1+R11rYc63UOG486PGci1b74aqSFX3zhWZM GwxKb3a+cafjK3tnTyp3ZQguWaRG0m+D2GfQhJRFyxBXADGNR4vz1m9q/uLt5EARhGmSBc AA+S8aiO/d6wNsY7QCLV4qbyk5afFe4= X-Stat-Signature: 4tunhw6bco1537o1jua47yqw8d3csa5t X-Rspamd-Queue-Id: 663571400AC X-Rspamd-Server: rspam11 X-Rspam-User: Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=kpjRcfxL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=DbAmWEjF; spf=pass (imf26.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-HE-Tag: 1662665872-939808 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: Allows struct folio to store hugetlb metadata that is contained in the private field of the first tail page. On 32-bit, _private_1 aligns with page[1].private. Signed-off-by: Sidhartha Kumar Acked-by: Mike Kravetz --- include/linux/mm_types.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 8a9ee9d24973..7a33171a05b6 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -143,6 +143,7 @@ struct page { atomic_t compound_pincount; #ifdef CONFIG_64BIT unsigned int compound_nr; /* 1 << compound_order */ + unsigned long _private_1; #endif }; struct { /* Second tail page of compound page */ @@ -251,6 +252,7 @@ struct page { * @_total_mapcount: Do not use directly, call folio_entire_mapcount(). * @_pincount: Do not use directly, call folio_maybe_dma_pinned(). * @_folio_nr_pages: Do not use directly, call folio_nr_pages(). + * @_private_1: Do not use directly, call folio_get_private_1(). * * A folio is a physically, virtually and logically contiguous set * of bytes. It is a power-of-two in size, and it is aligned to that @@ -298,6 +300,7 @@ struct folio { #ifdef CONFIG_64BIT unsigned int _folio_nr_pages; #endif + unsigned long _private_1; }; #define FOLIO_MATCH(pg, fl) \ @@ -325,6 +328,7 @@ FOLIO_MATCH(compound_mapcount, _total_mapcount); FOLIO_MATCH(compound_pincount, _pincount); #ifdef CONFIG_64BIT FOLIO_MATCH(compound_nr, _folio_nr_pages); +FOLIO_MATCH(_private_1, _private_1); #endif #undef FOLIO_MATCH @@ -370,6 +374,16 @@ static inline void *folio_get_private(struct folio *folio) return folio->private; } +static inline void folio_set_private_1(struct folio *folio, unsigned long private) +{ + folio->_private_1 = private; +} + +static inline unsigned long folio_get_private_1(struct folio *folio) +{ + return folio->_private_1; +} + struct page_frag_cache { void * va; #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) From patchwork Thu Sep 8 19:37:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970583 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 60FB9C38145 for ; Thu, 8 Sep 2022 19:38:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A11F6B0074; Thu, 8 Sep 2022 15:38:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0508A8D0005; Thu, 8 Sep 2022 15:38:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE5D08D0001; Thu, 8 Sep 2022 15:38:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D059F6B0074 for ; Thu, 8 Sep 2022 15:38:01 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AF06CC12F2 for ; Thu, 8 Sep 2022 19:38:01 +0000 (UTC) X-FDA: 79889928762.20.2F09FBA Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id 596ED1A0064 for ; Thu, 8 Sep 2022 19:38:01 +0000 (UTC) Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJM5Q012359; Thu, 8 Sep 2022 19:37:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=x9IXHmhmhTdttML4IMmOPJ/UboAqGKu7hHbCKCzkhzo=; b=uo+Tt1uap1CUC0VqLOaAFl+Hi88MQHbI16YapTjdygEsqnugJIKewdHd9zrJZ6MF/Ukm l61j+ctcBc5X2T38ZTVkb4ivTfAk8Ee8LHClU9WiD8CrfvsPnBAVYV8+WIvFKBa28Xb1 5zDs5NfR/THGjn4excs+teVxaLloqqbokKly1r85Ls4YMWJaOQXTesX86dz76QKMsHG1 rOfpqiak1RAexxSPqbdCHTmwNZEq6vrreVoRJbFWF17Gt7Lx81KzS+MtByRiDKEedHme 4kIF9itjwg3+Iri1B4LotTxWzH+DTLivIdy/fR2Sol7htsc22572BigaL3k/zuA5Qwbs +A== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwh1mykj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 288HbjCg028189; Thu, 8 Sep 2022 19:37:53 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2170.outbound.protection.outlook.com [104.47.56.170]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwccq37w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:37:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KMDtB/ljzcj1xo9aeehhrsYvUvSBWtUaPbWNyq6he8F0wXTG2Q1aP7HMpgzo1aUzmawywt0WSxLcydH2uCtok+PhpqFGpPoKFpG+KLil3JD3zVTcChwVTfJlOCqVLPZSUaJMsgyBQrxEFNQZjzeEpjf5bzKPrZLHrukHNe/e5OMO2k1/XeLGlbP93uBqfq1J5j0KLCRgageu/PQs5W5P/C3+Q3uM7g0F3Z5i2yN/pHFNih0uJYIv+ApISYh0SnLJ0RmiwwQ2S3LxEoTIcIsvCuK5m68PtcUY9WIfvosoMM+GILmkxZ9IIwsn8Oq4tvTiPj2ndAfPRePUf9l5OOky0Q== 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=x9IXHmhmhTdttML4IMmOPJ/UboAqGKu7hHbCKCzkhzo=; b=bwKRlqPx9shGvjoj7+lZB+E3UXllQyFVyIB16m+39YDcFk3/KnUnJnjYmBnF0WQHGm5jMAvxnBD0LdKm9NFbcZrY5IMqFccBOLQHP0kHWbasYeSWvEkgfdzomvj0axlJLb7uqy+6y5SNNTu/k6SgURqhje7rjLllagD+TdY9yUEeYfK7ln53yx+QkO5dnkk0Z0V4hMwop2CsK/MO3SgzjPh2efqbmNkr/CanGMHaFpOh0LZLHxRqHjiZXh+gJ8X+qiVm95EYt3kEa9goBXsp3LSMI91cfuMmi9ktzLXEmZWeGS+7y5xfizIyOh4qXWC3bPvy48RPJRO2xCItmeL13g== 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=x9IXHmhmhTdttML4IMmOPJ/UboAqGKu7hHbCKCzkhzo=; b=NcWhBk26fvjxZBHAzzg98oppkBm8sKrRA/FSnq8T3B/P1UrbMxLtK03RZY3AkrgezwEJhhxW0rwNHU+tG3L8NyjjR162sSHhiYhsWWfijMACzbuTJy9WbaDI3xoUCKWF4hMOrQIVjvNmAkReUGticvpmCG3DfMacxes6t414TD4= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM6PR10MB4249.namprd10.prod.outlook.com (2603:10b6:5:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Thu, 8 Sep 2022 19:37:51 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:37: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, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH v3 3/6] mm/hugetlb: add hugetlb_folio_subpool() helper Date: Thu, 8 Sep 2022 12:37:03 -0700 Message-Id: <20220908193706.1716548-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0070.namprd03.prod.outlook.com (2603:10b6:a03:331::15) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM6PR10MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: 4bd107a6-3a4d-48d0-7225-08da91d19e0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GqORY2cCZsu6aE+YQvwtjRLJ3ysSHPM4laO1+tdqAinV4mZYVWbv1XavX2iPnDg+tT6zOw1U0tOlj2EhC3KdEsNKnWDMMwILSmRggtzW0CBuSppp+mMQbNr/XjNEyLBd/3WhCxmP0kASefr3L8VewB2uSzrpK5Vi51nQLWhdz650isGu1FDQm6+mjRO7quyM0HHMhi4JS3w2wFS0lbjdGSLOnhuL5ACCQgRvUccc2huyIBW/6RpAPPD+a9pjXB9e43DxeBCS7HycXHyG5IvO8D7j/ISX0trIXlntHslBLKYhkqqdySTpxDJBRMtVNA04o+XFZYa2w/E82GfGnvoAD8o4tKse7769PeSpT7f9f8M9/nyssd0p3lMfOJDs6fM82FIxiR3FmGPzg1ERUShzztD9TFW/2dVEWIyS0iJTG19k326n7O53zpka3/9wwsLrjX8jxklEGCitbTbwbSzlB/Vdu86HAXHVUEQcZzHHLnP6Q6o4YK3YK7ODsWsoPn2xOgcBfdRbFP/sxRJjm31bYo5SFIx86k2kK/csTIr4CSGEfiEQOJzHa6Hqvfn1MkO9pzgNYFdPw9LJNpZaXcv/7VHGG3pOC37YwZMbs6FUqy5GzvKFKFeIpBd/uLd5Yg8kwnazL5Y+7jf36dK2sOZ/8EhZ4ifzJQnPWzGJUowBYNKVqn0H5YoOD4mCpnUnyYZaQF5AIp03IDQV6444uYevbg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(376002)(346002)(366004)(39860400002)(396003)(6512007)(6666004)(6506007)(26005)(107886003)(41300700001)(6486002)(5660300002)(316002)(66556008)(66476007)(8676002)(66946007)(36756003)(86362001)(8936002)(7416002)(478600001)(2906002)(1076003)(2616005)(83380400001)(4326008)(186003)(44832011)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sbOx/8R2ZxWET0njJG3mR+7hFaAs2uh0d4H0tmA8Vm9WxG36ZggeIz0NQxyXW1DURBFwTwskva7zL9Ly+oMK7jrf9lYecwNqnWBESZk4YZT1hTMC/s9Xj2yWzM0FXBKQpy7AUWnfTpnN+QqnbpoZsRzlel9JX1FtV8x8MwZoowfjFJ3j9/HkUFfBJyGbWe5TjanqhAys25Vf3L4ypWUs44uvRhosR+CCGrKoItiEPvCOo0c+2OJekWTtjONM5gMLz2YHjjpeN4rqGXNzF4jLhpHe7jde4HxysH4XOmpxvPmJn9fEFUqo+TCj+4ZqhZvGcD3S8VEzYXN1mNMspK0EpU3pR7NAbC8fbEBSvK7yY1EfRRgvdOSVG3okjTiVulx6e0zlUhIxwUbPeqejxbmWV/5RGo/zFOvX72GDi2M+dbM+xzvjk4vQDXgmJ6G2PqXx4Q13Zh3ya5IV3UChQCX4mdQsvMAqisFB0v3mmLwgEvQUDYfrcAoEKbk5WUBjqXpDznTspALfO+zsLyAFRPzZ7KfjL92WT6yvpZw+glGBDKrsFUNbu4zY+PutjdaDJsgKkIsEpuLXWrKCzBt+PSYLoXwXAu7oy6uISXPjQGt98/LnTr0xKMlQBOM5UjwJmQW5FsZEwCzXdfT5fP52lughYcXlxKTsVvqstfRbwgxfvwxAy+/+6GbFDIq6aA5mFC7m1UE5iziZv23JTehed+zXMqucGPEtOERi9aU45gJyWfoUZcT/v7kYQs9FdbsyiM8wmXZ8qVWibAHnzeklixhEiI2otbeyNOBC8j+WmJBt2w/qpoK1hAaeYsz9oLUL2ocixJ3vTrW95DNfEBdrD22+FsOm7f4gxF4X3tQ1OGTz5kuS6tspGjkwz0FvbInEOB+w6BNZnBgu3L/uBQADuo4BTq3cdszpL0NUYFbBsdl6Sf/ZCK7I9t50dl0SrGLxv8gzplf140rGZIRTFnraFPzCfVQjLTswChAawWaoYIRAnvxCEKp4AOliLmVLCN6JgwjHzrZ6WhH7WNUtCOLFO+y6N7oEF8Ohdaa8pfWKl0tHleU9nM2i08byBrWnuruD/e/QChXQNysQWYQOEjirHMWJ9EzPeylXHQtJ1QBhO81QqENBIe12UpDh/O832uNG/secjP9Krn/Edgc8zigGHSX8oPz8rwohMTtfC6rbPhdd9OHuBESmuj+LWFdMS+taIKWyYVWpwQUXGXumKn1sAAEmObKXkQLOduORx6itiM0H636UHd4TMBWIrQw6Mfob+CJITNQ1C0CgpJKs0pw71SyaByfB1GJbGabXyNhofsIJvbe/j6JW0QmUeAkYUkSAJfa0EN2ZyS2hy4Tq9HC2QHU3YOnQxDWoFw6TPO2+8GpaUMq+AP5i6HeLU1B6djeLTjd4wxKq4f4raVz/0o/ke+X/VCrFqLLZm4ZzpHWAMM8XVXvcVAtsOYWyejLOHs4w+vClGF3n1bEyTr4ASX2iiC8/dVsqtOCuNiA6Bvt3zlv3GfSSfiv/8HiDxVSD1lIaHAWYXy4M8Okx+odOzXMVZjeZFtK7rXv36X9HJ6bk2lcKtVAnLLnONon4nA28hjn3rlbMhciFHQ6wxyImxQ+MwOoReA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4bd107a6-3a4d-48d0-7225-08da91d19e0e X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:37:51.3535 (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: cpc7FYLR1C0f4fhM61JZMlyFas7dE3k68gF6RPsGHAFv4j9HGVpgUnYqcEK+n1UDnZ5kXOBPlP9t4QnpfifPtBFZJD0LqUATV8/nxqPOnf4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4249 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=973 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-GUID: I2Y8PKsF4sINBxBrtZJFXU0rwcUyP2Mg X-Proofpoint-ORIG-GUID: I2Y8PKsF4sINBxBrtZJFXU0rwcUyP2Mg ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=uo+Tt1ua; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NcWhBk26; spf=pass (imf19.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=1662665881; a=rsa-sha256; cv=pass; b=By7zQxyN6Mq/RHnKLkoFpu9qvA3yIjm6FdsMH6Yr1q02NHr1W/kQatAoKudY/rCSNGlogk cFdcFJ5JmY2ADj70kutwFfjoN3YGlbBVXOODMNvhnhOCzJC5j+IEV3CEw0nsJlts8QKTQQ 9aaau4PJcqd+IMEvMc4o0o4pt2M80I8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662665881; 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=x9IXHmhmhTdttML4IMmOPJ/UboAqGKu7hHbCKCzkhzo=; b=DYAS9BWN8SONU3SengSEU7j2Y8+lpkHesmhmdSXmabplEOerb6b39ywR6y3E5RVsmx8A2E TXCyil+6cLPOY2F0KdKrSpTS4gPWFLN/qsiu2rw33YxwhVHFoHv/uZ+peByU/KwMTY2rmK 3evGQo+hHyaByUbws0qqbrGHRuA41Jo= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 596ED1A0064 Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=uo+Tt1ua; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=NcWhBk26; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: ng4ocbwyfdcwmcbdgf4dqactzhxnownp X-Rspam-User: X-HE-Tag: 1662665881-334629 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: Allows hugetlbfs_migrate_folio to check subpool information by passing in a folio. Signed-off-by: Sidhartha Kumar (cherry picked from commit cd9e187858b45b890097cfcd0b2eb4bbbb9a59ae) Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 4 ++-- include/linux/hugetlb.h | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 52d9b390389b..c2e9c0cdbd81 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1151,9 +1151,9 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping, if (rc != MIGRATEPAGE_SUCCESS) return rc; - if (hugetlb_page_subpool(&src->page)) { + if (hugetlb_folio_subpool(src)) { hugetlb_set_page_subpool(&dst->page, - hugetlb_page_subpool(&src->page)); + hugetlb_folio_subpool(src)); hugetlb_set_page_subpool(&src->page, NULL); } diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 0952ea50251d..1e7c4007386e 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -744,12 +744,17 @@ extern unsigned int default_hstate_idx; #define default_hstate (hstates[default_hstate_idx]) +static inline struct hugepage_subpool *hugetlb_folio_subpool(struct folio *folio) +{ + return (void *)folio_get_private_1(folio); +} + /* * hugetlb page subpool pointer located in hpage[1].private */ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage) { - return (void *)page_private(hpage + SUBPAGE_INDEX_SUBPOOL); + return hugetlb_folio_subpool(page_folio(hpage)); } static inline void hugetlb_set_page_subpool(struct page *hpage, From patchwork Thu Sep 8 19:37:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970584 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 74D45C6FA86 for ; Thu, 8 Sep 2022 19:38:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 163DE8D0001; Thu, 8 Sep 2022 15:38:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 114AA6B0075; Thu, 8 Sep 2022 15:38:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EA8ED8D0001; Thu, 8 Sep 2022 15:38:11 -0400 (EDT) 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 DCB916B0073 for ; Thu, 8 Sep 2022 15:38:11 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B9C4712015F for ; Thu, 8 Sep 2022 19:38:11 +0000 (UTC) X-FDA: 79889929182.11.2E44C0B Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf23.hostedemail.com (Postfix) with ESMTP id 5226D14008B for ; Thu, 8 Sep 2022 19:38:11 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJYTC013955; Thu, 8 Sep 2022 19:38:05 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=GixI24Pvd6mAjGQnH3OpXlA8MSnE6naHpcIcS4mP+ok=; b=UfNLYrU7ENmFBLxksiIrkIigWFsqykZpVS0JRigP3daae43mxq5Umazap3M/IwAX9klc AsEg0Xl55ggL9MDYwaghoTqwzRjMDGy15la2zZJ39fcNimqweO6X65S6fYB81MVmTKF2 1LO9U9lxCb+trcVsoclxOlB7gx62uE3qwNfSBU2OdkX7azGuGhM8AUn2Xy3+u3SEi16q f/kwaYIs+HhxROyZ+hh/KXqbgNFB1aF8eyX7lgYOXwDs2+rkEqDVDFNbz7FdVaJiLnvI 5eInjTzZ8MwsEmHKKeWsjH0z/LbvOloE/fO+gQawnqSFHQARImf043O8B4eNI7jjq/6W 7Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbyftvy1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:05 +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 288HtegP007027; Thu, 8 Sep 2022 19:38:04 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2176.outbound.protection.outlook.com [104.47.56.176]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc6erun-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aUuUP5GsGEjY4bZediRZh8J7/F7zgjKHWeLjiHx+4zmwPfGjcEh1JeIQUmNVLtXMHfKWH01fsLMa4CtEOYTU/U9tVB+M6ulVgtgEgBhLioIXFfAkjk8cx83qgikRtyPyzMDo+kbb0V6hnAHIuVRgvbW/5DcRPYtV2iDeBE24TDpHXtxGkCkwF+E/WWKv3qJg/v59BBQAJg2M6rO1057R9pgWLAN/w9g0CSJksrieSeXnarBXER0XTSQyUAyF6wgoZ5c8W9b9q5Z2fWDKyHz3Cl5QJZq9WeH3YVHACKLSRDztK+bOMfkE1GbGU5nLCZbFiOrz2BU8uVQJ4Rmrdq2oqQ== 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=GixI24Pvd6mAjGQnH3OpXlA8MSnE6naHpcIcS4mP+ok=; b=C/FN1GCPKfZLvLc4rhfNVC+EP4cnQOMqEY2+yOx3ebtXRU+c+OVpRwooKaAaJbWd9O8QNliYTPrF97DsZUVwH91oQS9F+TKmov+NNIS2uCkVj8BFtKFoGhOF4J8iBfQnU0rz1ZEHVAcyHvxBiTtJvtpfKDLNtYmSry7XJUuy+jIU91IHedryZuP1en5QfS4ON2F3QZiWs3IE5hNveWOXLe97qITqFQ/ZJBUA7BkUwxSTrxni7EiA/XMf4zu+VdDfQL4OC4XGopsvsAWFg+OARwIfW7jhShIYRU+7vsUuCcx2VeZBYO7T7p5rtcB/GbQRPqqZJtDp1T2VrddbuixTLg== 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=GixI24Pvd6mAjGQnH3OpXlA8MSnE6naHpcIcS4mP+ok=; b=KIDi7Pg1pdZX/CLVjxl3CswJRzKfcgkHH8xMUmQN+rfnXnduvuAKOxm3c1t8hv4UL9hh5Yzm+x4b0FMI9Da5x+fy4mYDZWZpXrmNz3wHXebATfit8OsCiWUoT7NgxPVs7mcIuczKOEbhoD8BOxq1xierDs7Xgum788kSrlrS670= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM6PR10MB4249.namprd10.prod.outlook.com (2603:10b6:5:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Thu, 8 Sep 2022 19:38:02 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:38:02 +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, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH v3 4/6] mm/hugetlb: add hugetlb_set_folio_subpool() helper Date: Thu, 8 Sep 2022 12:37:04 -0700 Message-Id: <20220908193706.1716548-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR02CA0066.namprd02.prod.outlook.com (2603:10b6:a03:54::43) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM6PR10MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: 3affa7ae-f072-4888-aa6c-08da91d1a485 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gTYoQIbbKzARYFpsKaKrShC7UPNp0hZsdhOSwANKh+9YjUi8tAGOJxU/xiB4Rj/v5RKfeLzbVfvr0eRzF4qvTlsrvk4O+czX8nY7lLSuzhnKcX+hfRtD0mt2cpMSH2S7msKCOMg7oB3tKCuvmFaN5TYnZ0PmZE98717lTJURCWQvo99SHz+4/X4Ajh9PUxELp6+A4ahoYFFxauTf2vx4vEbza+W9bPSrI8puKH/6td92uJoj+K+UkHKKI6Sexs3zhmBKBPTHq83p3JBCY9Zqb/YT0PknlNwtA4WQ5Kld/XCLmCBGxRVZcKkDveuRx2LhLe0XZv2bXzMv6GklacIZO9DumsLSZRYPUW9h61bstWn8zFrgh2RQJWeA1GX/Pi/d29pJJHj23sI9rcghhqzco4nUvxKgrWBO/thu+/1TMrqNF84ISfwXQ+cwFa1fwgnA63LwVgdj5hMT8gPrtPctS2RFfA4LuIncNMqmF5FHEiNfu8YYWm0oalvSGbqbywZ4CFaK55CenesZgZ9oAj6oSF7+pN0kyzPloHepaf5kZjb3xabxGMHxK7BJtJJ6q0PkOuJyOVycT8f5Gv7WtIb3zXXYcfwO+KUw46LgzbIIV6lrLDKTHmjqvB6b8XoE6WeensJSUf+KBOguiLP6mc1VfpFhEkBsbX0nxCcQZuJsOx5o4aDBi540NUBQL9FsU1JMKEEXhWWArJJw05yCb3gXjw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(376002)(346002)(366004)(39860400002)(396003)(6512007)(6506007)(26005)(107886003)(41300700001)(6486002)(5660300002)(316002)(66556008)(66476007)(8676002)(66946007)(36756003)(86362001)(8936002)(7416002)(478600001)(2906002)(1076003)(2616005)(83380400001)(4326008)(186003)(44832011)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: g3e7Iy6eCN/UE9Uz30TX0astYRoLrldTbhexdvY3+0Wkvu2iEXOZdd19TPnbF5iA1cdiNbp6yjoUuV64ModOk1g1Qftajp5gW1HjmF+q/8i67EDtVkaphSB6FOcIx/3BG651BR5Xs7PyyJEM99geEMI8GI/M4liJEiuw/2GlkMVm6v68K7jXhxgoBcjJ4aRm0ZBxkG+Q1pILQKroayH6/7eeD48ajB3BGO2GXaPoTt2zu1sE2lzbj4JhM/JdX0A/wDf34U3VY8NrPqLiYSwm6w47svrPS/UT7e7/qPh+NIj+hMtYrm3x9ozBwOQSwjH2M9LoDbspDfhdHEd/Lvcf7p1chSN8t2gkJOwTKav2rOZ3QaI36xH5ZF/cwTpL+84/H/yhtWnZGiQAnmQZRdf8PoEjUTZFGakbHLQ+iQlbWpca+TM9janZ8flEV+FIk8Ctft0UBpXUKrDTKJbo73vqeC1Lh9+FjVEk8L4IbvfJXM1C27J/JRP7EuqUzmCzQY90nsES01LL3blcSQR2MrDyujrNG2sLNF6nYfkelwvN4aL9jqr941Uw+asKHT+4PTCMdk2ycysQ0NgT1KhXG4+nnmklZxCFjGdAbEm+BbVxkzMpsLD3vFJOWn80sOHX4l+xwbDmc6XJtdCA6w+PiZpTkEjUmz1UC9RHbEAjVoB2BZrhDMpS4mCGwzO7yezW4Bbw2iSWfs/Hljs3Bd4oR7guC3ue5FvlFe9YKxe5PY7KCiU74bB8bkQ7o6oVgtWSEP1t5+vosDGqGneDUnvCNoFhAwduSLaDX1L9F8tL2Saup1F3PBVlRgJYLzNfX02EV4IS15l05hCLsR9bbi//xMCj127Cg/fNfoU2/JrTLqHiXTRhejggpUPhk0oOQmX3AKRISRQx1mSsZqzn427BF8hUOIWQVgA1rBZRXJPXvaUNhMEqRpxKkXv5rf4E7sBnTcGpv8Qu2yXANyAdDxnpm/i5ulqd3BcGly6MYPyMZ9m5cO8GETEZ0j/9C/4TQsOedRBEKLFegJvk+a9s5SGMl1ZgF4ZNLSRtVYDhDxUCv1LgoO0xHey5x59scHpoS+aZaO2m9aH0OKPWodgHTYUkYmYygATuae714dF0/RrOSaeFGUkbcZ0jbfR8d/wmHFocFwfq1IpQsRi6VQdeeH0n7EAKRO7Xgoyq2uziRhTBsQScCZTCqNR1/V+gRrHwlpgi+L/R9kYQIHvwzhQkK12WYc/td10dnfOWuSYcZBRQnVStpd6OGoZhmPWphJw3MWTGwwgADifLGs0PsC4kCmGXkZ/MbGQ6otoMvVX9Ay78211S8/cyM2IvspK4m4au1/+TvgpiAYOeOjjaRb6GZ+PeUkYu/EIGTLFTeJui3ZsUuJsC1sf44BpUoKL3NHYJ16T0ohXuWHilK2k3mdPozaJK2wbDmj/CZICfYce7FLqbLfjG0RFe/QOCEsoPfc23g50q+lCAnCGnGxE5Lmg/831B0uIvNIN/Xg5iU8tTQneR8rQCC+FpdANF7wY4PB2KVKOcSWzfK028GUJz7ZG5KZgl9z3U4t5F0OAW71cyRSmTBbuSBEn4zv1QW5Diy8fXEz5hM6gb+ItZ0bZ8cABPB8HGHqFBYQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3affa7ae-f072-4888-aa6c-08da91d1a485 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:38:02.1855 (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: WDdKBdb8p7JlaCtK0Vim9k10Ol0/BtQ0G0Am+ZvafRnSbxv4WYzHP/B+zlrq7y5TF/5Zlc4HBKgU6sTugUB99cjwbC25jjP7xKqL5cF6BOc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4249 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-ORIG-GUID: tgkUqdThCCp2GO0TwMxuack-AQomZGI2 X-Proofpoint-GUID: tgkUqdThCCp2GO0TwMxuack-AQomZGI2 ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=UfNLYrU7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=KIDi7Pg1; spf=pass (imf23.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=1662665891; a=rsa-sha256; cv=pass; b=1vNNLO5fy2BAOkBscFEwssq9dqdGIGbIhXhgtagXe7Ct8opnLL/y2gQvLRIBVt8lkQ+Dcq BxJa8Ypx+1nzcCYnbT9/3Eb7Yx1xefJfO3X5TLmJPgYC/EmGDl/hNbZy+UlgOWff0AGvUA r08Sgw7VxdgbWUjZLTdBsazDBmqnk5k= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662665891; 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=GixI24Pvd6mAjGQnH3OpXlA8MSnE6naHpcIcS4mP+ok=; b=wMj1JJUb+TsUb/HWv6CkEMYyhvuj+GeYGGplN97as6QJADMbUFC+CCVspUZD86bqLntFk5 oVXfOaWzwPainynE0Lvrdrp1WKjX9M9k4QMAwDcedZw6D4RdEq7N+/2bcBL9zUhFCR1k/r dfNhYaRrhbQ1aAYcQjGzkg/o6QC7NDA= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 5226D14008B Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=UfNLYrU7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=KIDi7Pg1; spf=pass (imf23.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: ipdnkczadcmfhkip8n6fhzazmhukdmeo X-Rspam-User: X-HE-Tag: 1662665891-81769 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: Allows hugetlb subpool information to be set through a folio. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 4 ++-- include/linux/hugetlb.h | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index c2e9c0cdbd81..d9e08c445e2f 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1152,9 +1152,9 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping, return rc; if (hugetlb_folio_subpool(src)) { - hugetlb_set_page_subpool(&dst->page, + hugetlb_set_folio_subpool(dst, hugetlb_folio_subpool(src)); - hugetlb_set_page_subpool(&src->page, NULL); + hugetlb_set_folio_subpool(src, NULL); } if (mode != MIGRATE_SYNC_NO_COPY) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 1e7c4007386e..0bcaca694ab7 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -757,10 +757,16 @@ static inline struct hugepage_subpool *hugetlb_page_subpool(struct page *hpage) return hugetlb_folio_subpool(page_folio(hpage)); } +static inline void hugetlb_set_folio_subpool(struct folio *folio, + struct hugepage_subpool *subpool) +{ + folio_set_private_1(folio, (unsigned long)subpool); +} + static inline void hugetlb_set_page_subpool(struct page *hpage, struct hugepage_subpool *subpool) { - set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool); + hugetlb_set_folio_subpool(page_folio(hpage), subpool); } static inline struct hstate *hstate_file(struct file *f) From patchwork Thu Sep 8 19:37:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970585 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 6602FC38145 for ; Thu, 8 Sep 2022 19:38:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 004BE8D0003; Thu, 8 Sep 2022 15:38:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EF6856B0075; Thu, 8 Sep 2022 15:38:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D49848D0003; Thu, 8 Sep 2022 15:38:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C67726B0073 for ; Thu, 8 Sep 2022 15:38:22 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9AE87A0A46 for ; Thu, 8 Sep 2022 19:38:22 +0000 (UTC) X-FDA: 79889929644.04.07996FC Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 3A267C009C for ; Thu, 8 Sep 2022 19:38:22 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJKOO011851; Thu, 8 Sep 2022 19:38:16 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=2ZwJE9Txg9PnDua1OpfpI2XWocK+C9Mzt8dlocRPfIc=; b=RSvEunFIjqUOEAOJorf0S9G44xY2OBua3Djh2qmnScOAqr3AzwFAlZ/LGM3+SxdnFlTA 4XJDBrH7ygJhiNXU3Gptba2QOWYOOy5gYmat7dsvO9Q9Ee7QB0fPKGKgpxI5oqEqGjKM WUkkMHMrd6mN2L0KTZjhODahYxDdUYu6AJH9RDMmCZjkXFFeHTLtJnmrJ1CmKHWXGA8a Tc22Rq0m9ZqlWZBxn80LMizq7TVTrfL2DIU2D8z1y2VwaF3ryxmWXaddYrZgXgHC1Dcu OvpINlmsgypGab0ceqRgFGA4OlUa2OLjKrfaP11n910/7w8anLUfM9L3xKgOnul+hHuc MQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwq2mw4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:16 +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 288IN4jb006861; Thu, 8 Sep 2022 19:38:15 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2049.outbound.protection.outlook.com [104.47.66.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc6esb1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MolTK7cK1b/t/8FizHM+qXG43OOf2e8tQ2u5cf4H2Dc7Z2QJ9tFgVXzvQNHTOThbEZiBY0xE/dELqqfsyvQ3QAAoblUgc9IQZtGp/4QIbze5KxdKzrfPbQpVFGiEi4P7HcHxtMYIOC60hwer70VAsKzbBHtvFtwpkibQjrtweBU8MOq2le5x3B6tJnKAVoQK6A4nbhNSY1txnLTEy3e3QlgNblPAXvEo08gY+phkySVEh8hHl53mXpcY5lIMRbnH4wM4+I4FL99s/7NJMwywnQAoWv0EiF+i8kp9UtIrWynzbwB8IciVvIq6aoEzGCWL1wPZiVTs6HEa0//z7vRH0A== 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=2ZwJE9Txg9PnDua1OpfpI2XWocK+C9Mzt8dlocRPfIc=; b=Igvqa++ARQN+P6agIO6Vmi3fsl0+Rj6wlKnj2vnmF58J1RSgnQmLOZxkwXavVh4J0qhvrvLVbX6zarykB46BXSKbQhGM7AbLaTeGa/OVTsHUe2RighJXYRT93o0DzQZiYnQGuGA0ui5A39fFAbFr9rnYZ+5WcgyPP33EizjtniTmI85Ths/6h5tF21OGFGf//2PrLNpyVjDcb4CHNYyhgP4S+JraS8W8bh8+3RhB0Y268dGgyxKzYfPvv6mKqnF58tioSlR4nhgWCeiWv2KNtApB+jBOljdeophWHCMMouu1CsRYJLV3/WWrIr9B3q7fdElSgbVb6uFIy2ssK4GYXA== 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=2ZwJE9Txg9PnDua1OpfpI2XWocK+C9Mzt8dlocRPfIc=; b=lOybOjQ1fn2sD8L148J/bpSHdSD+zmWE3umZEg1590jfJiFNr0XrJfWhIwASkyCrI7lBXuHCuwxhc0h7ZV3jFfbhKdQS2351d/lkPnkOXIjgcxO7fkFkYfBNxHlA+rhNIs90R/Gb2NY/ln1qyxerOEXOFIp8JnDtCx72mToYGU4= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM6PR10MB4249.namprd10.prod.outlook.com (2603:10b6:5:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Thu, 8 Sep 2022 19:38:13 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:38:13 +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, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar Subject: [PATCH v3 5/6] hugetlbfs: convert hugetlb_delete_from_page_cache() to use folios Date: Thu, 8 Sep 2022 12:37:05 -0700 Message-Id: <20220908193706.1716548-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR13CA0107.namprd13.prod.outlook.com (2603:10b6:a03:2c5::22) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM6PR10MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: 458498ce-b85a-4f44-eeb6-08da91d1ab33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pSWE5lVHBFMPcW+gOv0AE71QnZECc9aTVGiuI+ICBt8HJ3jR0mOVuYn1xrzvMS7ktEOoSzSUheJlcQb5Q8H0IZe7SLvARmc6EiRttzLZrCxUysZum4RIFeTpT/+Qg/eERQTkGSCLWtfUsPKFcz/9oh+WnwIMJY49kw+mPIjVdEiYFDwGK5S6rybCL5c+hnFKw+SgAyqvSqrlXTy5bYjq2BJwmD/jN3fqFhYsFI9WyAMMW0IBlTNTfRy5oviFFz8fgVZ2aQNP66qKaR0pRjn2rqgpWdkuRZ1qgRXfpg/6EFXHVM60GYB7Dk7IAZdhmb2/jgWgo4ZA2rqULpsWP630J8RloFcoudf2R+G0Ry1sYB8SdaQvpL0exse5r+19dELSJabV3LczE75/Bos9Zxe6u6Xcdx8PqBpVeVb2j8H4wQFfMOVghPNVHzTNcbomqhjjdFX23zpQazymxDN4AmXrVFgBCtlOHono6vUP43LmkofNz6JtLQFTuo2A5txM7sKayJWQK8UYBOa9RJIgPmI/INCxTUnUYsJniGVOR9tQ21zIERafgFpjs74WvP+71O+kx+DvYPIe7wyBlmwo7w8QqQhlxC3982FzTlo/wzNEoiVJuK4qVTom/kbpxqpILK9fErTAFgqZMAbu8dCDWPfKTq1751PVuLdnDqeEN4ReY0cTe6FUWFequPaCJWJzG8+5Q/d2fyEJNpFPPwxqisS/KQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(376002)(346002)(366004)(39860400002)(396003)(6512007)(6666004)(6506007)(26005)(107886003)(41300700001)(6486002)(5660300002)(316002)(66556008)(66476007)(8676002)(66946007)(36756003)(86362001)(8936002)(7416002)(478600001)(2906002)(1076003)(2616005)(83380400001)(4326008)(186003)(44832011)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: NZS//tqCVvd6gs1M3TLwXA9E6ZvH45feEHwgeQ6rzxRXX+7mcNbWMj/gYfQNf49nFK5uUwbwoKmVbkJLMmVB/YuspOD1ezxH4Fw5mRCCYQLjspjhai1yvdZ6RoFuG1ZG+lAvZXA3jBG11w1sBVYSUyGPblKqKXd7dAex9WIIUmh+hrCUD2vSkj9nrl265voKiOHIwp080bN3ABCIV2JkRhcZzsO0f0C2fui+cjkheV01YI1Pxe6lrETBUZoVYJaYM048plvtnzDhzZvGtKTRv6CtT/Brl1F+mfGIBtbKVAogkZ9+zkEM3AqAvi1jv4x/D1wY0fMgIvpAwl99zvWONq5k8bietuWhvAAvoyfJ1xPeUTQaBjOqcBkc5FaduLBMgeI/w7we+YJHNPY/NQukCxiY4IwaEQUoeZdkFiVjcDZMO5NgjnGnLs5378Da+uwU0Dsct0UBCSLbym1n49MuvAXEYmVXXrw889lrbUmeG7hHW2o/qAZcuWcZn3bTdGAHTBX2uK1PuyCfkAPTm+4ietpSzfmLqQFxWHh5CdjPjzLnMTNP6aV4Zm+dxLLW12qDJqAopnDxsaYNdRGc3bmWz075C0exNq8Hr4bQKD65YPu2Rv30Qq4O7Vz2Lwp7c+L960WFmWkUCjegJaw4fqVnsjJlKiVeowwhILywYmiEjXulOwZPIOkH1zaACfWx3xuV2EZbpQc9lBbS28CV4HVxeT7LDX6Ue1mfTuUdCd/L1rmww5Lp0KUmPnE4zQ5Otg5EHpE5CTFm/qAzzjPlwwrU/61MceUkzVtE8IwQG+4/Xvcg7fBr4LTA8qifC7wawGjvMWuTodUl0UksQig8KhVflrM14EzGXuCjQdvRt8AMfnKFWtSynMAG0/p47jPQSvD09EKWbb5YPaf6lc6tdd/KyiTsB4wYw0ey/EgkGFAz/nYrM58NlybZyya9j1wCzyFkxa/TdHkVwKLaeF30YZaUeUNpV9x13RrN29Fb0+NnXQnQ2nudYwjIqrYgnHHlaq1l+izIiTZc7r0cs5zeNQEKS/2xHvKoEmFg+Gr3e9A5S2t6QMvOReLAINjqpwLsuNXyDnhYdS0WkZCAEMxMW+DR1pozY8pui3kROu6e5dsFFV3zkd/tIzuG+NfUy6cymKiuM4Un7U4tlZjh0l1rBZm1SKww49UnuAlF82Psg8k4/g8tF/eO5DT49QAeJfSFQTetorMuYdBhDZaODG3GN6vEshOdUCO6tV4+2sd22M6CmSHF+AQEhPlHlhpQCQh4Zql9h95CwAWNqauj/7Yo0zqHxYMIVetWRjtXtdQOQU6Ak2DLlZMNqUOiYki7RkQ6dtc18HprL+zPdRr3u1oNcueE+fHkWrSSbuRhMvTFTMFMTGv3ofSkAJPnfUz8CHj3zVHFNTJ+KYzn62M/ByWK7ITJj3jKCXdkN27YCyw1pxjqfeVs0Yv9aMjFWgG5nEXJYLL8PY5N7mfU0pBV0APYLGCxW/odufmjllfueJEiqk4wgksmDV/y+w+6cQwZHK655CJbgMAwBC+/vusYpu++nAz6WADhmLPNetUeCcUdlpqcQyBORTV+E4iPgFNhuR23Y4820dhezOVb2+pmyngQPnzHWg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 458498ce-b85a-4f44-eeb6-08da91d1ab33 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:38:13.4555 (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: qorhc0UATATP9RaEf7TCF5R2sVVJs+TsBKXV9wDFJdKi5q0EASlCN1hO00ME0RSeJDhkadiaxs06QPfMrSQyn4u/75POKDtO1vOqd1MD/Ks= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4249 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 adultscore=0 malwarescore=0 mlxscore=0 phishscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-GUID: NhwwImztZ-L9EpgPmq6qkUhrhSUpmP1r X-Proofpoint-ORIG-GUID: NhwwImztZ-L9EpgPmq6qkUhrhSUpmP1r ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662665902; a=rsa-sha256; cv=pass; b=2BvdrzSzb6otoVGUvpDimQQcPwLg7pcXZ42cVBQ/Vex6jELoNn/NedbOFWpUaTdx381MrR sdGqMCtxmQvHSmBlP2f3vmaRlVPzcJbBpzdhp8OmRV4gVw6QXQ0ipFhFlt9U4jN4+L2Jwm TD5S3i45PMIioBy518cKDeN1pYFRltw= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RSvEunFI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lOybOjQ1; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662665902; 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=2ZwJE9Txg9PnDua1OpfpI2XWocK+C9Mzt8dlocRPfIc=; b=1li96EPnnk/Q6mwlR3XzxVDyqzKILGjdINOAHeQixQcjF0MTdBnJkMAb9bFMa035PoH6vG z3qY6i6F9DMA1pTyIfDb047R5g5Z4jmS2FikVw0mKt2JLOVrdYttJbkRsWxj4O3LC+iQKC 9EsorvI7OnH1q7QUjqF0PIqh+OyHNKY= X-Rspam-User: X-Stat-Signature: 89hzcfgnkdkx9stqd9ne6yfd6dbtq8wd X-Rspamd-Queue-Id: 3A267C009C Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RSvEunFI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lOybOjQ1; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf22.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspamd-Server: rspam05 X-HE-Tag: 1662665902-620174 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Removes the last caller of delete_from_page_cache() by converting the code to its folio equivalent. Signed-off-by: Sidhartha Kumar --- fs/hugetlbfs/inode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index d9e08c445e2f..38920702765e 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -364,11 +364,11 @@ static int hugetlbfs_write_end(struct file *file, struct address_space *mapping, return -EINVAL; } -static void hugetlb_delete_from_page_cache(struct page *page) +static void hugetlb_delete_from_page_cache(struct folio *folio) { - ClearPageDirty(page); - ClearPageUptodate(page); - delete_from_page_cache(page); + folio_clear_dirty(folio); + folio_clear_uptodate(folio); + filemap_remove_folio(folio); } /* @@ -562,8 +562,8 @@ static bool remove_inode_single_folio(struct hstate *h, struct inode *inode, * map could fail. Correspondingly, the subpool and global * reserve usage count can need to be adjusted. */ - VM_BUG_ON(HPageRestoreReserve(&folio->page)); - hugetlb_delete_from_page_cache(&folio->page); + VM_BUG_ON_FOLIO(folio_test_hugetlb_restore_reserve(folio), folio); + hugetlb_delete_from_page_cache(folio); ret = true; if (!truncate_op) { if (unlikely(hugetlb_unreserve_pages(inode, index, @@ -1174,7 +1174,7 @@ static int hugetlbfs_error_remove_page(struct address_space *mapping, struct inode *inode = mapping->host; pgoff_t index = page->index; - hugetlb_delete_from_page_cache(page); + hugetlb_delete_from_page_cache(page_folio(page)); if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1))) hugetlb_fix_reserve_counts(inode); From patchwork Thu Sep 8 19:37:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12970586 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 23B2DC38145 for ; Thu, 8 Sep 2022 19:38:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B77CB8D0003; Thu, 8 Sep 2022 15:38:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B26B56B0073; Thu, 8 Sep 2022 15:38:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 978748D0005; Thu, 8 Sep 2022 15:38:35 -0400 (EDT) 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 88A3C6B0072 for ; Thu, 8 Sep 2022 15:38:35 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6E43B1A12C9 for ; Thu, 8 Sep 2022 19:38:35 +0000 (UTC) X-FDA: 79889930190.11.B570C5E Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 1658940094 for ; Thu, 8 Sep 2022 19:38:34 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 288HJKWG011859; Thu, 8 Sep 2022 19:38:28 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=rZY4W+LUFG4rI4d5PRLMZFloBvamyZxC3qJG1jaDVZw=; b=AavCC8+bTjqGH55YMY0UKLsvJBadRwn2B3DDNhcx47uKUAlriwDuzQLFV4M+8dK+CQj4 hH9AfUHtoPskd75rYhIww3e9qDNEwf4DicbO6J18J2xVLLf/+T1fB19SL28N2X97hKW8 Ngzy2hKUL1mbCcf7laYbMGbs7ZGn2wCwnRIM+TIsE7rEC506EnWLMdK7voZESfIr7dQA DhJI2W6JFnqmidTjVVUDSDu6bW7Hd+BzyAzCXuoHsHHloyTt9r7GZsFhqmmea1hrbEo4 6/oTf3cC2TVedmxzNPfF0QmJpYDzo/QkI/XOnji1WfTZrN51GejheCEdBeHEtmD6+Qbm Uw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwq2mw5e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:28 +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 288IE630028151; Thu, 8 Sep 2022 19:38:27 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwccq4p2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Sep 2022 19:38:27 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gsppA2Btx+yW0hIN1ATZOG9L2h2jViZr8V1Z2vgx9U4E2f92OR1IC0xKVuo0YEle1mVuiODrun3JxI7KwuaUS06ODe844nZk2BtNW0y98nZMljj9qEPlQXgX9SX9GDMtvl6MP/YwUMMQROct15qoZGkmAvvYjOhiPW8oXH4lpJ1AwQjicTLG2A46WUXj1n/UcDWI/Czpz5d3CCOLlizQIh5991Ne7VWEGNLAJJYeaqTL3tMUqSMkQJwaGt4tqLWu49fR5WAaguI3w7pCrYubbU+7UwpFNt27XyI5LdQ4bYQC7KHl5+6RxYm+qQv4PonvPkMGJN+/muj8hk6TnxQrHQ== 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=rZY4W+LUFG4rI4d5PRLMZFloBvamyZxC3qJG1jaDVZw=; b=mPxkSxffst4t60uOFdKamWxyEQsMbk4okRONGu0z1Hn36dpqJ6WlcNuqrY/bKg5pXyLg+/d1H8RlyR9b3JitaxXCcof8uQ6wfs8Nn8uRjSxHlUs3VZqNPRc1itcjkHDYMBerTehdzaZURfuwERZvrmmJPrrevn78EHMcOuILeWOIhNna05mViQmvX7nuHLg3mwdWiP7InJ2WZZ9A18GmKkXhngjAHcG6JRMqgAwTtjsajBXwb7i9pA7dpncuKCEvh60rDTXv9oNVkzmnGgrhW2ViFDtPxSaMBKovTBGn1gO2I7NqtVuV0hPnbTmsHdgzy6OeBinMZBEMqYgB00phkg== 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=rZY4W+LUFG4rI4d5PRLMZFloBvamyZxC3qJG1jaDVZw=; b=cTIXXaPVwF1JNmnfvWftzd4kbXPwIPVh37YciqN8fyIyhXfVCpPLXx8uUs/0cgQ1oINzOs/JIJaz7rZT6I+sf3dh7ddDW2ArmXXEHv0sxz803jiTNww/NR+QFLO/MOkhJbfCcichwaWmtHoYD6ns8izO4XM3UOb+wzoXrh1VQPY= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM6PR10MB4249.namprd10.prod.outlook.com (2603:10b6:5:221::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.18; Thu, 8 Sep 2022 19:38:25 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%4]) with mapi id 15.20.5612.016; Thu, 8 Sep 2022 19:38:25 +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, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar , kernel test robot Subject: [PATCH v3 6/6] mm/hugetlb: add folio_hstate() Date: Thu, 8 Sep 2022 12:37:06 -0700 Message-Id: <20220908193706.1716548-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> References: <20220908193706.1716548-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR05CA0096.namprd05.prod.outlook.com (2603:10b6:a03:e0::37) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM6PR10MB4249:EE_ X-MS-Office365-Filtering-Correlation-Id: fb55dfae-a4c7-442d-aa55-08da91d1b241 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Xp+3Y9FILNg7y0jJshlyQRZTgxHq2wTApzYHoiqHGUNL5zDqZPXsxIHq4CIVUlhwM2jSgfo7ipYAqV1evl0ZinA+LMwttLmMX9NZZbJk9Fzxkgko09A8JrnjSLkdW/0ysVkTAxIZcqr1o8gNpX5wVb2i7X/Tv6rDixgE3cUpwPJhzPC04F3rGEnG08RZVauTlh/zWrO7Cz9P1zMcGJs9txlzbf+fCHH2jbQM8ICOMOmYLSWQf69zLIY8tgOQpShC3cw4sFCppmTxczxEFyp/b7/siUfwq3izqc9iZs2d/8RFuJ2zR3J+nRuTrX2p6My7dYWDiLUXkE60NOBFeZRkcoO1LgXZstJ8W4NF3sqUDGwmKAAeKKdIimHborTxcRJYpcl7/tH2LbWQTmbQFfdpMghS+e4UyvTJgyxhVdGk/dQNog7JusY9A7OLmqWrnKg31a22p5GpqJpLlmQvBLacLt6GkIhMH/odmpy8vKZRdDPNjO/5VoFqFnMAJKxfWKkEf/tOiWKFM4kMNIrz3fhj3Kbd9/5i/N8BVjmAXwodu4ipDQo3UL+faOBp8A+H8UDNv3fYZ1SwoKae/Z8eCeoaw1pyYbxjagiBJ2zgDMpgIGPJJ5xP0hw0iqhLKW4Y4hQXzWpfw3fCRLWZguNSO9b3nchYhcKhcubU8viUDu8nEcU1Io+d8qNKrddtPPASC+Bp/hq5U9uGRbpNcMAIm9HvQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH0PR10MB5113.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(136003)(376002)(346002)(366004)(39860400002)(396003)(6512007)(6666004)(6506007)(26005)(41300700001)(6486002)(5660300002)(316002)(66556008)(66476007)(8676002)(66946007)(54906003)(36756003)(86362001)(8936002)(7416002)(478600001)(2906002)(1076003)(2616005)(83380400001)(4326008)(186003)(44832011)(38100700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: bQUFne8mhErBDOJ5JmINLS/jNq/l0UwyThtORygZaftDfIkoYISSzP1peoy76FuIqNx4Nlye7wWSsX77FpDWoJyFXCHCXpFW4wfnvP2eAPciCVyW+OM1931JY1WR3GrXoXHO2Fbo4IUQ9qXE4XFJ+q3tBusIcc9s10XVcQykLzrFbdXVhBOk0VgjHmVzi5p5FRYize8cEn3zIEdudqa1/tTfTYs9OOgp726molN0A0OThX3PPHp7ISllfTdeUZtjSgSSnwRBF3dNUg6Dn+Jqshy4qB2ExZHJ6uFSAuwmoaviqeeapdyoI6KUGt7rAL7NBoh9S1Pzz5U3m7kJBO2QL2goPzTl333r2i0KYKuke+6zvpfIlyHpEietM087ZQIIh0JKLXu86BF2kjgZHBjqVyKP0/2sQoOB3QVsuVjaTGK1zYQDzpsov6mijpmrY8GKGPb99eWG2cmlG9Yoo/MZtzgadl/ZNYREt72ee+fGkdRjeTPZC1j6IsNR0kCZM2jJq/uQDOHtHG0Dedvmk8Ufye42KEKKZzN0tHnQADxiMB2fdrqV76UDGoAOVX7MWLBPGjBi/dfcMAzRe1BOuOisGMiaF87ChvCIDYc7hwAYd/EeA5IDUEJjA0LBlPyLp3DzPqP/SnBzeJOe7/TYsIT3zm6+3up1UT/77k1yT+qm/KxRb9su8kh9LQE4moutrwFuFI4JN6J7apBmg4z7OardQ58E2TeXEVxY6YKXV7niJAOB73wuj7aJtsLLXDdBJeo5oNNpvUsr0enRv1LM9KxxAzPlNK5RKkO9CtJnkuoMFwY22REpRvQbdI2ocKdvMzAKyBefC03K3hCgAM4nMkQUbtnaPV9KHOEJZUItJVd5KRTcTrR0S8c1iz+Tbth1mzBLU14HRGh5Qyj1KJJyiv+ePwnP5MeQFwnBgluOvLgFPDI5RiYCczE/Dcadey8+nlBM0Ih7eHNsHF7+7Jvs0Z5T08MApofSQZRHcUCKRmV6Bkd8Xe6PcWxkgw4ajURcJDGXpLFKEFSAjl9SRZFpAy91hiWQYFm2EA4C5HVzOPLMBW0GBQNRza1OcZR2z7v0UVsBXA0yVWChta2S+1dLe0ZMf3SX3v8+CSMioQUZu22t8fru7O1dtP+M3hT1qUqIS0mXglD3l3TKdcvq6WLZ6TZdXDstdKC2uiEico47js/eQyRmRma5SiS8ZYBrfZXr/X05FRn2HeLsKgb+D24ojpTTS1dCf3lDgue4MCNWtG7Lw5G4RwvEjDBkfDM5WST04S/YVeWXWtMO3GqspnkUe6lliovyLXZNZkqrp1GtXQc1zf8Fy8M4YY8Z+jdbzhy0zy78wkvm3lnL/t4FIYFpULsYPw5kpKJm8fJMzASr+Th7+x6rNuks1TSlZDg85KC/tmWmm+eNm2kTOnnwwqV5Gsvmc2GcBdKLDe/X5xm17GBpyc7th9A75VzmtvokQgSq6E8QD6Lz16g46u6yFZwVEAcWvb519G512xbGPYXNT3ooh3Qmmt10v11J9jCVLzYJAdedcEnabG0DnjuWCTxGXvCiYrUHFbrPqAcdjsTGDgFfLdsz+lPguD3EmH7AkbZYmyQSlqeignzqFB5IVApMKWveHg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: fb55dfae-a4c7-442d-aa55-08da91d1b241 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Sep 2022 19:38:25.2124 (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: VxMt7mqTsOONKGAXhrHgskOLYzt+rav/haWEAquixKfPim4uDqvxS8VwwcivX33kYS6InqoA+JjY4o6PXOZbqKt1/Mb4Zh4OKZISyq5h5B8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB4249 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-08_12,2022-09-08_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 malwarescore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209080069 X-Proofpoint-GUID: Bq-jauHqR4W4KjDC-ZTY86P2bZBXQiDY X-Proofpoint-ORIG-GUID: Bq-jauHqR4W4KjDC-ZTY86P2bZBXQiDY ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662665915; a=rsa-sha256; cv=pass; b=HwWE3677U94F90qJVw5qxHx/RHJx1emDLPHhj2apggN6Ww0jet6RV4leglrC+9BppDs8RD 24nV3FCxW9mXYA8F7i+fX+Sn3RrA+T3oadZcnfVz6mKaSALwRXDtWCBtDRj75p+kVe/nBd BejVljadn4sBzyj6Q/VxEzEYyg6fhDY= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=AavCC8+b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cTIXXaPV; dmarc=pass (policy=none) header.from=oracle.com; 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; 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=1662665915; 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=rZY4W+LUFG4rI4d5PRLMZFloBvamyZxC3qJG1jaDVZw=; b=28lWictEYIxMajnvJjf4IcH6QcxDdId7vRcR2PVhVYw5npoOgrqtrpSfn6UHX8UlglxcG5 4I+hNZexejXhawjQ/R6lCXOU5FA95VuY1fydlEwwYH77rDbSGk/8YRsgHcnmP9Ay+U54i3 3odY00RKzuzTd04eBNnmQB0AkXvPrAM= X-Stat-Signature: p9af7pi1px641g6mex77z3ftkpajtd9g X-Rspamd-Queue-Id: 1658940094 X-Rspam-User: Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=AavCC8+b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cTIXXaPV; dmarc=pass (policy=none) header.from=oracle.com; 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; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam02 X-HE-Tag: 1662665914-337781 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: Helper function to retrieve hstate information from a hugetlb folio. Signed-off-by: Sidhartha Kumar Reported-by: kernel test robot Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 14 ++++++++++++-- mm/migrate.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 0bcaca694ab7..f59e8fb3f937 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -850,10 +850,15 @@ static inline pte_t arch_make_huge_pte(pte_t entry, unsigned int shift, } #endif +static inline struct hstate *folio_hstate(struct folio *folio) +{ + VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio); + return size_to_hstate(folio_size(folio)); +} + static inline struct hstate *page_hstate(struct page *page) { - VM_BUG_ON_PAGE(!PageHuge(page), page); - return size_to_hstate(page_size(page)); + return folio_hstate(page_folio(page)); } static inline unsigned hstate_index_to_shift(unsigned index) @@ -1057,6 +1062,11 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) return NULL; } +static inline struct hstate *folio_hstate(struct folio *folio) +{ + return NULL; +} + static inline struct hstate *page_hstate(struct page *page) { return NULL; diff --git a/mm/migrate.c b/mm/migrate.c index 6a1597c92261..55392a706493 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1589,7 +1589,7 @@ struct page *alloc_migration_target(struct page *page, unsigned long private) nid = folio_nid(folio); if (folio_test_hugetlb(folio)) { - struct hstate *h = page_hstate(&folio->page); + struct hstate *h = folio_hstate(folio); gfp_mask = htlb_modify_alloc_mask(h, gfp_mask); return alloc_huge_page_nodemask(h, nid, mtc->nmask, gfp_mask);