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,