From patchwork Tue Sep 6 16:54:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967818 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 659BEECAAD5 for ; Tue, 6 Sep 2022 16:55:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A379A8D0001; Tue, 6 Sep 2022 12:55:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E6536B0072; Tue, 6 Sep 2022 12:55:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 860138D0001; Tue, 6 Sep 2022 12:55:51 -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 73C1B6B0071 for ; Tue, 6 Sep 2022 12:55:51 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 4E660418C2 for ; Tue, 6 Sep 2022 16:55:51 +0000 (UTC) X-FDA: 79882262502.28.A46E697 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf25.hostedemail.com (Postfix) with ESMTP id E42E8A007F for ; Tue, 6 Sep 2022 16:55:50 +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 286GOD73004232; Tue, 6 Sep 2022 16:55:33 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=TGEI5kIAYrozvSp9IMdKSWlWUmrbI+3C9OHtM4YNLNmqrtrdaDxQ17oFBHiL5NSZ2li/ Y6UUJofFzPnsvFn63CU2TI3b3d+2R7TmtdAKtWx74AmY7dTjNdDmBe4P6BVxFM+0z/ux rH4XOCBXHMCdcY9EQZ1ZsDGPWMPLKLT/zoMovbw94niBYPlguJOj1AEIzhlK4bhgaaMw +Hc5QsxbzgzlNNDtzwD7exF7mlOAqyGm3mBqriLWZM4RnoC4S6/pqqgk+3q2nosu6asg NHtfvxtdqRZo1oqmgDiAtuqQ7mq5cU/aV9Qon4i/qQVwVfpk5T0/z/HVvB+UcksKDSuc 2w== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwh1eg4v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:33 +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 286FASQV030608; Tue, 6 Sep 2022 16:55:32 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc35tys-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gfCSXQHGYF0/0VLMXAqX7UYIN9LTOcFAaB5WtgzhC6br7dJJLC6DU7ODx7l/fWPhxDPewrQNqko+hPRIBhlipg+s5sRqSyLWuXmIG8nJEDq3Q2mWiPoFW/6AwVesoEkZ/OT2naRI1s77i/Y8OeKlE8KxAneajQS3QMtyLQmh7bj+YDyIMdIIvUpgVYKlZMWwyGyWx76twoQxjxCRGcBwEBzQuj38faTh7SdhyMC5dMqodw89NkAlRRDN0evsepJwpxObaFDtZ6Hiozn/mFQLd/pD5Hq7kaXXmxRLVIJNsZBaX2f1Q0G5AE5+AnW3/tXl78e1F33zx6qHJ1RK9HU1Pw== 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=PgwOMKOt2oCAUZDJeldZAlXtxmp27SmjaLIQgplQu+A+J4HAgwWv+N0XcaJq4kxU2XVJooMgTQxPOZ4QLNbytbujYcnseSuLPvwbdatVfU7X70zkAvaZdZ28GO6RUI+CbUY70BKxba5rOzS/CkJY4Nrax87ZZ8A3tujXOdzatNKKx7Hs7Gs9IKXBYWH+E3y5rWe+YQbblVn/w9Zdfy82yDbvx8ExRjeTYNocjQAedXeZclH6vPYkzRfH1Xbzg49aj4SfF02QjubzIpEhrknkRhjBu/YsftiMBbnRdMY1kPnKA6s9LekpdI9p4P3nq/FoaHIk6XuakVu406bAyGtFQA== 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=E/Cr/MUrBc344wGI0NbTZqKc7sx7xGS3yszxAJvHcNVU1ZXQJsxDQuKpzJI4a8+izqyFCUkTajC89IEHWGVp8LX59OXAqMZ/VlH3kXsbKQGYtmC4xIwqQ9Mm5hCU5x9FniTI6HW+hdi7X3tpqheevwNrU4l0lNl49bsgKOYkxHE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55: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.5588.018; Tue, 6 Sep 2022 16:55:27 +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 v2 1/6] mm/hugetlb: add folio support to hugetlb specific flag macros Date: Tue, 6 Sep 2022 09:54:40 -0700 Message-Id: <20220906165445.146913-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR03CA0004.namprd03.prod.outlook.com (2603:10b6:a03:1e0::14) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a705d750-2c29-4db5-d154-08da9028990d X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +WgnRjzDUEzbGUlj7+tjsULH/ZSKshWp+H9rZ2gjnvb0NvfzfBV9vCOYFtL4Axl1kN1gaAM6k2qePDMppT3wRaQqAfJVovKMvrf00MZI9g7O0vp/BjlsRFotCPZbo2sbuNcEJidKS9VwwHrffLeGMvcGOrEmhG7Hkf6Enrj+/Q/gITRNhS1GYKzqw8um5zPR6PFQFtrcZet9F2Bf/k9WRv2LP8ZsC/rvrnM0bQ1C7tqzS3jtmPnqtBOiksHZawUwiGQi819ExgOkaw6aeu3AH95+0nIZon6qkmfQTDjZC/qFVypo6f71Sp8P95W0PV00wmEVbAIy4L9wpHHvWW/CDEN+C/86sR9kqpjyd2f+S6z/UhliXVHvNjBr2SoXoz3JqZPz1g4+SECY2WLLH1iM74RmsO8cJULOh0+7Z5w0OQMvUImhQBatm4cza9i+NBAlIS5rmfilprWyZhr7MhOCqSjm59nCECD+gF9kykRTaO5NAmFeI3Ir9/US+ysGlsoTki/0rCOuM8TXqlLscywM1mOE7vvzTrvH7oN+emyM+hLtAnmSkgiG9ZjphcCX6GhwtZCur72criYbrYwb2ZXTIdSn48jjsgRlvmde7448+tekIr0v4752IJ5jdx6P9xx7Zn3XpoGJ1YH8vomabuS1jhbMG//JhgZwLHrOXYddkiX+Oe4lT9ojT//VmWedt1LObmBO/1XbTi15iYawTaVoGQ== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(6666004)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pswgapoqSfs726po1pca2heOGkXln4KCgQCiKFpUKOPncbsJl3GJBgEHaBCKquyrTJThuoc+7OJehUfR7lqSxIkLDkiElqngC2Vd6pmDLgekAaA37w2Wm3eU8oENKiIrbrj9bjIpH38ymdBgCx6tgl4gMrecJGizfaaJ/aGpnowCuQsVBfXL9GtSkVjRMMDcvuRZymaJdALF/J+D3Twp+SJYtCp5hpDklwfBt8NZVS/lEa8uDNVOEZOz+wu27n63n2CBzai6aglrTk7JJ5sydvYmYIAoDs9O/jb7VKwoCZqK/afv0jHZL1hv4QaMKBUt/QtJmiMZ1ymAKlQWSDCklPwftmeZg0Chmucms8kab8JJ2OKjbZ+8MTP5Dr/LKcLVjHaPnT/zsdXDwGJa7GZZ33DG6QYnI5JZcff/dRa3wvg/N6Hi3E2bpyylubTWlAw01v9U7Ta7LcpVmVa8vHmWWK4cPOjgT7ENHE0n+uEbMe7MTXwpPAv1QRtRmsUgenkHG8gXHwxKOe0EcBvKRFUVnmIIDnclbT3VTvw/HGTMWQNH6qe98BSpOgkmF7KHMRpm6aoR910BL5F6ZXgv1P+ibKxf41a9o0htyk7fbBKZ0TgwtODdP6IpAqk1JeYNxjeCcjESffAS1h+9WJXJxypiGVu7KfU/5Brzj1ZcyVjRPdByMY8aV/Z9RrHJOjEAgWCmssUW0qwMwIHut+lQa3+f3lTky9aLupmcAB5pK7QPOYVVEhOZUBI3d0e+RNeEdBFrqla7fX4CPqJIK4fsl6G8+YUmtTq4MTDb616D4ws94egfZjGk26IJNPSlWLSwcIUKFYe/of1gDAf/MNFwzD1Af/S5EwlH5qflrvGCoZ/HBLDzHqQ6Iz1wCT1E/UITFlLLxLVdjg3wzSu2R+8TZt9zhP0ush3gDvt0vpJDH1ys18AQNA1VS5uNQ/ANIWi8bHBeWJk6m+5Ypz15WfCf23UV182v38+be2oQHlKnYpY5Vq8ftVR0g+TwJS1xdlHy5CepoEv7pMSowWucdOMYaIJ26e3PirHNpbtRu1t6n5KUSGojQt8T7+9o3js6ntltJmT5N+5kKk736O9bI7QOurGxR1E39iT3+Nf9ZGIIv6bH3XegGmhEl91whUhiausvBd/p04CWsdQHBtWaqLzT3l10ql0vxCwpPl0sNeCPn6ofeL6fZuBxPSPKENlcqJRnWGme9VPGyJMeOlKKPEqxi0LMqJSyvVBTa4Z1wHqm+ofugiV7aL2bqCe/wosuiWHZmIPCskJICJ73ntTSoDFVCg+03CmAxzpl7sFPUjCRGvvHGiSkTSXIEmmbzxLEVPz9HHpZm1E7s1lPLtv7FmHkDQgudKGZj4zDgZkPfj95UwPm9txuGnH1qeGTWZjmf5FTGpusMrVG6U3i+APRC8BMaznJfnuuC8lPYv9C02A7cOkK4aQOuZTCc+qn4Afj0O2D8ygxpMgYjek/sfhYMqtoseqPaKlxV9FaI4RiuUfEAofWoewKDDezCbdisppuNHM3PD74p+wGKZnVkOHJdWmjOK12ORPT/2U/4FSnz5OiYUsKW5eWqdQiOS0f55J1sV8HdGiXOFA09yAiZAfnUtONA0G98Q== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: a705d750-2c29-4db5-d154-08da9028990d X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:26.9601 (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: 5m7RWlhho7rF2AI39jxovT9Gw+aD8d+nWprUZ/gB2fnjxcLVYhu01aaxzoBpoO5oRNUWBIu9BAtcB1j2fm3K8MEfPbanTpO3kjyf6k+P8PE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,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-2209060078 X-Proofpoint-GUID: cuSC_V24d3X8uGAArx6_vdOtg7-nOBVM X-Proofpoint-ORIG-GUID: cuSC_V24d3X8uGAArx6_vdOtg7-nOBVM ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662483351; 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=sIfHAO10rNDxMaCEJOV5LRSlL925lA7HnpG1b03CyB1RQuSHSpnliwc6XOuLyl+pRyN7wL 1mRq5SAmEa9ZWIvTgqbmSVZEF30yd7tWoGvWybBPo2XDahxmzJNcK6oTMi2qM2eLGssMRy y7VR+hfHoUI7PMwCJD6M0Kx7umDsogE= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=TGEI5kIA; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="E/Cr/MUr"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662483351; a=rsa-sha256; cv=pass; b=3UzExBQ9UMsDcgNiZTKI3o8wsscohJrPLzm0qF+QEuqaaWXlkMIW6UOu/OtSiMubA3fwKA PObdp+Lj/4C+8fi0AQ9mN6onRiDbWXXJIUkDRPma4aq9WVDP+D/3h35XvnGMLxh2bW3zrW yM9j5Z0Fuf+LHKuJIksqVYjDeVN8yp4= X-Rspamd-Queue-Id: E42E8A007F Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=TGEI5kIA; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="E/Cr/MUr"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf25.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam02 X-Rspam-User: X-Stat-Signature: i17nf46biqjjho6zr9afu6diktazper8 X-HE-Tag: 1662483350-981929 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 --- 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 Tue Sep 6 16:54:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967820 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 30074C38145 for ; Tue, 6 Sep 2022 16:55:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D42FA8D0002; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C60568D0005; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D54E8D0003; Tue, 6 Sep 2022 12:55:53 -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 7A7618D0002 for ; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 39BBD160804 for ; Tue, 6 Sep 2022 16:55:53 +0000 (UTC) X-FDA: 79882262586.30.BF61637 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf07.hostedemail.com (Postfix) with ESMTP id B6AB24005B for ; Tue, 6 Sep 2022 16:55:52 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 286GO0sH016827; Tue, 6 Sep 2022 16:55:34 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=SR0qwnu6bkcG1Ir+/EaDZlbtVyNwvv4OdNZ597azFJZzQRVgcEU0o84VQkR08u2C2X0g FAVAwTGLi5gvEIyCRTV438dhUxRqzIdCMsSjLiIhley6jD3rTvL0qiLHQQgoKa5/o9bp pjIBR46EVJZ2i2DMMoKak3U8US+cZcpA0g9c/uWoFGx9iydz/ZuREtSLpEP2foMLZ/RL +otNGUS2qY0RqrAbh1nG/TVcbhA5zgIHuw9yxCLajEAbqrl5b0NlQQSU0YXu5IfkGULZ jnxU294nr9tlyqFczCZ25X9isosTYvqsXMu3PCWJ0UumvDR2Ju8wN+u4fO6bIqCASJte +Q== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbxhspg8a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:34 +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 286FASQW030608; Tue, 6 Sep 2022 16:55:33 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc35tys-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I2QpmuHFkxVDkcqdddJgfSMpeVkyJKAK3I34l9ueZCoor5m5jRJCbiNaFVCZEY5Bl+m+NphhpDTUzXScv/GGhb0uSPQMGyGcyVlrJlF0PhutSGzgOrnBIPe0IvNQa76iBBuBePthMu85PqxTNvPaS+YqeLBnJI34sMKgT95qasFaw2XkfdY39Mcou4LtVS94ZzbokjRRar1/p5cFbgBc3QGgwGIyqlOw3EeXwYdSz8DxYmElTIwVxzOlfWaXztKF1lHhEo6U/QeMZ4vAXaBGZQUVIwQXmaXCsexBZcGDJpvdCkOjhlw42W8/oodeOxadatlhS63wYdTD4uhohXLUQA== 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=mcMFxFjPftNNPlMhq/3VdTKD5Xz0iav4oxWxBOAX7yy73a4exNEEOnkD9DMXqV2WevgSjTvkVzV/9KM8bJZjqPH32T9MoafJ4z7SHhwjArE8KVj5VQDlsTrSTS58awZkP9SJQxWoSf0gVh5xUBmpkALIdFSlPDGWnMMmB1J+K4Tqsve6yvmj7mrJifH621YoinEi5MpHSzrnRisyQIhNPiBGtdMeSPma1o3S4mbBm9a/Il1+fJY1qXOVwEUpabXhTRK2UbFd/FWpRaLaUU8Eqk5ima5Sq4zt5uRWXiqEq5q8d/y24N+Aax5yvTCxdErY4MMraDBRbH8MXf7MeHuDAg== 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=rM1mDEqRnVFj08QyRuOf5jylWGESoyrxRPyT70/qQD2KBRZf88LZ0V7GSbpvyn8LGOfs62zfsrejxaS4UTbymwBdlqEdGh4Y887eBFV8u2/PUpFSpBh9vphy4mLZQI5e2Sks3RbXKQpfOO91a5QqHTLRQd/CsHLbwSxE5RZdCG8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55:31 +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.5588.018; Tue, 6 Sep 2022 16:55:31 +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 v2 2/6] mm: add private field of first tail to struct page and struct folio Date: Tue, 6 Sep 2022 09:54:41 -0700 Message-Id: <20220906165445.146913-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR04CA0010.namprd04.prod.outlook.com (2603:10b6:a03:217::15) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ab78115e-ea11-4319-4c01-08da90289af9 X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: n8pkXIECAWOLfKSktgDsLzIY75kxRqLkSaX3YgD3ezB7Ig3ueMQdDzEurIKFCbzQ3oJ85brb0d1HP2TVYFWwxvT08lqCF9BmWpO6bl+C+naDARhCFIEdniuXqjjkdgGplkEgltDWCW3bKAu5nwgbxrYDckg72A5oNz/RcpCDmi07Z/Ns5BOh6DfnHhzOjrH9qAHJCaLETgG7KZfBxw7DiIQVKbOecyOyjAURVX+qePZ7pukR61EmhFe9bBGHNcRj/YTHK6TQ5j795G+GvQpw+acJbogMNNAVRP8+YtfUXPz4m7bf2DeJ20UOAFYivkgF+c2oxzOgYJwHRtDS8v45WAkLF9REuwwuajkck61e8DJuY4rYsCfIGyhE7WxT0RVsiZewPOtpoXqGhBidYeQQWpxTxDGb5EPs+2uYXb4VdalNEmDcgk6pTM7yL89M3zUg5c9+pne0oqGz0xYs/sbrgU8u3guUm77iEnDpLEG1pLmEQn61rmJlflsUuKohr7jKsSpyY3K3qV15Zh33INQCwKCeeF2qqOdOLzIyWx9p1tB1Rp1BSfNO81y6BEV9B3vihQmEdkasipkCb9veOZLTerFQIfZcqNA0kfUsY3tuuusr4jRGekvz/PyudqFWDDGnRjsU92ood9blK+/9O4waXS90siIfudHbiHzmjcJ60Z4jGtWN3srt9OkspRMycm2Uipx8csitA4z2qZmpa9CGDw== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(6666004)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8zornWPPgrLWStCjnRFVqvQhbKfVpZ+ozJdsOxqVMXpM9CcwirFOvRJWC0OVtHQS4/F6I5ePJoVAoCNryxClZvOuIbjyX0P8MzOgJU6OgGAoIg1Ke1Kr+tN/ZrbbEX49JbPp6dYwsuxBvetBPLGinHH4uw7niAGCwDW8FUIQTik/3zIqn8j81Ztp9VCbEBkK4t0U0175Y5G71JKQze6bjixELmoTh5TcuIkAbVVaZ+MHYZ1xQo4qIwxgzbL2lpXHJ5l7TSkznpfh6U77aIi11DDxnQnCAt8RgmjWF7eTR9LPdZqDvOHdXX5q4VNppStYWqCQ/0yUYbvImaIqewoKvDvVARYe7nFGdcv0j1rEFqj3KxHBczW0PwGlQZXxznYs26WulOzZATg/JAFJfmRLNZvqiIH0ug09vSavCUb7cM8nic4nolj0DzKitSYYKRH9jMJUK07J+Cn97NHtxW/rQZK0q9Gz82FqG8Qgj8ro5yDdZzoZKQueft5nAun9oreP5gq9bxK+nHUHeNDtevKE0eCoW36bCZiIvqJfq4WDYk4yOPI6CPo0hqQSbvGPwdjclBBFK1sO2vYPUTTzPjlHGHq0pdtzSIn3CoZvtl069tF9Y80Q7o3+cYY1z1Iz/iaCYTsy6gsbdG2yB72t2H6ZhxgQlMzUaRPz1vD7IAsrmjRN2KEH4BBIvZhUwDmVSpP0os+wFkCWqGHSrDsFX8w5erqOlx8f/m9zyoV4JSJVWQLfMwTRi3sPM0r+s+ayez2bAMy0LvFnbPn5k83QTUhBdVvpeeyQzmB1EiTZ7LoJ60SPdTIOKe674TQ0Apmgg/yMMyPVomEf7p48LXvm1zr8W8iHm8X+xggEQJUfcXyKjgiM0fQGbLDg9ejVchk/x6dyyhwnxhBUwOoDwJzDrdKQdJJNrzY9PqpSWe7FGAVZs+6z2vO3JAlR2TzQA3TOf0nB+8P0BgKD9s3OBw2Zxe5akq30VimSm1iPJ7za7FFyXfBOXZLvEpaafYOJYoA+eR0Nkw0QSo8LzoNIgRncHEaQ0JgWCpaxptBX09df+uSBEtgIjJaNfRgY18ucU1tp5Y9tDj+g7Djo/nG9Mt3l4o9VEQ38RzydeuqKoyzD4Rpo6hJXuiznv9YbvEPex6nko57gjf7NY6o2ytZED5ccO3UG/vTuEMtiGpaw2P3GKZpFVqqA6r49UY4shgeHvi/2IvPpP+iB7XBCdD48+zKtIGnmifUggRf4jkZ1Fs9PxpugTS9EKHgcNKV0b5u8saAV9eh2eWDETfUK5eBlEJp31WbHF/HE/rB/tGAlY7gUBI7vrAD4tOYd2eO3aK7HtImcU8mLQCe/009ya1/K9+0XhNFkcdFfUIaEebMqbkGTPRW6Ho0dfrstXP9SlEIWakr8IeT8+VNqX5MW9DhKYbCQRrL0g30pzXXKzyHbMcEUMlpR25i3QzT5vsb69ZjCB78AJwvLvYskcm5vYTQHAAvhQfFeac2IyZhFLiNqZDm+RKA/wrRljoW9/g608OVO95Hp+mMaZpE8xIunjnQK5aOPyX9HZS0hhxVYsUYnaTPYLcWFagrO7ZusUVgitOU82tXVvoJGGEgscNGwTvV1lmSYgPJdtQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: ab78115e-ea11-4319-4c01-08da90289af9 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:30.1966 (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: B/op8qtOT/Z1xgTJKX+rpw2NygHb62OIu+hFsvpU8IVunx7CylyMHN4/cOJtHwvFfgMq4K2W3ce9O3sx+vilID+URiUBLz0KotHBmKDe1H0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,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-2209060078 X-Proofpoint-GUID: 7jsV_ISRms0c6f2wcYiaXjFKOsrC9raQ X-Proofpoint-ORIG-GUID: 7jsV_ISRms0c6f2wcYiaXjFKOsrC9raQ ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662483352; a=rsa-sha256; cv=pass; b=6UYKvz18dhpsywf35Y2cT4scDQqu6iwBJBV3g3LjMpR25i5TztzdBDoaljuSVA0CErKYHl EPjGnsIEniJgYG2/WBlCqb75Bsq0twcQ/zHGe4AD56s2rDE+BY3EzvQj1c8nfvK5mwalyY EDIowAbo7ZGgPm0+zfUQAJGhQ4QrR4M= ARC-Authentication-Results: i=2; imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=SR0qwnu6; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rM1mDEqR; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf07.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=1662483352; 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=vsIiOBDX3hZc8CFwM+gV8//jrQBEMD8RlngUZw56ZXBoZpynYgOu58+rv0/uDvTEx6R0De OnNTxp1p+Zcu2c4bQvw1ESRZkQPyUynJylvtSmIvgF1jc8rw7qVP1U1gYer1lPR1+6Hse+ iMlTZ7EOTG2n9x2c045caxXLg4IEu7U= X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: hnpo797qfd3g397xb7s97wzee5tbzqpo Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=SR0qwnu6; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rM1mDEqR; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf07.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com X-Rspamd-Queue-Id: B6AB24005B X-HE-Tag: 1662483352-360702 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 --- 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 Tue Sep 6 16:54:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967821 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 C8CDDECAAA1 for ; Tue, 6 Sep 2022 16:55:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC0288D0005; Tue, 6 Sep 2022 12:55:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B23898D0003; Tue, 6 Sep 2022 12:55:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83D0C8D0005; Tue, 6 Sep 2022 12:55:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 624168D0003 for ; Tue, 6 Sep 2022 12:55:55 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 2DFE3418E3 for ; Tue, 6 Sep 2022 16:55:55 +0000 (UTC) X-FDA: 79882262670.29.47C26FC Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf11.hostedemail.com (Postfix) with ESMTP id BBE6240068 for ; Tue, 6 Sep 2022 16:55:54 +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 286GOD75004232; Tue, 6 Sep 2022 16:55:35 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=9nu8AsIT97IMdLKxrlU5M2PHTU4lWf/JQLEJtfxK/YM=; b=2Ld8mqOWznPojJi2fVeAEc5C6jX0S6GqOI3c9XblUsh6r44yEDHPwaILPc2ZkJzjqiKy IHNURpxM0tRTYXy2TueqkkDDkEHmeroOf091Wi3310FZjN+uV+LywqQI9h1nQC9YNhzb gKtDV28BnheGacvOZHbW7O6AlqvkIJddJoUgPbZapgLka3uSDzY7M2Po+DyY/0lBVJec s8bAmkfshhAFoQ8+2jPlvYLRIFfbuTb/mcyf0ZqWBR5f1yfHQZRazkOFC1MxhyVCWddk SHUxi9vqUxf5IX3GRO8m5ZojUtTTfDTwXraGQZajc5NXdBVXxUfC2TlWyAAwRzNl8cf3 Hg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwh1eg50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:34 +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 286FASQX030608; Tue, 6 Sep 2022 16:55:34 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc35tys-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nKRNxSeXJmgaoFVBbqnoB2sh1kWEBEI55h0llkArBhwIxZgXoCrqwBDRlXgy1iKU57pjmHf5OW9dVdbecdRYnKZvJzMd81Nm66dId7rdcC4J3z5TZR6kDxVB65wY3gcLWU6yaUIWkBqek1VaFwLIXqzzF6ClVvv4uN8U1sOsfQPrAeKFiyQ1QF1CKRh1B/pjiISLYMmqWIQFuN2yLTv/XeQecxZ6ZfyC5dXmLjE66vf0HdocT+FtlJRc/viqo8zEt6J0Ep9a3k/kolt1/oRvAPQXN09ovxWHbxRLQ3mfuAn7QMhgkwubv1FYUPB7bofmOCNwazeYbYdoxaJwvBK8bw== 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=9nu8AsIT97IMdLKxrlU5M2PHTU4lWf/JQLEJtfxK/YM=; b=FsVs9E7u2zEtsQOFM/7jg7gsLDhZFK31yIyby14S/CVKS9lrFpRK2TmhC7oWGbBydrPOVETdt3jwvhEinx07IAn6aYkfQS9aiFQnuM7F/3EwimEIMBiIZO+yHiz9FppLpddPA82wcy1PXMM+PP0hQDhgwWwtosUgCfhybiithvaTCLnlvpOQScs5moExJ8pkxHaiNb/bQLdOUaXGM6kz4KCaScEcWj2YvyNiTdbsTaBxvHiftbzMmhK+/N0g31V9q0cG55J22VZDToFeYS8efRnfdlhze+NSh+qZ+ug7atULZ4WmnFqEXcKKM3Bc5KiAr5z1Rp5b9oEH1O1jYG7+3Q== 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=9nu8AsIT97IMdLKxrlU5M2PHTU4lWf/JQLEJtfxK/YM=; b=VNrRffFa9l8FQ2/cGjdNuTrvu6KyRUthsOEI/4liXyhIioRGfVqylLX5/l9mw9DgBDaquxEpU2lLB22hx7dmN3090Z6W1+NR98ldfmY5lReO5nYemM062CGsL1umMvqPginXEXo8IF8xyRqggJHnAEqdw+Qtn9JEQNH+AQGShuA= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55:32 +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.5588.018; Tue, 6 Sep 2022 16:55:32 +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 v2 3/6] mm/hugetlb: add hugetlb_folio_subpool() helper Date: Tue, 6 Sep 2022 09:54:42 -0700 Message-Id: <20220906165445.146913-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR17CA0026.namprd17.prod.outlook.com (2603:10b6:a03:1b8::39) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afff2486-f415-4526-91bb-08da90289c8e X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6QWX7jsWJYIfBgX9tQO7Gvh51y0OIxG5NR6DnSWR9kZN/HEnQmaNcMz+cTYwFTXO3Jgunj1miRbFxWFkcBwbtxJkJmjAfRqzUlfdktyYBP16YcMxDYdKv/ENFx04EXCAdzy7ue0bDQn5cGoAwJ8qK8x2vXSxBlrPQ61/vzdDTHWWPwCVEGcn/nP/n+c4T8PWWgQgRXsZnjsQ7kyH4nCjvjvu9DFqBSzSpSLoJa1gModUuaJNTbpODtChw8xeEHVbAsqWsQ/hESMkWWUDCPWPvBHFlYcj9EB+OCVL/5oe0/LKO3wscxdyjIYVTBtlg16tUm3blkVZR54tup1ZBualXnokimRrPaVY6gMmDhExa7ULw4OFDzB/PsRoNoehGJw/JiYu4DDsr/3/p1fhx23omO8wh5XkXLTty8R/UGpfBxvY4e74enj7nDHY+kRHn+3jBOksvTwaGt5ciUyFbxg95cQNatsm+l2Aul3zDsgS2Fy/lJSLW5DDTquvM9P/gx0Cx89S0D72D6zcvL3mP0zRqRVbcvm4ig5Vt+fkAXSpUF+mKMhCwUrLnXoHFWB9ZWdUM/d4KmRxlKCtFqVKnMo99PI+NZWTN2yQFjoymFD2fBU6aV+mu9hKxDQkZIEE2SG9jzIvorik88yIHTyngBBaZNdOa69Vox1N983K7CFrVF/7mwBYjxXl4lSaQrmzrAxgUfEM8jwXxCffNyYMlkVDpg== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(6666004)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Dq114ZGxIHiaMGqGupedVNrvV4MDwY0zX1q1VipGBwFFWV2r6jnROJnOZuhm1hec1+kBkDM8v1v1dQ/kkZdSg5b4fbWL+I5C2bmv4CzVqbr/9CUo69/kxqnioTrBMuwovLi623FdXoknZyGkryk9H3u323i3WBeBwwzRl7xwp1AOHeMoVoTJaW/XuOFk1BXw0USHo6uv80uR1K9ek91O+Y+Glo+4+T5Ek2ZTIEnz7wAMUbiZsL5axzyNV7XVzYv4fPpePdGYLRaDpQAoLiSvWwTRcdjJn2PdYhEaVhIG1miofiaffj7kargS36qQeG0IpcC5JUvDj3wvhutUf0B+rBiAuulaaxcKsluvFzujyjVaDN3oPPZOTXW4A6QZ42wbfSnOL74NMORY4qZTRRGM93VhyUszVuOIIUVCqWI42uCmQfL+S4kCKOnHWK8lshv52eybiN2J86uI40vdnm4QDtysa1bxhn54moU980t5vKRhtyCEG/X1HCRlfuqi/LrDlSjIJHXJYWmCiQ0crrKtsh+Mg9PcAK+us1z8j9z/xsD6NnhuH7N7oXEfNVyJGTFUJ9pGqdBzRs2XwyhkW3VMALaN78s9mz+WBle+S7io8k7sOZXqFVbE4xs+391ffqiwdATPFoZHFJuVZ1U9VdzKeHiz1g/GdrKLffs1HuR8RI905Mx1k7yH6buvUGkGPtRPPC7dy1F5GkqVeO8V+TRRMpy4mTrvT6rGCuD8swIxZoGZqUWJDLqmfLChlW8aSTqbZDAjxlC7F+iemJRtvru3MMlyjMaMCQr0cYOVk3xMLIryfxVVEnCpOHunG5ApRdLX+5jiokCUAkvycgNQ/iy8FnybPyNRx74zcTOX9C+vteAMQTgjRGkzMeVzWLMA7qYTgLZZGQzi7RF1mQYDQ0IdSl042wvfODqUoHBcszCcLmxvCsvbgsO5GLDSOOsi9yb0RCKRSv6q6vhQHE1h25CshmXGgjkkE8gEy5VpZnu3yCUM9IuzVf8LcB/g0q1D8bDrkMjyRyS/4yGDUz8jsV7KRzhli5piMb96W8BBWk5VCFQW1drMtsknd71ZyGojsz87phc6ZJSsXh5BCww250yq2xYd73anDPIqorOhMIrL7wMsc2cZgnRZHSLtvWNAjL37I4bmm87ampPBcFLDYmExygxMHL0cfJ6JMz32tpn9gRk9dpuL21vYBVdsUzLxRPeWvgi/7LTfD8VP4D5EUKPEI9RVKjWU5SvBmOONIvzKp0C0nAUqvZzaihAUx+zxlSjUJ37z+krtjUGl++WX143YeZrKnK8hos/x8OZkRFqfiMuFvIzTr3Yv29dXLnKtzwQMswUyKpCulc2UPodsf+WRZQX+qn8RNjwtgn76MF2HVnDAeoXiEb5aKVpiW/0jUArTgcDZLzhkYmqrtMyIEA/63SjNdfiZDf3bUrenv+1PYuZuxtIja6CoHpQg7F+2nJyOPdgad5g2CDru3jZIyCnCZERtUJu1h8xXYydLSj5YHX92qILJNGq5Chp8mIgCCERRoolC82wfX76Ujw3pj8DdYMr4D1stUVwYekS8HdCelH+stNC4R3ojOdw0SmLgyomfNgkLkpCTTQAnVHRNcM0Y9g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: afff2486-f415-4526-91bb-08da90289c8e X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:32.7433 (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: V7kbCLjN1oVRXOkrUthOf2dZHotaOdP9uogSiQn4qoGV4wNbAAgR7xbFIoONcbDP9wgeUe+HzT6I28+4BsE+go/K2VLvRTHDSoDoxPPagco= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,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=898 suspectscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209060078 X-Proofpoint-GUID: mJXF3HqCrKIi_fde0bWo8NABj2-6rjoi X-Proofpoint-ORIG-GUID: mJXF3HqCrKIi_fde0bWo8NABj2-6rjoi ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662483354; a=rsa-sha256; cv=pass; b=1nOvFPL+6ao94uLPhrXTCMnzMqVxOc4IZhtxbwq2HnjsqXzUVSr3z5xFC9OazLZ+u59FFj RYNmEgfk+uACcg94td3PBlrleWxYAA5rEJD290ll+HIFDyaUTXcybOK1uC/KyNFeL86IYx BGPMcaTm0h7wCdRZSo3pToF/BaSNoDc= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=2Ld8mqOW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VNrRffFa; spf=pass (imf11.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=1662483354; 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=9nu8AsIT97IMdLKxrlU5M2PHTU4lWf/JQLEJtfxK/YM=; b=m6ZioMxhdTcgyAXrx30ETD6+89U2t8IkblamVJKhS4mMamkZvaSDHchrOnkeOMoC3TV0fI jiyE3TngVkwL+eZe0vB5z/lxmPVTCRwRvRg88lj0L/X1//9Fefx9i1sqqNbHtg8KM/UgnN YUAvDBC0Pgu7ZohvmZmb8YsIjLyPo5A= X-Stat-Signature: jmwospay4ugu9mo9tpaa6jt4dtnqwxjj X-Rspamd-Queue-Id: BBE6240068 X-Rspamd-Server: rspam07 X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=2Ld8mqOW; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VNrRffFa; spf=pass (imf11.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: 1662483354-265869 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 --- 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 005cb8c76b84..3602e4cda31f 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 Tue Sep 6 16:54:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967822 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 480A3ECAAD5 for ; Tue, 6 Sep 2022 16:55:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5300E8D0006; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B9DE8D0003; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 249858D0006; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 0E3298D0003 for ; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id DDA04C082B for ; Tue, 6 Sep 2022 16:55:55 +0000 (UTC) X-FDA: 79882262670.02.53FBB59 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf28.hostedemail.com (Postfix) with ESMTP id 7DF30C0099 for ; Tue, 6 Sep 2022 16:55:55 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 286GO0ga016830; Tue, 6 Sep 2022 16:55:39 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=zuqwb6dgHOy9jGMh5uDPelU5jXrFj9rlPoT4bWsVfOk=; b=prWE75XSq3u2CGY6LjuBGQOObeDpUVs9it9Hl2ji7KI/3rBLM8XoEKYrWhqiuQ/viL4n 7hPMX92+vSEL6hmFhCAWNKUsWaw/OaebXfJ8KvbT23uQVaaDZ40+aKj/JUGMq6GsSIYz R1aWOJ6hw12j+FjwQjYSeTZ+cWNPZaczN8Ohh+v7AZbbYzD5EUbcynDWpc7NZsA60NO4 do59TxTBcNLjrldWthQwU2oNgvFgja5WSAzkE7Ce2n3bbZGg92zMeRcZ37fGfo3HDiYp llv+P53XSywVxDM5Ebug0ipntc+TEvKMqTEyR3GhA6i9Mo7FEli+4wtsbJKXbHQX1oFq qA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbxhspg8f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:38 +0000 Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 286EcrxQ031327; Tue, 6 Sep 2022 16:55:37 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2045.outbound.protection.outlook.com [104.47.57.45]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc34rta-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aVp1myvGxHYuiqiHgIQ/JYZSJQobtYv23FuBsHIArwRnmiW+PURcs912Ze2S3c/kOdGR9G9DMa0ZhHzZv8VNgROYjcIKwybi3NOYZG8Ms2GCsOarIPCJL2dOdGBxrGv8w41JdZaA4NkTN2smxgmU73GsbecQmQD5mLWkFUwNA3tUyXGLwVpSflQgXOxGA1rNIrydhmOXzYPe7biSg7aqavgcIbnpMAsDMyPG0Wu4gq0q0EB1AQloSbDXQBo1gBw65XQOnydAEnTz9/m5y6K51WklyCxDesqGwLOMeljcP9N8wV5uR3xxtRgT15DXwwbannqnAarAVP6F+aWNd9DtHw== 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=zuqwb6dgHOy9jGMh5uDPelU5jXrFj9rlPoT4bWsVfOk=; b=eBqiio1Wt32NrYWsuZQ7Wk38uAE+Tos+PXyEx/gSzU5u/ITyh22LA7lOyg/diiSnAK7CGEVyeR5vCaWMxq16yrvXXfa9Zfj+F62yV0ekh7ttt2ydtAOqZXM7KFPGDH0JIQzpd0WJ/ft+c/C4f5m0UsRHvb9NU+K2IFOLaMATPStRQCuT1SgapcNuvRIdr2NFqNCw/2sd4H9zB8Uv6TBSQHFt/V8vgp3XdkTepIXOzZVjRoRzCrSnDUEfwwimeA8Cvmn0FJpiH6DCxd1bWtGp1mDosaEtCoVpQCL5FU2ViobhZbp0LNBw/qN1GZ0WBCBTxKJtFw0m64DOF2iNcMjd+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zuqwb6dgHOy9jGMh5uDPelU5jXrFj9rlPoT4bWsVfOk=; b=AGDmZOt1SeTilVFKQaG1L1dk7B0+KRyl8/jukuBpZgyH3D51TOKs1jKPpqqXmzo2kc+TF90cW1+LFYhrtqJpHfZQSkRJdXcttVeE1otha+m/nhRXbwsfXlEr1OtGyBc+HvZCy9I9K2wZtXV7TD1FgMATq8cIw6aIT3vtH0mY5a8= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55:35 +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.5588.018; Tue, 6 Sep 2022 16:55:35 +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 v2 4/6] mm/hugetlb: add hugetlb_set_folio_subpool() helper Date: Tue, 6 Sep 2022 09:54:43 -0700 Message-Id: <20220906165445.146913-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR16CA0020.namprd16.prod.outlook.com (2603:10b6:a03:1a0::33) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f85a53de-86f1-4877-2c15-08da90289e43 X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tDYuBB2lvhLHJZKSibytcC4I3c0GrbulCxHGcv3K8lWa4pSoqFgzej2pIDfJ9xFTb9uTIrNiIlRXtJIw9Yxdn2IJxVTDP8OvODhVmdGahNaVQvaC9lbb2mGOvcJOKMImqtqJD9u9jYTO6u6Yzub39VP9oQE5AG0i0EUgxQ94rdPeCS37y9NUvDdhH/zgnLQtYuOkNp6yzbJq8rXM+DqR9WBlICfIoPLqnWiHZmw2r7h4MnWx9weVOjccwevMQcBaBMPme+JPNiu54E3AvlORf4yhgWd12JE7tNXaInJA+cT/gnJxteR5A2moxuyq/If+thxIYevd8hcRperj14xD6HvZh0HZFpI4ODBV6li4icZUDMUEcQeD4Mi2ID16cpnwK0H/+sRmoy0oMpXABxPeHdsIcVzlT72B2N81LVzgbmyFo+cFzLQWVNxtW5LQmdbAlgLdK/s5rkXHTARgyjszIyQFHSRGShEYI7Q5rPEZeivWwBCYN0bvsRIB+k+wpk42MuqlP4uMIU/xWp31b31XF8CYSj+zFh+YVbdmbZEV8HIx7jN/DpvtU73g5WRzyVrHdNK39QUhq+eCyLeNZ8rrcIymB1m3HzgD6RK0ByyMIclfw+vrAoWEppu2Vst9NiF2HrOnv+2ncn4w/5b+gCie4PzIGR/aNLWTG9no7f/mATokNJQEEFVfuc6GvaCl74AKO7QS5/OoV1pOBOyu/GD/Xw== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(6666004)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: MIHxZVoopksqC+CmbLVhPY1lpFr1uHkMuLrs8Gn3xnhJ+gaa6g4CH3x8moYzb22nCv0Vb/ooFTFem3/picWc2kusKlz0zKzhYNcM5qS+1NmK6tW9f5wZ6lmF6oomwbWb5pCPDW0KvujieW6zMxXcGNcl01Sl4eCAGKNuJupb3uvQSmVYj7OVeS7VpZtR0V2JJVVOmCvWOxHRkvEGIi3vyV3yQFqWz1BTsPeO5L9P5M0U/dJ4k4nWFbHWzzY7nb6OSzRXeHGbLgddLwqlQeP/5tIPGs6yW8kFDggJI18QmDeqle11NyFQOxD5oQnC4sS23qvMvfDpDa/KTVEKLclrMutXnR/Rq/+T7ABtc0XTmblezS9dWk6y7g56Oli57QGbIBwdcXQzxYYz/ZPHTIwtnPqS9xeh/wmaoTcundNNd20aYSxJF4OTS26BNNz9Htzzcs+R7YWgPglDtwU7dg5sJqVi4wgR54YWK9nL3kzWWyPU8STSSUmR7JZxBTWi3RZGe5W+Gke0Wj480DWFLSijyCRgatMvgqW1Anc6xD8GdZSNi/3Kvd6yVaaSKnh2cKJTpRjWCLlcwG63bIqd+vpaDZWP64pGadOFo9eEdB7DXORKJSuwVHdUlTe7aVpIREl1bWygyfHpGBbOedkYRR9U9MV5DC8rupr3AweeXLCC3NV3kyFH0tFVCXrjIZ82YVyiNl+WJOpO0fn11FXCLK+1zoZYHiL3GPZan4y4Y22ax5S9xMzo1kvKS+oAU7cGilU0SFyBAe44Ke3sAiRlL4gxixEbsIq33TUkX6fmO7VXOfikZdVRC6AsXNR1mvpo70jsIDEY1ZALWIOCgHp1DixFPjblvHiEvBIJi9XF4abdgbGz82pw6cWXirKFKKCye3rwvNjWTxv/6gsp08At4ENhqZTGTkr/+nK8vobju3z6ls/+JI7Uox61vSqw6u0BO0xzYAao+Cubf2D/S4DBxfGl4xWQ0lRpKiYn0OxHxyHX0LA5Jo8aJqFaGFxg8nA4oBRldMVr7CditrBQ2J6J5tdqHnZ6HLNkp4VpBlHfclj6yFZuZaNU4rjWEoZTELScyNF5hiLawHVcn41ymZ88KszVPPsdmw9iXyu+CTl9/aN6c5Dj/Urwjv9bnmYPBagWOuNkjCCp4H74e2UyYgFCaAGvkfR9ypSqoF6QjWXNE/igzc5IUDYvbjTyXSsYaVf7iewQmAh5yX86jow42gOuP2AuJFdr4YzVi2pItdv6F68PKkKuu89ZfpT7/NxNbNJ0/UpDX/bT2jAfn9vjrR/KqsfREEACO2v4VnNn63ISCQpEszZYLi0cv7p0X6ql/GWAHFL/aSfx63h8c4Z+n83QBp3F2q4BJlWu5KOV9wy+Wx0Es73U3DfFGXTfuTp5An/77ONqS7Lw45fwFDpTZQENTbkBWN7BRB0EFd915FrRYRkXedzVzP5Hiks+s/A2PIh5mEloVKNSJbQg/94JDPHI/3p1ar3Due+yJwvFjSfGzUoUVDd27fzET1sElPt0L/JZvjAJNBAVL5eb1sBcOal5TC7mihqSoFR7uI5RjvIexfKxpUgQJkzKsuw9cHcPF0JnoyHX9QiSSurUwdzm/8vzfSoLmg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f85a53de-86f1-4877-2c15-08da90289e43 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:35.6671 (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: LbeV70zok1iwrFUZ5Gv5q/4OhQ7F4EdVqj6t5JXF/NrlL6AnwOKaj0n9PsLpi8R4UryedKw8PdmCTnOdSdI3U241p9yEDmBjDJ0NmxibISA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 mlxscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2207270000 definitions=main-2209060078 X-Proofpoint-GUID: ILkg-64B2Y4r5Jqn_XsfQ_RpmZX_aOWf X-Proofpoint-ORIG-GUID: ILkg-64B2Y4r5Jqn_XsfQ_RpmZX_aOWf ARC-Authentication-Results: i=2; imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=prWE75XS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=AGDmZOt1; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.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=1662483355; a=rsa-sha256; cv=pass; b=KL75T7GJGHkYjRp6CtCKpOS3NTWkOosdgim2dk25exn00ynRXRr5AfVaimL9WmhXvC/vSc uHVofU+5lvVnCk3u+WZw+bsnZU5+WsbVjk7jtaO0NKzqbRWPjI28J53lRp5s3iPAgFnL9J YhB7QBbaZeqe6fIP5e17PuFNM1H49IQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662483355; 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=zuqwb6dgHOy9jGMh5uDPelU5jXrFj9rlPoT4bWsVfOk=; b=3nrrTq6qUBSYF31faLxKhqTRTLLkesXnh6vibGeH1mDULAJyC9ZJeqf1qxstE9JjMKPbdz o/YMJy1j0OpycpkWYLDz/5OXCzzWKvm2dc/qcHpZPEApEdaAQKd5+BtwMC8CHsfi+gSVrx MqcLa0DRXrpEhIxfxSaNaJPjN4X/8kg= Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=prWE75XS; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=AGDmZOt1; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf28.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 X-Stat-Signature: hq3ux57gk1x7sa7ze87g5jwcu7ec3zp3 X-Rspamd-Queue-Id: 7DF30C0099 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1662483355-484537 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 3602e4cda31f..68177725a897 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 Tue Sep 6 16:54:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967823 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 877EBC38145 for ; Tue, 6 Sep 2022 16:55:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 068798D0007; Tue, 6 Sep 2022 12:55:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E7EF6940008; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C32BE8D0007; Tue, 6 Sep 2022 12:55:56 -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 9E9768D0003 for ; Tue, 6 Sep 2022 12:55:56 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 748EBC08C0 for ; Tue, 6 Sep 2022 16:55:56 +0000 (UTC) X-FDA: 79882262712.19.D0EC4E8 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf24.hostedemail.com (Postfix) with ESMTP id 2F09C18009B for ; Tue, 6 Sep 2022 16:55:55 +0000 (UTC) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 286GO19Y016876; Tue, 6 Sep 2022 16:55:41 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=BK/rCAui9oD/Xl1GFckyqJkzQLW7BFZX0eCI9FWz+AOtBFei1q+nPyPZ5r/GiEM9LVb5 AOvoaTcOzVNjEplx9wR9Q1b4ZUDEWJfVxh1lN63TMpg1LgBY7+6x8CZ9SHBKvlVNSGrN bhZiTfOoKoegHG7RMwIbkn+e8TJ3on2jPQXzpSFfoobRTALI3Iw/I+2A1GvDBFcWqMhq I8Cqt+HXrSaC/+RFBIjXLabMa2WpmfTBvx7UPqALCI0C8yR7lYdueMaABg2BV7pze7JR hZ//Ommxx5ECO2+fSekvXMJ4IlQHAxhcj2Lnim6AMUEQ2Hdt6/Nq/VYHmQd+Ok3eWX5v Qw== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbxhspg8k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:41 +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 286EwPed037499; Tue, 6 Sep 2022 16:55:40 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 3jbwc2w59e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gAmcfoNW8NdcJVvRENdkSd8uTgvzLyY9JLhxQ7JAPifvbXTDiGWkV7yILu2PMBCP5Oi5+1RCRv5RPfSBH1bStgz+OLDX4cAXI2BEO9aV0ivUIqK8cb+PBPbnuzY1tR9zD0wrBCDMSqMtbT+84p9KHzmsug+IYNtMdVM3e+X+sgxrzQE72pl5M0suXihWXsF3lXRTUL9q4o0Ev0uACeEXCz4SsiJmNI8WDfqaTxVM0GXW7qvnnflrn5WH/nVL/RdySkim+vPJ5UgtercbQdW/qLzpxmjFkmCv5qQwW46cAGI15xndI2y/l3G9k9jsk9baFbvSIyGesyvZNeiQud5iEw== 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=ivdTRMEEsYfIeUZDfnb/zegKCiM6Hkjvo3MDEjhQUqoJzbFzjBny0+6CldDlQF1i4M9289Nw4/2NdfR6RHNoqpRpbxZlJPNV7RV8m8PtHXL8i5h1bPJd3F7x5ZGXZoSlmMe27Gg8w5qFtLuNaak9cpVvPH+EWy1DtA82Wk78X+IUKJicTwGoDi+j8dIW4E3+GKpRrZ0XjT9woESUQkxw4ntERljdncpLp/Twnnd68zjo/MtZ9+lucldfoRIEh5wPV+BNaUM5limH9ROFojyJVo2U6ijG86gYztPu3r3HkjrW8abuitRO+RvthEr++dNe+yHSRHQZgwNAxAR/s1n7sQ== 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=Th2AdoqysLMpP1uJCj7mdkaU1RU7gSrsEAivP2Gi2Y7y4Zz79MCPGc9oM2CO2zWWz4jDBYtZ7XpknxpZI3kJl/gHeAAvpaplwoh/E79Y1CKLppkwmrygMPkwTc2ZEwI6pavCoLppx4SfwrY8RHW8erGVvGCzFQL+O21qxCPAd7Y= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55:38 +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.5588.018; Tue, 6 Sep 2022 16:55:38 +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 v2 5/6] hugetlbfs: convert hugetlb_delete_from_page_cache() to use folios Date: Tue, 6 Sep 2022 09:54:44 -0700 Message-Id: <20220906165445.146913-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR05CA0105.namprd05.prod.outlook.com (2603:10b6:a03:e0::46) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 726a9731-bc31-4f6f-121e-08da90289fee X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g75iLYjvvIUTRlQNdNznjb+5wvbUWLbRYgkjtvzX/0zaHGKKxyfx1IuRPALHZeEkp1kQQgvU32i9asVFqhHezAcC0UGBv4t6AWVTnPae82OOx+bZXadmEYKZbzZlKn6S6BxeXlV1CAHPSwmib4ThNh86hhoEbEE1tlHjtEJmTtNZQvN3D9VXCODJXd5jDS4Vdxq8kE2Dt8+UqRbF/RuEWc2QAcKvcoTttl5HFLenaOviEYLEoWAQGHRj+5rwCBsAGztOXmyX9exmofEuDrM/Hl26jrQxpirpg8nVzxqDK8nRwrUUzcUS4cfl18wRNN6ZH2s2vqO4u8tOM48koonxugl84BuyDpCdWUmXmdoM475wezRcMm2XlqhkQWwzAMKOhoWGD2bmXdv3ASRgOcIqYZ/f2CyJR7nfK3lL27ZMQ1MycE28uakiiopxFAHefJ1LWi5MUsMhYou2K4/7IltGVC7r/GBRRluSTK8Gjz0D4x+/pjH96nRA299E9BRQAzTpuD9bOTeSxcP674VkXB6zydm34wFgaHR6/5uWoZh/aRoRM4efe8gIDranRD+PCqkEepcCI9LW7rv9DausUHaZdjAytvQKQVA6oCg1ApGxOrej7+H3sVP955NegN8e20Kjy+PSuz36CNfQFeFxP53vdOnGDjvTQCa4JVT0qHeuY3mmL5fsyir/Ju/BQN8d5ObswbJru1GHXmoiKIVdm53vgQ== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(6666004)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: te8KJtzEKZV8e2OAMtcC0VY4iyM6TIjva7RmhxypdpDaa51/OpjCIPhsAsOYW6S/IlYukU++i/74ctg9CU1VQdlrymkXRt6xb62hjaP5k4tmKTrp1c9bwWa5ljUdJ66Mvc+DKTRAppszfCW8ajT34ORRHrXOItogSu/AiZdryTtGyVJXli4lafj3VQPCFprA/UTebxe4A4Y3rct+zhCK7y+55pBEf0fDQmxM53KDXJH3cCzdF2OyrtGQsN2lV7C2moVlAVO1LqLUMyNZh1YYQG2XNPy8Dd6D0XwOR0OewchzJp+SbllL0McWjSF3lzTOYatoXK5x40B9iQKvAeHhnf2IhJd3Jdmu2InDfGDhR0iarsvaX/GqaMwkYKlc9Ls0HauQJ55OgIxT8A8rxEH6Z+uG8W+UMBG5cVUeBtSLskfEEUQZe6YUNHWb9PiUG1ZZSqlXnwX96piUQUpZPLSuBP9ZGMNcz3iozMu1iM5GjNqVjpKmpZU/wnYRX6cjXjqZ//Xk1cpNQYhxudOrxUjJ0JdBK39ICj6NmBDoWfsLhPfsaVYWYFzSkZiX2xKQ/iv4MJ1L5LXnaMrIVwNHFyqzXSgqF7LF3VqXu3mWDOEvc7p2P71wA22cyWRFnYPRO17RP5AkcvTCUUm8eQ7Ap7H3Ue8vwFpCj8O8RMykRPw8lOYtLENDBQv//tz5L2Vd4/5Xzs3Yex0ZGWezwTkF8XirmqQn4FTAAvMcxORhxbU7WPWE6vHw79y/4/ZJ1JCDGjr66wJ2tKVzyqAlMzQ1IE+pVMzhFWjak11hCI9gxoP74SbfVeNKi1YO43eS2BOeawxvxyG5J4UgSUmclOzcaoDTIl6AJPnQn5PEuovp3MBCu/g0vH61ebRTOCQ2O7Osrd1bRkkxv/zcCuq326wF69xWTb05WMejKvROS3BQzcG8gnLDYj3SY7Q9Q/ck7O1aH4Gf92937nneNTMCCt1sc+RmnXouz2iboOZmNHfB+Cvet3Fx2UnZFBtzyyaJq5v4RrSjt3Xo3dyoSr+VSEH//hw1mTdZ9krcu1PgLdsFAp8puhBq/V1Ffhlr27flMGOkteCdD5Wb+8EdxiISTc4tZ09rSRZi3j0ckzZYXel2m5n0Qb3aKwb87uItQEVZUGdRYewW7napfCH9NVfzhQEVYHys+NQBU1SUT21eLF+yPW1bJmnWGNubaJpLhwwdUowO0u8rwuwwRUOB+Y9FmHpo2BVEv1BV5tpBAT0+Zj/DO5gzucLNUSkeuZTxbK0kN1QzJLsx/TRT9inpNpvMawKWyS7xtMCNg80j7id4WrtXbj7eIWqiUtoaLkk7pK1D+YF/HuxGTGIXsl7jEnofOJ5+z6ya4HXEYpaeg4Oar0NJGFTyHHSqBfe71DnZsu+f/9BhgD8tmqse78q8zF3QJzP/Q9k0CghW6I7Sr1KFX73H0VWI2VQFPMG7q4QO6QixdxZJBXSTeEjNAL+KZDKtmnqNoTVG8ZKB38GWvPxhBh80NPD1FCTUbxqBo2r4PQGDfGKRhoEQxbaT5GbWEDgXDQw9iOKxBX4+kBiKGHBT2HZvFzzLjqmEA5dpsY7m0OW5uS1av+cst46xhn3f4G4CGP/p64YS+w== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 726a9731-bc31-4f6f-121e-08da90289fee X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:38.4648 (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: vnKPcRHVQ46KkLttFLO3TaPB6pPL2EIkrvSoja/6ZMWNftN6R36h91sJl9brJnKpfShiZibQjUutiBXsw1vsJpw6dFngyI03cb6BXvtFFOM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,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-2209060078 X-Proofpoint-GUID: hW3y4Pe25TwbP5cjQUYodJlw6Wo2JRTc X-Proofpoint-ORIG-GUID: hW3y4Pe25TwbP5cjQUYodJlw6Wo2JRTc ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662483356; a=rsa-sha256; cv=pass; b=HkdLzTV0zMpDiy5MDKW2VDNnWQtA7KZVZJrIsIRD/y8KeoN3nxxPMzcqW/UgozHtY/sssn M2K/yAKiyXDCe6WBIi9/4Y2ALRuCfa3fZl6ohMquI/qtoa3MWji/AUn1cK/9KoJgIRouyb di+kJr574a/R1hTBmUCFUz1zULrzvic= ARC-Authentication-Results: i=2; imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="BK/rCAui"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Th2Adoqy; spf=pass (imf24.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=1662483356; 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=RAffKLP69F9bz2ivbWlS8R+WdK7rcpYXgqmR4se3cbmg10+uDm6VumHMohPKABt3Jqt8uw /WlUtaKoAh/M+00ufgS155nYbYY+ev4XO4q7A6MwUX/gJ2nrK7KbD4BhYiq3kgeFR4qibT T1eXddjndwULyENA891ny2FNpJLbHPU= X-Stat-Signature: huwzkjqo4swpz5bhbwy7geycwe3w93as X-Rspamd-Queue-Id: 2F09C18009B X-Rspam-User: Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="BK/rCAui"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Th2Adoqy; spf=pass (imf24.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspamd-Server: rspam08 X-HE-Tag: 1662483355-59685 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 Tue Sep 6 16:54:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12967819 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 33DB1ECAAA1 for ; Tue, 6 Sep 2022 16:55:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A38266B0071; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99BEA8D0002; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 703656B0073; Tue, 6 Sep 2022 12:55: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 5CC2C6B0071 for ; Tue, 6 Sep 2022 12:55:53 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 395E414195B for ; Tue, 6 Sep 2022 16:55:53 +0000 (UTC) X-FDA: 79882262586.05.72983E3 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf19.hostedemail.com (Postfix) with ESMTP id C55771A0060 for ; Tue, 6 Sep 2022 16:55:52 +0000 (UTC) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 286GO3Mm004368; Tue, 6 Sep 2022 16:55:44 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=EhGjc5qCbFauFwUbBBY8TrIp5s7UpdADI09DseIRucQ=; b=y9sqWMDBfBaIwhTjoHb6mleJHeoyJeQu5uiVFRbdf362a0onEcdRkVSaq/SAZG2GLVCf HCZ9wzeasKxC/ec8HHA9Ec7OyE2zQoIud49qvuYskdH1oRnJ42frFnC0VMGgwb2JKLy6 okoKDYmTe7zeWIBvolXmNV4+lfloTIJz0GHN2/kWWsMvfIKQtQ5VbrnDnqH4S0UcS5Xj M9LblRTo/FmW+sP2s0s5gQap+G0u2Q/bhDnbJkGhu7xrC3Bk+LKyWhicaazusRnhTTYR HYbmTc2uAGPMujbAZoSrEYXez8yLCW66b5NP192s/vzz0sz02tg6AFdc6X0+PcUQ+KmS JA== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jbwbc6dyr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:44 +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 286G7Dar027523; Tue, 6 Sep 2022 16:55:43 GMT Received: from nam02-sn1-obe.outbound.protection.outlook.com (mail-sn1anam02lp2041.outbound.protection.outlook.com [104.47.57.41]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jbwc9e3tj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 06 Sep 2022 16:55:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ECW3h0AHMtaHhcy0x0RB3UtSEP/oeC1GFLCBxx0NPnJqALKUyu7DdEQQ1dFPBQ4vNyOOplJ//rOt8u22e3/qU3hkDmD7H6+9Yaok4UI/2unFZgKR04TFFr2tLSQ7DCDxImlwPNgt0SbapaasQNkEYqaaWqnxySGKISIlXbcA1K9Qxb2/V5EidW+D1lPwqoZYwrYKc5GEa/3fns4dbqEGT+sT1Q2U76KGwLkPFWbVWW1jktgyxlxpMA8kkwMceP4W3lsPYb5ZJehKyfXE34FIiIgwAO2domdAGipLnYw5AETfU2jKeR88QBQsHQK2bKT0KhbFrRoH2qiVf6cveSerkA== 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=EhGjc5qCbFauFwUbBBY8TrIp5s7UpdADI09DseIRucQ=; b=iwNhh0a55hTTi2otW5aBv8+uOgn1euXAQS2DjCfT6ZYCQZTUEa0OKuWEPsiSuo0jov37Cl/+/8wq9THBhaN+LVOrLu84jxJpB42iBD0ur2uKAzMcSEwD24zDzfI8WCBUN5u/3sVJn3RYyKkT+3rts7tCZoCXoaHViBNLu745hDyEkhEo8jRb+vsv3u4fglmdOTBrrW0nRYjWnKxNdi/UxE+ybPoTB9RmGDk0WuAwCVeIWg/X5SZf8/v/eZ3VZFSGcJU9ZKOTI0P+t24ofMdQpe7TacFYMqNT3zRuxjuwzbEEn1k4CIu++fA3fx3NolcBNnZyqhkKUFjqLBQw9vzUNA== 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=EhGjc5qCbFauFwUbBBY8TrIp5s7UpdADI09DseIRucQ=; b=vL5oWzt7Ta1BcYUhMsc8EHqM9ctLPOixH7dTP+fjdvGFzOXIYRNvPqlR4tCwL/evslX+WCuNH118pg10nZ+J0j1sTexaXkmrfelI15fbCyK384tOsyJ8T+PzNcwSXdxuWQuWEUnPWeBK9ni3gXLcmfM9qTu7qbPFhEbmHyN8Ml0= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by BN0PR10MB5078.namprd10.prod.outlook.com (2603:10b6:408:129::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.12; Tue, 6 Sep 2022 16:55:41 +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.5588.018; Tue, 6 Sep 2022 16:55:41 +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 v2 6/6] mm/hugetlb add folio_hstate() Date: Tue, 6 Sep 2022 09:54:45 -0700 Message-Id: <20220906165445.146913-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220906165445.146913-1-sidhartha.kumar@oracle.com> References: <20220906165445.146913-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR05CA0088.namprd05.prod.outlook.com (2603:10b6:a03:e0::29) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5764f144-5c9f-4841-282b-08da9028a1de X-MS-TrafficTypeDiagnostic: BN0PR10MB5078:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wBdSqVZxOVVjTyYtjUdDP5PSBI0txioZQPYMxzOHLnOHP3OYIK/srFPXGRbib4lvc1cBljzsB3/bcxgVt/i7Z9OOmB+CSJPuh2OyXNHVqOI8R0UGoBol3qn/nu7N5fCTJ6nURMS52oRjnsSSWrlgF5r04RZnlADiftAdpO6dafMAbbmCw76/ODWxEDi1HoApOwNP2ahIB3q7pbyr2+vCAUQgZ0gAuG7nXdwwo7T23GJzm4CuDFwJ2OZGlcPLco5nGvoCCwl2S5jCOR6bZ3A6410gsN5XXjFNyhvZzdGzWSKsxPZHQK8SjKOZg0QB92Fx+0D1ls2hYLg5QAXwUTvw7aUx0mgT/q1IBbN8uT/J4VBEfFcCE/u81JihUjw/BqJXcjoA3gqCc8CAJdMhTBXaOfst95V5jJf5yyuHrx+5UZhgmIjWCUS8Bbf46HeYwj/7eMPx3tuOgglYniUaeqmelIP05SBtXkrF3PSVVGoCyJ+QeURReJwEZhlEnptUfbqvhZkvTIGqatphhH9h5f3CCdKRWrlAt98z2pEnu3Z9rYpe1hxRNP+cm+WCBLstx7Ddd6QZp9Y+NqqZX0qqQ1yDnLVoMpVi/472aq+ze6fKWfiC0NcapCuxGfsfAn8fUyc5qOJjdhB1gTg4xnHPjEVx4m/E0F8b9RIX5mqD7c2B9WKrcseeaZeSEIjQUNdENXbcVTph5WwZJLia+IHnwyghxw== 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)(376002)(136003)(39860400002)(366004)(396003)(186003)(1076003)(7416002)(8936002)(83380400001)(2616005)(44832011)(5660300002)(2906002)(26005)(41300700001)(107886003)(6512007)(36756003)(6506007)(86362001)(6486002)(478600001)(38100700002)(4326008)(8676002)(66476007)(66556008)(66946007)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HFgcpSEdrEv6PVx3Di1OibRE+haFHjRAK5x5K5oW0Yx9XMWx67+OiWoVX7/8WAjxK40+ySmN7/Y82q2OxWBhXsK52eFTewFtZlBegDkyjZov/3scm1V4IPSJBNVUWZlJuu6UVXgqaj04TKt9y5Qmw4HUOgrtrJIbxZBQGGeO+etXJv0U9jrU3W7AdPWTMWzEjMtL1vbs7DZwbT683dpQHQ3iYzuYwd9oXSfhogIpNsYXMlCQGVYbu9hxlWptBYGJkCBD6RKMXfkOBT/fFFMtXhYruwTMsr9L80RzBvScDmBfphF7TyLY8s4AjFew9Zwf+g8jobhc74qUzSG2Aq1vKFH3I3nLEhwKTZSN97ELijHsatWROncoxpDPCSnfHceuteJAJpoUX/6p+yAK90825QYQ+rx/MsuRm2Pbfxb8BW6sFLtJcevryB4WNHU2ZGVLeMbCYuJQHi0EazRWhgrcCzto2RkiDps0hqBdA04sThZBgqlIlHwbzeuVcLEXxPocmMZvTlIihmYG0+/ad3eDwK5N32RoWljjJXh5Jw62/GXksf8o19m3kl9VMqse3m4jqpLKWAYr0B6U7KrMXI8NK8KOUGAIixfFpRq32IvwH102TJlYNXLlwvDF4gDn2a8oRkcDlAHgc26HVqyK8JQES4G8K7uW7FArQ3edSwrGk9KhdKLXAaKkrNB1EsnBEo4jUgqhqRDbUobOoYwhsYLni6ZzpJRvK/MPPaXVKMmeUh61fwGr1asCRHPYvjGNi+f91JAGFN2DSwGnfSMcEzgP8dMJ330ToJtCmnhalsAL6+e8lpp7Wp8w50I/0mQ+ObCO8ziId7EKYC/C1b1NQwYWeUbtWD9uVgvmGJbPCLhg/0uqZAEwwrz85w81xzllJwWaxtZ74VWt1Acg0KeQLGlga8FCRFX7O/zIYQN+Kv20dBqoM/GFr17xngCGRS+Tr4N+zAJaqSOAqcDSma7njq9SVky55/xpB6K8slFx3r63aJTlMz4Tp3BKJiUFnl9+bVADetVgiFiHqs3oEAKlSKoVQ2uAxiZCVcnIo6nQ9pz9YtoTFUWGpixb2O3gKBcOL0PB2oAXJh8xlvbBLoZONcDZOcqNPR44sNde+3V6y/aJXnjhGKxAQBl/kFloD9BC47lus1CK+WU/+I5JZLE5ZBHYzUSYRd5Lvw6KsjC7S7RaViQgl1ayGi+bj916M5CYZXRwsz26ky5wpEkn8kc9+AQeMCYUGEmFwCWc2EJGC96qKmsq9vQJC0kLkCfgRSVeRhhgcB/YKPXJ4JlVX/8+ypZwF3nxNmhb2VgBlEt6gPtULlehTSGM32UDtnJjoKRcK5J2ZfvLP721Ns76c33XK5Wi8SKQR2nszF0wCV9nD1JNUVrAqU5k+fbW++47LhJ6P56bI64tdsQGfDUY23X9dwmYK1UJCwuw2ed1pqvLLpYXarvSTwXUGKEKeToWLsB0XDc2Y1Ey3DEu2hqYXTz9GVBQOWtJhuarigLOgsE/jvAOCqy/ZDoh4leSqJ5SJbk1PuABvsMUFlfLG+AIMFF7wgJQopFWr8pddyQG99nK4poPrJsEkyftTPlQcP1s7V9oydtHxx8QPfeHqci40hDqUqsM7A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5764f144-5c9f-4841-282b-08da9028a1de X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2022 16:55:41.7003 (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: tGWQ9j4qbGzTZ0GBwOYrFA1zLu/4rAaARK9Z6M8ua5dHhM3OxIJ57xFp3RFAnhqeun8gbCrHuQ86PNCFxyDLxMoLLMRAUVBF9/ZwUHpVYRI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5078 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-06_09,2022-09-06_02,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-2209060078 X-Proofpoint-ORIG-GUID: MbAHUHoxDvfKdVyn4wFJ1bp98S_Px39z X-Proofpoint-GUID: MbAHUHoxDvfKdVyn4wFJ1bp98S_Px39z ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1662483352; a=rsa-sha256; cv=pass; b=7ujKIkWAEY8nuLIO74dfpXymkpc1uMRIu7ZR4oXDo9Ss1d3tOBlUk5mXC3iLqtp2W3SnGS 5XtNf0+BfeZ2F01HEBOecTWCgclXeL3tkbwmkvprkUio1E0U2F0Bf0y3mFHXX42mTUeNhz Dl5STe47oh9NYnIIEJmuR+Tlf8nHEoQ= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=y9sqWMDB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=vL5oWzt7; spf=pass (imf19.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=1662483352; 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=EhGjc5qCbFauFwUbBBY8TrIp5s7UpdADI09DseIRucQ=; b=QszyRzuMu2zQ+HMAHIeoaWIdUC/ur9Es62KQNp4pAjvuxGsrD2drBflQMSm5ncNcaHjK76 /s/Iv9bwGw+DTWblOQA/Fo/q2RjztP6LMPo1YIN5cMMu6idawPegR4HsFiEd3p+uAb0VMU 5+P4HmQLY1oOus9Hzdh4jkFXyXaBdVo= Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=y9sqWMDB; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=vL5oWzt7; spf=pass (imf19.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: ckr6qxeo6ym9rbjbasorkm73iconq7ko X-Rspamd-Queue-Id: C55771A0060 X-HE-Tag: 1662483352-402037 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 Reported-by: kernel test robot --- include/linux/hugetlb.h | 9 +++++++-- mm/migrate.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 68177725a897..a218d33e518c 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) 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);