From patchwork Thu Sep 22 15:42:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12985453 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 1C3B8C54EE9 for ; Thu, 22 Sep 2022 15:42:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BA25940008; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2F4266B0072; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1465B940007; Thu, 22 Sep 2022 11:42:56 -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 054236B0071 for ; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A93A7120C56 for ; Thu, 22 Sep 2022 15:42:55 +0000 (UTC) X-FDA: 79940139510.10.32A3F81 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf20.hostedemail.com (Postfix) with ESMTP id 309AC1C000E for ; Thu, 22 Sep 2022 15:42:54 +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 28MDr6cM019797; Thu, 22 Sep 2022 15:42:40 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=vs3uGcyuJwjH1tT4Y3xaeZVkuQRVxLri+x4TZ+Lsu7g=; b=vFSK5Ii/OWFTy1aIv2fBs1cjLAzItaj4edy6afB/EQv7dO05kk2Sm+BArFN9Rz2GoyUl 35DQK957fp621KmpkAVfovNCfnFq4RtzRVQOdKIjjHsdZwHeeoDMOql7PAzAOV99EYku UrzHZndCkeplXNAavPp3zh0b8zCXlRPe2z8aiN0ObYsnHmudvj0nsXcNcOnswQukaUNr MbmN3d6j4TPTq2opXmaE1tHAe79D2hHWtBrVw1ZzWia/Kvm+tH0+y7dm4yufit4LvLR6 kh7gfOPAY2BMi9eaZpfoTMy+AmAlfcMmJh5AmXUhWsZompztSk2Iw/QcejdbT7FxEiEW 2Q== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn688nbxa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:40 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 28ME743D028880; Thu, 22 Sep 2022 15:42:39 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2042.outbound.protection.outlook.com [104.47.66.42]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3d4rfgq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kvhNo925XcODcpdKAjUpmkyf1mnL+CYaeahXc4gKOCHl+2e5NPHBoW1b6mgsELSyOz/UUmpMoy4uUAM1cNK3xKqLrpv4N2gsVF9Zvm1x567MQMtNq+oxhbNjklT17Uu0t+AABlpW/IaEsRH9+peQwXfofDKwlCUVK67CsnsQUVn65rNUF17i3V5h1XU2GZCSoCUOasq2fW/90v/o8NDOAOGliiIBPt48UZnjDggDGSUMD0kCOihddtKQmRVEmBNfepLMBeD03b+sx6B4yoEY0AbtungQjnOU288DjBSRwwnhBWk+S3Wmw7nHXlju2X1r2/sbFfpmL00hb1vbS7uChQ== 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=vs3uGcyuJwjH1tT4Y3xaeZVkuQRVxLri+x4TZ+Lsu7g=; b=UW+izZ56SG3Vwg6lILCnShAGu64mOslo5hFaZeLJ5HDvoHk0VpoWsiyleKU12pAB4LP/eRpNvBetlpSDz2zsQrI44nOrMkrd+qWgOrEbkXVoPZQJ2UPFR067PLEfTw0Gu4Nri8a2oJttm3VLOsjA2w/VabGscjT8Fy4YqFqLAi3LaTfEdaQYipxDar/R44hFNH/i/v87UZMf2iHL2iuD7+kajnWDVsoBDG5xaJM0R/Qx5z8nJuL5Ba4VH3K9YljpyWpTtnNV5BD7M6PbfWb9IRx0WOHi/lsUzriKDbAC6UQkYGR5QpZPqxwk3tNN66ahgdGk774pljOhkZRDesTlxw== 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=vs3uGcyuJwjH1tT4Y3xaeZVkuQRVxLri+x4TZ+Lsu7g=; b=eMKlyTfeHPc9+loGYwCFBj00FsuB8MkeqQmTHNljdWiHX5vV56jEGrUjU0Ib2ZkgDCAedKQvZYqBi6Z0sDj8sGAZvjlu/b8oSDDFwli8dR+9vt1ro576WYglLsG+hOjqushhDevVF+33oNUTJdUBmfon3FYAZypogQOASxM+X1o= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM4PR10MB6813.namprd10.prod.outlook.com (2603:10b6:8:10b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 15:42:36 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%6]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 15:42:36 +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 v4 1/5] mm/hugetlb: add folio support to hugetlb specific flag macros Date: Thu, 22 Sep 2022 10:42:03 -0500 Message-Id: <20220922154207.1575343-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> References: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR13CA0060.namprd13.prod.outlook.com (2603:10b6:610:b2::35) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM4PR10MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: b64c7c5d-7663-4c47-51e8-08da9cb112e9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0SiMXZvHPpbqKUwa3ifWfXcxNbJhBqM48VMuv0vs51jtzqSnJq48UwNsMtQdkbMYIBr5MYYF9YJz52Oqgj0aZmkQAm+cR24jfYomeiJxggrmItv3IVKcqxWP3GG5itA7PtsEQviqpJjd0S/MGgH9BHyaCNfFzTBGkib1p+Q0k/rIKG6DMdBPM/3UYqo8iM+73pVHiG7kbDZGi1qIXqdlx0S9Lv6ml1psXnjCjxKsmFE3O9xgxmhAQkBBkxNkBNk15zVNw1xfQhfILPAj7sxdZMgQyD4jHl5GHHWoMhedUuFCSD5/ycXApXouUqxgtTBCSemHbkpjbX2USPEXdWlRP5bz00bMiWJt3OFAAgnI65judCdTHxfKre0+SLMRbBEF7zHYC99CZvCxzy74MEluNAJQKEi+tXB/pyZiNG+nMyleffnDanlChSy4wK+Y5SIa0CpnUwgbxf1vW8juRCLf0au3P8ZUbp297u0+SyD57X0qNvy9pOpVpxJ7QMLHj4GCgBRbZmsu6O3ToP2bgGkZGwM8bXuUF6Ht3p96kolrjMqRMskZtrPlDrANFdBgZyFZTwmlOAAie43Qe5ctoXycmuAgGEUFErZXgVlL1MzEM0baPuKdbJgN31KX/nMeoMNUl6Hkede6uht1HRjkT7AbBrq8vgd+b2RnxZsdOcUP9SXGdHyl3U5lswvWq3K6Ksdxfsxt1diVrOPNPEAGgKN+9w== 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:(13230022)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199015)(2616005)(1076003)(6486002)(83380400001)(6666004)(44832011)(7416002)(41300700001)(26005)(6512007)(5660300002)(2906002)(107886003)(86362001)(316002)(36756003)(6506007)(4326008)(186003)(478600001)(66946007)(66556008)(66476007)(38100700002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DeT6zJ16HaptPua8snaLemGHm0HZ2sukKjeyeGRE/zpk1znLfMMMPh7Ma9KLcUqmPaEi189bNR/s25ygD+TsmDDDl82TuoZxhTAjnMlDKIaQJlNpm0RIX+PGXVz7FeYyKWqY4BWbVI0Y1ZcnyQN5BJhKIhTQuLs2KJ7f4zf+O77FZ7SFp45Sdf9I2kBnDN6QIM6DMa45PBBncwCcHgHSpSx41N91gF1moI3HHj/lzVzqWz+irSuZPtdeocu6QZKdn2Kt87qgjFDWIP36UpscnE3lO9wgfq3EV+DzjWRmu1iS0OgM9nfdmi2VLPvnoVqgEBhlMU1KY/qlM/uVbiVebENsfRNMmrN29ZLE6IDkhk7WbUilpOzyVvBI6hVCtegktK1dgNGP/1qbjBAfySeGNsmnQGX6Fx21oifbG/d6iDQKsrWNPkRQ12MCfw60eTjj9pytowN+iY7Y/pLbKX9ZDD9GbbH8rVDhUjk2ejtztTYktXaVGOzr0lQbjzxSPtXSE8CVktLovTeScJ2a84UN8a30+CmdE5jrnvgXpHwW7gfVQMVgBE7e+zn/LxRfPHKHK8O85n/+DOocVoIWbHB5nUgR9U/bpZP71VJsjoSiXcgiK8HuQObI3DCHFmDFqyT4NjZ6qwxVBVhi12m20H4G/PgJD9Xsaq/O5LLi6qco31ThYs3O7SOeqQv73tTqMTPPqKRVHK8JwJU5dfR4BYeUEZZvW3/AGFk/qYlPjWp3JuOIVieOCbQY+XdVO/cs3M2/6BCzzsfiU7PlYfA0BJ62JKYiFuRFUt3sp7LwWZh1NqjV7JjORQfS6l1Cxc6PHWQiqWhJ3DUyKrFNBy9SiNPoL3/1khjl91EPOpkNtmqCQCPF7q7B04GS1/DWIXX1zXTzz70wYslM47x7xF0QU3jRpcrovsnaef+OJkwy6T7Rt66z1q6mmvFnZG7j7ClxauHltdwwYG5W2hCcIZtow2vT6M6hwSH1y3NB0wPhXP6U24bFr7JdqhXCFPGyCVHJWGOYF3RZfJVVoPZRuDTrPfjEqeTaCHYHx/JrggT3YhlGLF+akZEbtcmLYRzKmN/16RwaiBDNYIGqez/dOywb+BllLWEY234NrCK328eO7pXQ70QQmiQ9DBAl7GqkJrBfQahEqZaPcJor2F7xbcE/0xS8Sq9D45jFx/OVbYW9oTrLZI+W7KomSCxkRXoxI3p3ETZxd86dHVTYS3aOaATm88DmRFir9neuDRiIFpZJn4PfJGvHggta/m1MfV4kmcIOCeHu2eIqtf0p0FWAMQ/Sqd1foYkkLGXEkayrTzPlSxEglpgWBSO3wR4QcarGHyJCwfBI+fu7e/A+FBAT3EKIzNFhfzWQOIVdImtQdwZT0w7SRQNDQaoHo2L6IjdEenm03oN11HPd9Fd6JS9hphc2n0y3wQYy9nhsd0Nzv4KlGdq3bL5WJww4Pfj1PnoJIM4FdjqvM8HYEO+ZVgdH6/9tXYE/LkBjspmEypRSaxAUZ6lyJjbVTFyZHMP6DIjY9QRhloj5UOF8hwMs78i825Uy8elq+jBBzCj+Eaz9tnHyvx2g+XdFOmuTNruj/qOgnEgWLHrsKvDpXq8Fghd2JNa6XcsVRg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b64c7c5d-7663-4c47-51e8-08da9cb112e9 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 15:42:36.8792 (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: Acn8NrjIhPPK16Jt9GhL3e1lg6ZrkLoNTSm0o6JKa0QhgfYRQcPcDcEmpEOdUyGjbcLF9b/demTrrdT281YkL3LWHkEBEPBK1ffiMDUWJlI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6813 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-22_08,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220104 X-Proofpoint-GUID: cF1Sp1jIf5mE3HS_2TWTLYwLv5AR-pDo X-Proofpoint-ORIG-GUID: cF1Sp1jIf5mE3HS_2TWTLYwLv5AR-pDo ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1663861374; a=rsa-sha256; cv=pass; b=2LHAssJY/S5+uAYXBnG88zSTkDcv9KqlZJIPC+INcKlAeCFXe6RVi7FTJRcrwdH1+UYt14 z0eoyWTGvDliX79iBU+wy4HZAGm0yFeiQ2wKa2TVCnPSHHjY/t9vGBKTzB67SyyYrACUJ6 kjbdJLjFYXlNs85H0p153wYHREuQrDo= ARC-Authentication-Results: i=2; imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="vFSK5Ii/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=eMKlyTfe; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf20.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663861374; 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=vs3uGcyuJwjH1tT4Y3xaeZVkuQRVxLri+x4TZ+Lsu7g=; b=Bn9+3aZ/xrOnhzxH0TtRo8QR2lW6P+Ok6Fag1HkgOClSDVYXQ6But3Y59A29TLWxSC4TSC 4YF+rSLgfUR+mKDp0dmeoRILJFUcLEtQ3P8mg+3tjIMLMOIwFq8ygEFcSfcc0ncq2Z3LNi 2GEu1iOvLwhkZ/2rRuta8isgnsJlVAo= X-Rspamd-Server: rspam04 X-Rspam-User: X-Rspamd-Queue-Id: 309AC1C000E Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b="vFSK5Ii/"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=eMKlyTfe; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf20.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: hip1xrngm5z6unn77pcpqg4toreuk4ra X-HE-Tag: 1663861374-620213 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Allows the macros which test, set, and clear hugetlb specific page flags to take a hugetlb folio as an input. The marcros are generated as folio_{test, set, clear}_hugetlb_{restore_reserve, migratable, temporary, freed, vmemmap_optimized, raw_hwp_unreliable}. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz Reviewed-by: Muchun Song --- include/linux/hugetlb.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index cfe15b32e2d4..8edcdb6a833f 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -623,26 +623,50 @@ enum hugetlb_page_flags { */ #ifdef CONFIG_HUGETLB_PAGE #define TESTHPAGEFLAG(uname, flname) \ +static __always_inline \ +bool folio_test_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + return test_bit(HPG_##flname, private); \ + } \ static inline int HPage##uname(struct page *page) \ { return test_bit(HPG_##flname, &(page->private)); } #define SETHPAGEFLAG(uname, flname) \ +static __always_inline \ +void folio_set_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + set_bit(HPG_##flname, private); \ + } \ static inline void SetHPage##uname(struct page *page) \ { set_bit(HPG_##flname, &(page->private)); } #define CLEARHPAGEFLAG(uname, flname) \ +static __always_inline \ +void folio_clear_hugetlb_##flname(struct folio *folio) \ + { void *private = &folio->private; \ + clear_bit(HPG_##flname, private); \ + } \ static inline void ClearHPage##uname(struct page *page) \ { clear_bit(HPG_##flname, &(page->private)); } #else #define TESTHPAGEFLAG(uname, flname) \ +static inline bool \ +folio_test_hugetlb_##flname(struct folio *folio) \ + { return 0; } \ static inline int HPage##uname(struct page *page) \ { return 0; } #define SETHPAGEFLAG(uname, flname) \ +static inline void \ +folio_set_hugetlb_##flname(struct folio *folio) \ + { } \ static inline void SetHPage##uname(struct page *page) \ { } #define CLEARHPAGEFLAG(uname, flname) \ +static inline void \ +folio_clear_hugetlb_##flname(struct folio *folio) \ + { } \ static inline void ClearHPage##uname(struct page *page) \ { } #endif From patchwork Thu Sep 22 15:42:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12985455 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 E96CDC54EE9 for ; Thu, 22 Sep 2022 15:42:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B764F6B0071; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A21FD80008; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7FD826B0072; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3912D940007 for ; Thu, 22 Sep 2022 11:42:56 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0F3B61C6CA4 for ; Thu, 22 Sep 2022 15:42:56 +0000 (UTC) X-FDA: 79940139552.01.5D9A18A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf12.hostedemail.com (Postfix) with ESMTP id 8A3A4400B9 for ; Thu, 22 Sep 2022 15:42:55 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MDk22N032064; Thu, 22 Sep 2022 15:42:42 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=v+Tc9+1YIxWX9qFepHQAITxeeRxTqqPAYej/GQQcHVQ=; b=XGWOJRpIL34IS3eBE9qtHBD6XljV6vr1tKzXsJ/uznVRc7w4ZIfRiQ7V7qqhXMtewtPK s8g6JJHlf2uJyFdF23Ij6vjC6KrcgNaA7xzjZ/7JhpHvCL0OCvTq+cclnZWbegtuVSZU Ija2ZrUZk3UTjwoXlsAnLzII1fd0oMGGKXzb35wSoxeIDoRgnCUoGDQojmE5Z/sQYyjz 8XTb/6ppvzmR2zVomci99kXd+9oXcaZMmcgEbQOT/EEV/Jo4NgDPHwH0VgiE9tBvJSAO Rn4ua8HPSJpmPYOaVR7jPyeKWTfZlV30p7r6K1j3iFl7sHJ+Bty4BL32d92xCpiDmtCY Fw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kwxm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:42 +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 28MDwbA3005638; Thu, 22 Sep 2022 15:42:41 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cqrf4c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mXKF5LxdJO5K+Ev/BRkiIvdaBv05SS4aP45To2oH0NnNUnME8JPsG11PfpsDAddSmeubConfCn6B4fl7zjKA5CilOJCX7pRwCUfJydppWIwoaodgJ+LAjUbyVgxV72RYMYuzYxqAcfDk49Nr0LbSVa3XFQtEDuklXFMN4eyKc/dfc3BAJ/looDfyrD1Wz3zOT+5MeZ0kKSszP0+dz/ACCUB/k4qiWK7bQW3B28xrpwrlObgJ5SihcuGzxk2RAmb/1WbmiRlTpQxQ+3H6aR4NzajruSdGX98GjX7wNiaG2emLPb1mqUAcJ0l8zbENRgThoy824cL0HPcqIMveL5vLoQ== 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=v+Tc9+1YIxWX9qFepHQAITxeeRxTqqPAYej/GQQcHVQ=; b=Xw3gXNsDtxehciyEBB9ChUo/+261bjWgsdT9C09ejodzL7mO9kfPWBYznXt1aDqHFV2fcch8ZJ/sTrM5p8ZJ8UlmoTnrDA2Rzx0JDurIv7x+z9FNxEiyS4SblL2pjDfYrw5WSUi7F1/yZ9URn0qjxtgiEwBWdxxhAxcbTKBE1wMdS9S9zp8/t72hRF//ctjQVhUq461D/KSjCW88ivak+M2TB6GtfyI9ZtZN1I8PaFSVm/Z18ybB6cFIg3eVATkYLGZABOMblEh3EwWJFb+nDaFhLUHTdG1/p6IZBH30gbal7O+VTHLf1tvSIlGm50s/BYLqLDgh/8qG+kzexw9/Tg== 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=v+Tc9+1YIxWX9qFepHQAITxeeRxTqqPAYej/GQQcHVQ=; b=eU/T9wIRpfKoiH8AX1H5mnncnkFqfN5uFtH+PHae4+eo46pgFvlHfgyUsKJKrS4L09ozt9LFoPOSF8KRnsD8pOSjdhTCDD13352v0KA4h1o69pit9St/bxLzhOcmZqVU4yKQmZoe9HpAHrchdhu5TyjXu+wJa95vPtnit3ZJmjs= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM4PR10MB6813.namprd10.prod.outlook.com (2603:10b6:8:10b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 15:42:39 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%6]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 15:42:39 +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 v4 2/5] mm: add private field of first tail to struct page and struct folio Date: Thu, 22 Sep 2022 10:42:04 -0500 Message-Id: <20220922154207.1575343-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> References: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH0PR13CA0040.namprd13.prod.outlook.com (2603:10b6:610:b2::15) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM4PR10MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b79e0d5-13b7-48b0-c566-08da9cb11447 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: J4E5Y+WoD4ihQL+pyFDG3mKuTDzW4SZFF+kk3Z28SyaFxkdDEXXm9U8wtK9Hn4k5bAL8j2EOU42jz60dN3drep6AZE7l7BI1ouKEYcIjZedEW/i5OleMrt4PH/vge/ARmT1EVqr+IJNUHMg5Q214KDcaPWBy35rJHGNXdQeQn/R6RH7kkpZeBp0BasVqM8bnO3yuwamq2FQpHxRhjdwb+INKzugWai3P33cZ+XFQMM5w27PZVS5G6SIjhzpSq8R4E0l9OUzNP1iW+uCoQhGZYYpPqbHGHdwUhsVf0wHBC9vvEAtNu+VxJUDm+zTufwMUhbPoWeCAprdDk7D9JU7nMbdyw5tEwPO0IadH1eU0jt2zMGC1x+my87zgfear/UpiXPqnnKAb7llgs+eTe6g3kg3bDIviTczsjoVTFZfb1+2woneDNIxpArOgGSRFzgs5ga5qQ8383nUsIvFEMDWEdZreeGWDi4p+hWz3YMS4L5qxZX5hwL14SuhLhjysHxNRud9IOFcASfDx81TAyc44SaWnDHSp00ysAxZ0tBw/JweJQn422VNOq1g39BeLDs0tEpfA1d26EC1B2cP4v+YZ0DEEe+Vvqbc08PT60khoDl7nJFI9leumz/twH2wRoX1vJdMP+cK3TWXbgvm8QkeScxjyZitCjojwQsju1+rMfHDs4ufBnH1VGK9mUwNKys1EC9QLb0jG/KQtZsc++saZUA== 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:(13230022)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199015)(2616005)(1076003)(6486002)(83380400001)(6666004)(44832011)(7416002)(41300700001)(26005)(6512007)(5660300002)(2906002)(107886003)(86362001)(316002)(36756003)(6506007)(4326008)(186003)(478600001)(66946007)(66556008)(66476007)(38100700002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KRa0e6R6FbhmguXiWMPlypS5lNePLpL4KTlbSs5gnpcSz529CSr+3JJbflHnAQ+0VrE6K4LYlHhKNuWfDuMbgNcPVqLmmar+89gvF3a6qrBhaJZt2KAMaRVzMgR9FWkyYeEOAVkl2c4KBWKKadOgE0V+A4cVLadB0FfQ6uN/nAwJWDGD6vETza0jWxZjSu7xL0DWn6v1kt1cstKFYhk8j1OE73SWWlXVvn/uRph4ecnZjk01SkmkCEwdLrI8f+sDLZydCvWE7hThWlsko+rQynxZb3iGU1R5rtZVVGmCOufNC3GlVRwr5z33POPPASVvSMcIKB2r0TGamCXALC9QvT/6O/P9UH5RzGhN/jKitnv7UwCg0rVtFk7b91soKROchdUwcP+h4f07CzlnMMpEARX72PnVgrCnW9C5iutUzxlWq4lpUG5FrQW6FNmM7wcgj7gmrPTYkZq9TJ/RbW+9LSXVvEKPPEclNoFIqZNmfAxb6bVCn5MYStrS3YsgrIOyrc0QjvSYwSiOSNEyiw0wXG8Ob3zI1CIinAgrWIX0aLkwHWfaBO8L07BMqi9xaueaRvGuYNBIy9ylyX+i3xxkIeXmtqM2eHiP5LK7Pn6wNuUN5nxAneCKDf+rDr3zKAjCwMtPph6+SeNBh5XvTZDtOX9wn57oowtBoqRcRri5QsLCSSKhhRv6Mj27750yoQR4iwF6xFqIZtMuldMUZqlSb31Wv5LmBvnzxzmWZ1Xa2TpI89X62gyUsCK7LQYcwfK9mFrWDVq4BwB+WZkBr0efwglRP1xjfIF0sbN/D17UKYvElHW4P3v6z/b/h6/HaqBhDjBNs7j+cfIyJc5w33hZgQ3rUcinQO6Nnr1cCD4ec9pW/TCJrg1s/KiKNmOfDj9ppVHCjquwhVjSxG+uJPcaIxDZ94S8YKtbvdrX4cNglVkVUg2Aiintg22BIVh923C1fRwo8Y1mP6f31NoxEFdjFpS1Y8R6uScqL7nDwtPyaS8jEclkP+9RO4K/JR4lrQ9RQlczNR3W2zV+0EYJMftkmyjQvI+06hblgdEna+BI6dIPVUgUav2wzSFhArPQmbjr5ExgrMs0R+FiPByNNiYDNLl4DX6tC1oV6jYxvftlzuhcef1hZpPP7h2DTK3WIMmYkTg2RE7hZbSyA70xbzg4U/OBDJB8AeRaOqYO75U1oVJch66N9aKaiDpamaqtVBO7k2T2edMFC3jxCx2KNgge93044Q3WQgR37+r0pZzWasiJ4AK7gbH0W33WnGVo5m07GvyM8T1HXKOuaULBk4D9S9snl/cQsAqJ+6NleN8m0zB7lXtlX6acCYAHdUNuyLMio+hwFkXhHSGJzNa/2/D17BWq91MhJMiau7dpBUG/XXVXhZu78T2WEoWz/0ejIDr0GUuBZsi8xTwxcYbt1Wx+hjctHx0hG9s1ZpDqRwL8/CfznmkecBpx0SK9Y5XIHWMX2uIVSpiOOyeDJqg7crjYW/Q3QSaH9LYRpmjJc7jkdL4x3wy3br2p26on9t98LSzq6awPbl3JhNuZCW8uGHX+HcBN4dQa2ibnqkLYYhYGv783luRDFRXG5bShUbvkVMHeZOOzh00MFKLYLO06Dr8wng== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b79e0d5-13b7-48b0-c566-08da9cb11447 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 15:42:39.0988 (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: ZUz/7peLAALRSOnct9uXPoQK98eInuSOWGFaQ5hJGf6hJ1E1MWUrOSYbWzAQed2Qce1cVoSEypgBdihCTfe/a7AuqBCefw0/2uNIhdA1Ntw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6813 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-22_08,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 spamscore=0 adultscore=0 mlxscore=0 malwarescore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220104 X-Proofpoint-ORIG-GUID: kQQ612thRKfYbH5ZCsrLnULgrApfj9iz X-Proofpoint-GUID: kQQ612thRKfYbH5ZCsrLnULgrApfj9iz ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663861375; 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=v+Tc9+1YIxWX9qFepHQAITxeeRxTqqPAYej/GQQcHVQ=; b=yrn/ykXfgb87JZHKpKg5iBbyWGkLJmGOpU0M7G9knaxLbrmjYhyDXJOjtzyrHcG/u7Gxke pBrJ3BUhGq+8cZaAZgy3GAXZEfQtmbbqNsJfRsAYEG4Wm3598ubVRx/8UljkGzklJFrYcf bdNmr+F79rbfKQsRaSrIBWKKBaLZRBE= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=XGWOJRpI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="eU/T9wIR"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1663861375; a=rsa-sha256; cv=pass; b=ZBadtANQaXBVe+h1v6HMUZsqK84i58AOld9j1zp1/Mx+umFLWllJlgs7fnD4OGERuTFI5t 7nwmVF6iEEd5qDoUa/NFtI1jNSgLAbh1lS8fQDCJD0E/FlYzLwIpScsNMd33cUWIrqe/E0 lIGx65oFBISXUZ15LHysn+tjt6OsjBQ= Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=XGWOJRpI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="eU/T9wIR"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspam-User: X-Stat-Signature: ghrcr585knsnkzui8pha6mbqddbryr3i X-Rspamd-Queue-Id: 8A3A4400B9 X-Rspamd-Server: rspam07 X-HE-Tag: 1663861375-214546 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Allows struct folio to store hugetlb metadata that is contained in the private field of the first tail page. On 32-bit, _private_1 aligns with page[1].private. Signed-off-by: Sidhartha Kumar Acked-by: Mike Kravetz --- include/linux/mm_types.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 500e536796ca..2d5b1575ffe0 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -144,6 +144,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 */ @@ -264,6 +265,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 @@ -311,6 +313,7 @@ struct folio { #ifdef CONFIG_64BIT unsigned int _folio_nr_pages; #endif + unsigned long _private_1; }; #define FOLIO_MATCH(pg, fl) \ @@ -338,6 +341,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 @@ -383,6 +387,16 @@ static inline void *folio_get_private(struct folio *folio) return folio->private; } +static inline void folio_set_private_1(struct folio *folio, unsigned long private) +{ + folio->_private_1 = private; +} + +static inline unsigned long folio_get_private_1(struct folio *folio) +{ + return folio->_private_1; +} + struct page_frag_cache { void * va; #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) From patchwork Thu Sep 22 15:42:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12985456 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 C1D01C6FA86 for ; Thu, 22 Sep 2022 15:43:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5DE7480008; Thu, 22 Sep 2022 11:42:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56720940007; Thu, 22 Sep 2022 11:42:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B8F180008; Thu, 22 Sep 2022 11:42:57 -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 25941940007 for ; Thu, 22 Sep 2022 11:42:57 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D4748120416 for ; Thu, 22 Sep 2022 15:42:56 +0000 (UTC) X-FDA: 79940139552.18.6025FBA Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf09.hostedemail.com (Postfix) with ESMTP id 7355C140012 for ; Thu, 22 Sep 2022 15:42:56 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MDk22U032064; Thu, 22 Sep 2022 15:42:47 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=x5Tlvkf8RgE8zYLmzgrIUP4A5q0zok6YkaD1iMXGP9I=; b=cMwKQCyuNl4hX4rXt/lcZ6EzSMqy+aLGbGssw79ArRCfdD6A9QE7mEcTauMzFNEM81Ch H8inbVX8dNtdrHqQpUk2+qiMVu0Z46TfZnFMbfZCFbADDdaNWfR3gKecVQ0TWrQLSQJx StO3PAnnu7b/ezR73CBKhU2msCmveMRUIm8Uv5oiEGG03x9fhJ2Avyrc6Q1TAdh1t9R/ GPp0RZQdTVLYAYd4Oku36DBP6Qk29/cV49+5W2I6Lb1tJrlhrh11kP7pJi6BVLIHq5x+ e7I2ms1kUP2Czl0g1C54X4uutxLgceJO65qdg6hq9Ao3Owe1oOA234X6k2a+XhGYk2Kq Mw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kwxmf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:46 +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 28ME16HH010161; Thu, 22 Sep 2022 15:42:44 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2047.outbound.protection.outlook.com [104.47.66.47]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cbdwch-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:44 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kevrJbALdNPi1dsFu9H+4fdAqH/Jl6GRza7ejcs7TRs5+sM3HAST96cl07+ZeLYRqoWqsZcWy34I5aYVQvWkeH7kaefEIvBXcXTn3lduPbPpqoCvEVKyULe7i1cVywUfBq1+LnySBoOMUIO4+jpYT2IG8jA4RqPD/0bGnM+TzJukivNNqknvYci9QbFWRnzk/Bl4lkoIcTplZbJO9vcT8grEGSWXGb2aOgeDEPx3J6aaQ0ftqr3W45+YiFjdc7xzWruu+PSfY5GCqg573VkDJoIKalQu5QT+MojeKsZNYLwIGN9NqryJXgkzrAvi4ZKLNyAkKmut+VHP5bdoFnxI3g== 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=x5Tlvkf8RgE8zYLmzgrIUP4A5q0zok6YkaD1iMXGP9I=; b=Xb/xzxhqWEOimaI2VVIWbcRn1QpXcaVB5DxIQvEHI0CBLsi12tNrIv+AunJa43Dcn+T04MCm5gfJacfWkPm6lRZDDYYzi9CQK3jdwGU2rGzr+tZpGniUXYfXVbETBaU6OPJNu9JnaVCD1fTR0oNOzW1EdKY65mkIDufISExuyAZHiQZiSYlhjHY7KFEogg20324D4OhH49wwAOenaek9zmlqcRsRupU4NO6PJNGGfLtvBJAeSNeAjz/YjKpS/Urq/SGM4+icBueVRnpLYkLsXaMHZhotRUAsweGdV3KG3OKVSdwvXfWNGMmw++9MiQt5a4S7U21T1eRvyWxXcH4m5A== 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=x5Tlvkf8RgE8zYLmzgrIUP4A5q0zok6YkaD1iMXGP9I=; b=bLquq6u1J/4Lp7e2mq4zLSdYBLqfOt343xf+C77H53eDDVi1bRoAwZ7adg+fOoQ+JiRv8PFLIQi0W4ikVO1HJUKIcEXUNo91lc9HCI0qc0HloVQJWVuOhCt7hGDymxwvjTvskMIKU77JanFebCXkGdZtPqcKvXByzEmeURYnzmI= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM4PR10MB6813.namprd10.prod.outlook.com (2603:10b6:8:10b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 15:42:42 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%6]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 15:42:42 +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 v4 3/5] mm/hugetlb: add hugetlb_folio_subpool() helpers Date: Thu, 22 Sep 2022 10:42:05 -0500 Message-Id: <20220922154207.1575343-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> References: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR08CA0004.namprd08.prod.outlook.com (2603:10b6:610:5a::14) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM4PR10MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: 399f1db2-750b-429a-cb95-08da9cb11662 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZzY/jmlNus3q+GXV+cepb4iY5vnxfogGLq+Q03RXG0PRCX5TGeyZki6zZHFGRiKhrjob927CGl3TWyoTx9ViHxhbritxsAjMlHDS0mYU6HmNJ8WfLE9K0690tVsJkehCdZOaIUMo7+neYu4SCe2bv/TQKtidoRyuZna9OnClkWqcMNQt+KnkHtN6CPEibR7XegFgbf6SooVoii/T+u8pSJmT4GowQkR+NiwCncGhc/g20igrjP391QMMci4t3kRdni7BTKq4Xp1ltvdELKsJ3LRhum3SrzwLP/gC+Js0Yb6C54jttewmu7uDre2g04QuRQkvKVWZGYz/Mz7RySlx+uqICMkT4/4riF6P71upvJP98VPQ9pea1OaKQpg3Z8G1VwL76jsT7iq97QZG5FfgqVwICsaiZF5e6KRjfBlU7r2onI8x8bZfTYgq/isVsBt5zRfMyt6M/+EVaBFcfCrONvSgQ/4OcHlQNTSqQwsYj5BMAOKNQQl2snhugNvrOpoxV6Ed8wR9IQ3EqRwtX1H20gVp0oebyQQ6JicZbjRLMh1hmogD7N9BvjlYDtvJsJDMQDJpM4MHlsmsVReCxobGbU/iqvuFsi7YMLd14lGiG+DmkXJB3YtWFCGw8wtEPC0WLACwH4LHeLe9dTt2ZZtZkB543g72OF+62//Z6myS+Sa3Lv2apns/mK1TiyBZO4kV0dD/lEtK6u6dfJrQBrR0TA== 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:(13230022)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199015)(2616005)(1076003)(6486002)(83380400001)(6666004)(44832011)(7416002)(41300700001)(26005)(6512007)(5660300002)(2906002)(107886003)(86362001)(316002)(36756003)(6506007)(4326008)(186003)(478600001)(66946007)(66556008)(66476007)(38100700002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lWoHR5K4CkygZ6x6MDjes9w+UadBTurk6/NVrgB4cdkumMvyBsbV9KsjH+6pukoMGdY5WeJu6y6K3ayYGZ5X1O0t33gQAZWYHzhJbZXBVUk9U8GRjZRHGu13bO2HhMX/i/xKY4aD7+JmmxoJcbporwBC+s2eZI74thDN/M5vizLaKdwn5fdKNjRetUMAbWan3FpFI8KAsSsPQHUtt/yDUN33oH8ntJ3rkxv9axsIaEP6OPN9gB8hgdQisufr/nlyKGWiYlj5c60Iadqz+YzLHk3DAAOkUf0TjWF4j6jVVEaWi3VX1ZVtZEPMUvRTXShKx9mMKp4okFYkLCgG1R0VuT3nqWr2DAu03YBiMl1DbKzgd6HJSo4CotOlPY8zVoY6y/gPatEPfYvBzWwldO3TejkJgwKrUHRjV9pZu5TLvRCRWrBzIQX5HgDDwE+xa3LB5I5FTLQGFXVhcrC/xdU1JEkB2AfIDSJXBcZrKzz3g9lPCBWD5QtA/iIdHhzFBXHLzyXypIvp9c6W4xRY7g2wFxTSspDPTw9l5/V83F5hchZ+wo7BbsCjSUyvaviDDD40kFcT7Nq3SiSJm+2kAFw4ZTbxPL17Zw2mzvElNyioyYHADctIZpKVlz9AlBPDMbzRvrwYLi4v/68XGz+FYfY9aEuvtZ4d7FBGgERsO9tV4ZIwjy5zBlHsJFVo+wsdpOVpaLzD1KXmgSsLW+Ph8INMVWx/sp1o5LczMAxpJlmakhbhhMWvRj7udr4U00M9EArtNmSU+6OzQxrs/MDywuCBIQnERPtlEPmPn9M3iRw0IRTqigWAawjz1SM9q5gva8F0hm7+5xEh/alqMk5blQvK+/IkK2h3NAz4vWL3brvFWMRlifXeTeI8S4lqH/EOCx9TRXGRCWkJXn3WBOpZFlInF8lSI8s7WYp721EvdiLPiWyOAFSBCgwso1JC36hLRGcDKCq5kTkGEVceyEOnLUleovnKQ3xtwdkqE7Lpqk8I5KNw6YJzsq9F+q1IP/wggXCsVFRrIeeWYpww2u+iKOCsWXUP2acQFNc/MWuC5jMNYHlsZb71dtR5wZ243MDppBcozZHJAbYY3PexAvUw1HNUE/3TC6mZChKLuxu/z9JAgft3BCmazyFH+kEtPrHIucRU0s5iUI79S3dT+slELZ6f+p6xCxXFNR/aVY8oUE6J/WkimFnW8QGHdayfRMHsV2+yWnwHb9SzO4IxXSPwD/oRJy4uRSS/oq6zrHq6gjlvcQC73IOqhrYXbXJ0BboQPAh/ldrksHPKv0lHoDbDLvoCbHJ01ndwrbsXQn7/v8qlh0JwTaIlVj8+ae2m8wul/ba2uXaFk/xH/lkvZgD1n53PXOqAcZ12gfIYoGAvMyHhiK5kZl2d/SY5KNreEVuorjd3WqYUo1wMzqtWgzrCMJ9Ef9Lj/XM5iTHMoNnBfT9xqHK7jSLQQ7nPY+Z8BLIV7ynkaoyxnPz47UEoe0QlmzVPEngavDMN6uqJUYRtzaQghpHA1OcvhbpK9JxwSes5IrTylG+xSI4GiuLHQt4gEhVNhgH080mJFwGC0nAJuM3arA1rcobX0fG/gHctdB76I8KUC1f5l7zjOgHIEM7a8mPSxQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 399f1db2-750b-429a-cb95-08da9cb11662 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 15:42:42.6001 (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: G6tpiRx5uMYdwcrUvjCENiwU59yOhO4Gqfy9gdDUKY68sMYMj6nNFbB+2DmKgAXwDq/Y5jDvm/1u5DaFPikvWkxH29a3AUmy2m+P/opwt34= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6813 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-22_08,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=878 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220104 X-Proofpoint-ORIG-GUID: wE3HS3cQJCotp-6d_3ECx8pirY_HJouu X-Proofpoint-GUID: wE3HS3cQJCotp-6d_3ECx8pirY_HJouu ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1663861376; a=rsa-sha256; cv=pass; b=J3hqJ1+t40m+bAqoGvTkJpAOlhXPcnw5QmXR/CCDrwcO++ZHC975JJBmCgZp6WnYpMJid4 dJZ/ArxR+2ZVzH+RHBld3PU6bx0NixXva2JJBmy5aazii3odx+IXq2qEbz7iu7jYwWhzsz JF2ALk+2gIClz9MmoV47j4UohA4/gWY= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=cMwKQCyu; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bLquq6u1; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663861376; 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=x5Tlvkf8RgE8zYLmzgrIUP4A5q0zok6YkaD1iMXGP9I=; b=0BCSZUXVasS5QeSGm3rFVpD5jcejcs/lbqiO2CVqfSwaeN1SSVrjsDXljNfPNdATWrjZjL y6l57jTgDmyFNQ96suxy4fUNIG1hSNvl7y2FLWYnlHEi7a4gXjT473SfTXrjhbcVfeqV5R 6f03/U72ZZ7BPA3WYnRyd14byjSo3Uo= X-Rspamd-Server: rspam04 X-Rspam-User: X-Rspamd-Queue-Id: 7355C140012 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=cMwKQCyu; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bLquq6u1; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf09.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Stat-Signature: ghct4hwqui91rrh3duaz487wga7m5c3m X-HE-Tag: 1663861376-704189 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 and read subpool information by passing in a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 8 ++++---- include/linux/hugetlb.h | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index ed57a029eab0..5a4b136c6c36 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1099,10 +1099,10 @@ static int hugetlbfs_migrate_folio(struct address_space *mapping, if (rc != MIGRATEPAGE_SUCCESS) return rc; - if (hugetlb_page_subpool(&src->page)) { - hugetlb_set_page_subpool(&dst->page, - hugetlb_page_subpool(&src->page)); - hugetlb_set_page_subpool(&src->page, NULL); + if (hugetlb_folio_subpool(src)) { + hugetlb_set_folio_subpool(dst, + hugetlb_folio_subpool(src)); + 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 8edcdb6a833f..f92b9e6c8f9e 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -752,18 +752,29 @@ 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_folio_subpool(struct folio *folio, + struct hugepage_subpool *subpool) +{ + folio_set_private_1(folio, (unsigned long)subpool); } static inline void hugetlb_set_page_subpool(struct page *hpage, struct hugepage_subpool *subpool) { - set_page_private(hpage + SUBPAGE_INDEX_SUBPOOL, (unsigned long)subpool); + hugetlb_set_folio_subpool(page_folio(hpage), subpool); } static inline struct hstate *hstate_file(struct file *f) From patchwork Thu Sep 22 15:42:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12985457 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 6F229C54EE9 for ; Thu, 22 Sep 2022 15:43:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12334940007; Thu, 22 Sep 2022 11:43:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0AB2E80009; Thu, 22 Sep 2022 11:43:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E4035940009; Thu, 22 Sep 2022 11:42:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D3834940007 for ; Thu, 22 Sep 2022 11:42:59 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ABD3B1206DD for ; Thu, 22 Sep 2022 15:42:59 +0000 (UTC) X-FDA: 79940139678.27.DE6E73D Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf13.hostedemail.com (Postfix) with ESMTP id E7D5520005 for ; Thu, 22 Sep 2022 15:42:58 +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 28MDnSF7019832; Thu, 22 Sep 2022 15:42:51 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=bt9CtrWG1S5Son+fucIKpV6bB2mdF26ziAG6aIl1FPs=; b=qcWw37R7Vhy6jshL7V1eQH++I3VDvENRgZQArm0tnkVmYqCT0JVbmFwrlwwv3HOGnqqb z6pp9h8QMKSgjEMTDmovnGd9VGoTr6a8XeZxoMKvf7kIs5636qfEl06JpvrEbLXv5wrC NEYbDJOJl6XE9EJeJRzAVNzZnLTwvB61dYtfZMfQQHikrjwfTqefaRwGT+xHQa7i1DNB 5RZOOya0wERUnTGcr+Mr7OfHFY4f69I4egON8CaBd9sy59lPd300F1L/oLC6m8c/bsBK mtJQusmocLqypH0KxIQ7EWTfGsPnlp3/zOILdRgJfTGpG7rXSdpSOYQVAJ6j48lUgRaB sw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn688nby8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:50 +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 28ME0D7m010184; Thu, 22 Sep 2022 15:42:49 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2043.outbound.protection.outlook.com [104.47.66.43]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp3cbdwgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dJ25lqQA455H5DAGRnguP13W4ZN2oLIl+voh+8uvgOfhO7EzQlWBaWuW4mxj+nmk/M2T5o0vUnyTfOZ/29z1akByGEr+UM9uKiykphtlRJvNsLqGSoXYpKNlyjDsGE2D1l1Ch0UYlQxQymSAiZ72FLxlxwdrczoqMXkMhoDkJDk/Kq6/tSP3WcFl42J7X6/u4uJ4t0JhEBAcByjs+4TSlOOsL0LNLdRwPBMGJTDqDMor6q/1oFXSWCPjZOekrS1Q3F+IyfuTeVJIvzbt9L17b2rIPkjtSfLSgLVm/G1fT5D2w7+6z5+ztnEoH6U/RGUp5VnEa7Xnn7Jg1J1sLAdWXg== 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=bt9CtrWG1S5Son+fucIKpV6bB2mdF26ziAG6aIl1FPs=; b=LzapEor+VP49iAIxHAQQFk4Zv8REFf61Y4VJA68WhIIRU/h5w567hABagsFpoiQOliPzK/kulC8jy0TeyFvSbZM3GDeUpbyvaBc5p8Urr3/vMF3eU8M4PEgt+sf4DVj12MJNzbue6Agv/d8N5fq/u5l/lKcLExN6n6yp67Zh2Q4T5O7EMt6GCP4I5Z9Pcb0XH5hcaDXj77pioeXonnCfur4RhKPDRoXO5mgmuUwL/BYs8ejkmVU2J6XLXx/mPnivmIUn3phD/8nTBTOKUYTTp4CjX5wQHfqWbqMzgpT5RFQIw/XGtfVEU2OfSIwRLZGj+VF5l3uLGoSb0KoMT3sCZw== 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=bt9CtrWG1S5Son+fucIKpV6bB2mdF26ziAG6aIl1FPs=; b=hVCOYZRRhLEmkJdRYR8MwtyL+xAVu/nzZs7JCTA1BgXyeDAB9caJhgYj3C6wkpfF4MI5kKgO0nvN5jUO3f8dcFG23Pb0AndbWILa44+WomFWTeI9DMPZWX/ICdoo3p7mUIkpaGPAwipplx5tUvIOq44P52JlFuFxWzCdWPP4KHE= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM4PR10MB6813.namprd10.prod.outlook.com (2603:10b6:8:10b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 15:42:46 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%6]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 15:42:46 +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 v4 4/5] hugetlbfs: convert hugetlb_delete_from_page_cache() to use folios Date: Thu, 22 Sep 2022 10:42:06 -0500 Message-Id: <20220922154207.1575343-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> References: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR18CA0022.namprd18.prod.outlook.com (2603:10b6:610:4f::32) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM4PR10MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: baa36f1b-80af-4fcd-e349-08da9cb118da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: K4QY9knvumZF/wXGxvMHlPUbEPC9BTVG/fASd5y+UP7ZyzJOsibvKpBLfG0Cq0ptoc323s+FAB4kFTH/IQBLIzZ3yc1ubavWNlkKoEgTrJHPruZMnuh2RnHYObenttokqIsCB7BL4dIdQA5XBzRrwrGjDHrBnxBP+Yl1ufe2/OqRNAqDSeOoVz5QyHR1baFh+9zR2L54Ys7bAnIA6s/W5D5esdUP5kOiAkMU9g21bXFEMPwrPUSyvqzAMtpygagVPjhdgCPxxY72+K9htRPXgWLYIIzzZYiasARdnibj350+XduytDc3y/bq80w9oiShAiXbl30ElEjti9U1F5r9g/FNa3lCmvZ1Z12UetUTqJUIFHt9uF7+oQ4WgCnMI0rrty/pFuRi3rmYx5ZNwm05wMTgbrc5yN+Xq8o3ZMAW3K5GRSwbsTml0DxI4/r1fWsEnvrcNSoHJeFuxrTfBhoaTC2XMhAsCivwxqjWsx1Wmdur0C+7ifagPtO6IG1RmbRydPaxyoL4dOTw2HqKdTl25u9qdm+J7Vs+tnZc6MsCwt56o/EDK9yq2p8QIx4gMZo/o+IhUUjG8ygZpn82qeY1hCrN+CID1DD8VgoZQGnh1MvD5fLKhrqlfOcnlPV3Pj3/gm5ONKEg5a4lFcufrFZ1ol7RzNYNONncOIi0769CU5EN7LbGS08Y45XTa6z7XR6R/zwcSf+XGWlue2Pd/l0ItQ== 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:(13230022)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199015)(2616005)(1076003)(6486002)(83380400001)(6666004)(44832011)(7416002)(41300700001)(26005)(6512007)(5660300002)(2906002)(107886003)(86362001)(316002)(36756003)(6506007)(4326008)(186003)(478600001)(66946007)(66556008)(66476007)(38100700002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9AJ9fEwx8kPFkvZgY2yzU8nM85t0pBEUoDLNXoSqbwftB37Hw2mejyUDdGAunqKbjhV5k6GlOS4UF7GS0bfM0SUdvWYc+cbU+wXy4Dje11n0dbpQC7DW8+8AkOpZlhY10/6drpx4sPEzgtWp66Naq4MC8fYwgWrkFYel4sJ6MCd3n9jZPQPVwYP68aeHOIriFPJXDqKKNVJ/UjN4m3sc6RAXtPeXqepOniH6aCcw9WLwOgHVWQYMywB2OpymdrCBaN6cby7Kxwp6P+D8fQ1vCRXN49MQIkLv+5zaaTKzc06a+a43mEVwCPg/I99vT2S9THkSO6i+Hhv/whrrWLH3xf2XMIahlJDsDXGjsGRS+wD6Q4nD1YAdXLfYIpGTshLhV0QVDtmPUDRqkDddFy3Y6hFz+7w4wrZcc6d+QIx36uuFhucQOTYEqOrS7GJXMQwewuiBTB4Vz5oLCRE0fVQUGq8SRoQlIcH1hHOziOuax8Zk0riNQgKWFpS82U3CyeEqlvGes0Z7XlGz59bzzU8Zp7rT8n12BP6BAS+3ex28fyE8HJJJA5WbysJm7yZSqwpgTf9s7/m5SQB3Fyhnz1MV3XjVmCibzpBbX1nQlIo4AWhhFS/lmwvUwzjtGZVS4J/+n/Swgm9mXREo11+QLVe3AOd/KqRzmcRY92OK8oxJQz3YvjTS38cHt0tPASm5BxJv6E5WGXep3DnlaCJ7Ti90Dhh4mOihIdUDXx7ARAap81jhK4iL1o8nNOYr8zspM/foooaXMNv/3E8CQ2Dkdi4YoEMpcLluIi40StQPUWwOCQ9fd/nWYxBanGn38t7c85xyqrQvJ52YKISMuK7bltLG/5k1kzTGaGFuH2x8pW96oECljT3P7beYfzWOTs3gZvUKSR6VUHVsk2xYB4HSeSfSzWIdXL0E1hKogslWXRrHH1WFdAeRdP8rRSsateYhF0NiA6sEQGrrsPI9B73N7VPp76lO8w+4u0nnlsSkbbrLCQYWcVxs/oySxjbZWaH4VKMSzqCNnVd7sH7uypYVI+7w5VTlLntuNYVn4uthuSYDpFAJpqvGLp80Nd+bddglm5+Mao0TtcGxfgglivlG1H1JQnHfwNjvbsCxHupIL1aUu1Ku6ZPNIo2JcLN9WVLvddhnY48bxkjbufV2fzjaMi9ew2Gau9InPC6pD62zlldZNhUs4cc0wYfqklzPmWkKwOGmXIVIFQtT0ZXEYyApEFDHGRQXEPviItqoiqvSkFVnu3SEhNHJm9+qz2iQFhzEWmErLfJpu2RXbiKiUVu5DZfCvDRpXSsEz0OgmcjOWgisiTuWJbQGKkr1slE35iXMkXFEKaYafeT35TDIA2SZF6Gl2XVz8a0P4gc0aeIyCXvaP879ESnocjP2AgztN7Nv4qB/i3y/QHT0wx2YOFLbLvIovNOhgiv8Z7SF2AWfXCY2g0qQb5GQxCZvtujjk1VbWgAA/cqt6/gD/WOPZtekqpZDIGE7342Aiilwx3KOmAcaRZyplTyV5fYD4//xb+ehJYVlJYPffmi8DjzAahLsH6bCHx6QoLmgK2NwmaO8Zy/XV3CLsgXkspvFsX5erjO7GTDxvuK8u4duM6m/nxmdm0nOUQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: baa36f1b-80af-4fcd-e349-08da9cb118da X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 15:42:46.8051 (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: n6SZ+BsxltLxEIwXbmENJ0CZCokeH4fbZDQ7jEOGY368RDvfn+L+L0cxJHTZ8Frrz/I5K/3QTjMTeIKM2RmTzLDkNkoBY76HiCEO2267bxs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6813 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-22_08,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 adultscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220104 X-Proofpoint-GUID: 8ezqDllgYqfP0qGJunrBOFnePlb_e7Av X-Proofpoint-ORIG-GUID: 8ezqDllgYqfP0qGJunrBOFnePlb_e7Av ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663861379; 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=bt9CtrWG1S5Son+fucIKpV6bB2mdF26ziAG6aIl1FPs=; b=bZ7zkhiTnVc94HvUrEj0c1dD/69JKEF8Jjygv7r7TluQzPGwHIXdxKcxnJlA4IHVQ/A19V fknJ56NrCd+OHJh4xhl3q46hMYBo8Vm1gmA3P7DP8ES2Gv6qYkxOn0Sf3HOsgiUg2lgLh3 PllXsemIEO8BByEjgldzRg5DadipHaQ= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=qcWw37R7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hVCOYZRR; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.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=1663861379; a=rsa-sha256; cv=pass; b=cqMY2SP0nPMem2hWkSZY/luRCQ7ZqTK/uz8Dwbt6QsnUGqc9IJAH/8+0xF++CY+MRiiOcK YXwwCYA5dwR8ZEJwnkspHj27M171fW2UNAtiRr1DVnBTCbv5+stcrB9Yk1UquK/32aiA86 9N47bLBVb3/zg5+8xFaGsONA4JTpUX8= X-Stat-Signature: gfseb4wbfhr9tqtbgijcc3q7torm4oya X-Rspamd-Queue-Id: E7D5520005 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=qcWw37R7; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hVCOYZRR; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf13.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-Rspamd-Server: rspam03 X-HE-Tag: 1663861378-524421 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 Reviewed-by: Mike Kravetz --- fs/hugetlbfs/inode.c | 14 +++++++------- include/linux/pagemap.h | 1 - mm/folio-compat.c | 5 ----- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 5a4b136c6c36..4201bad56542 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); } /* @@ -574,8 +574,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, @@ -1122,7 +1122,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); diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 0178b2040ea3..4611156ccfe9 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -1106,7 +1106,6 @@ int add_to_page_cache_lru(struct page *page, struct address_space *mapping, int filemap_add_folio(struct address_space *mapping, struct folio *folio, pgoff_t index, gfp_t gfp); void filemap_remove_folio(struct folio *folio); -void delete_from_page_cache(struct page *page); void __filemap_remove_folio(struct folio *folio, void *shadow); void replace_page_cache_page(struct page *old, struct page *new); void delete_from_page_cache_batch(struct address_space *mapping, diff --git a/mm/folio-compat.c b/mm/folio-compat.c index 458618c7302c..e04a61905d4d 100644 --- a/mm/folio-compat.c +++ b/mm/folio-compat.c @@ -118,11 +118,6 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, } EXPORT_SYMBOL(grab_cache_page_write_begin); -void delete_from_page_cache(struct page *page) -{ - return filemap_remove_folio(page_folio(page)); -} - int try_to_release_page(struct page *page, gfp_t gfp) { return filemap_release_folio(page_folio(page), gfp); From patchwork Thu Sep 22 15:42:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 12985458 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 C38B2C6FA86 for ; Thu, 22 Sep 2022 15:43:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 58E9E8000A; Thu, 22 Sep 2022 11:43:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 53E7380009; Thu, 22 Sep 2022 11:43:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3B9188000A; Thu, 22 Sep 2022 11:43:08 -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 2B9B880009 for ; Thu, 22 Sep 2022 11:43:08 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 07FEA16056B for ; Thu, 22 Sep 2022 15:43:08 +0000 (UTC) X-FDA: 79940140056.11.AF84ABB Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf11.hostedemail.com (Postfix) with ESMTP id 49E1640069 for ; Thu, 22 Sep 2022 15:43:07 +0000 (UTC) Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28MDjvXA032075; Thu, 22 Sep 2022 15:43:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=5ZqfCkNz6cESzkKFdGF1voMVusdcQyTRfi0LA23StCQ=; b=bcfDSH2Jp0ZxeuPNAVOLe7S5xLBbNrmGQKKrwoFABh2m+rTeGDN62ZXDtlOyZ4dkFCtC 7M3leRFtMHbohVfq5dvYTZJANAIjV3WT25tTASDSNp7meiJqgb2ofr0XcMD+82WTyMhJ PTALotoQQEisBsl6mqORAhFRjz0mNSN+IizRmlJjEWbtKiYZ5UTk7fAqk7Sd8Lqvs0tn WOmJl1FO7OWiEhG0tuD4sxwR58BUEdjlq2WjuYEm1U9a50BBcTiRwpYVmKOnfWtyrtA8 k6DDWvrihtWLottDtwZASdzDkrgEb59ixUJ4FRj4aq4vQJw0ZRAgns14oMqF59ZdCJ2M Ig== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3jn69kwxnc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:43:00 +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 28ME2R6g001918; Thu, 22 Sep 2022 15:42:58 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2046.outbound.protection.outlook.com [104.47.66.46]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3jp39sxfsh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Sep 2022 15:42:57 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H2ac9ZbkFD24kxtUehH2OXVs3UXFQuzf5jqcVkqGh3eLBdgY1Nij1W0K0VCAyyBNwJ+1tvlTJVxeXt0D0jEdJ5dB6Jiac/OinaNXjktyBjxuTdYzO7+kwXZ8+ia4yhk4pIHnyw3p6wPVgRW4b2QSnd7JJZmo8aqHr4wrrIOLc5wcHMyL56Nx/O2oaD2YwHcgjJOOdZTeTKrgdjYiqsmeU+DZ7RGr8282If2Yd7kdw7jtRmf6aZeYQyzwas/eW5nEUpmUNtqr+QJXnqWwas324gHQ+3gbHwKNKGOccWQ7y0+ozLOXY6ZyZOJI3ge9g/j0Qx3FX795j2geEc+UpGxEeA== 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=5ZqfCkNz6cESzkKFdGF1voMVusdcQyTRfi0LA23StCQ=; b=M1xfEIp7B6EVyQZgfphTG/DIY76VI+DwyM5zPFsWWP9eNT1ZDBbl8pz07iPUJ2yp9sYU+sd6gUO14cdXjg4wcHIlw90XBGbkb6tF34pKp7hC06q3QZ12dOZaeOaOCfJwhipJ/xHJnlz4dqUCKxcSANzf3jpUD+cNcm7tIeV9u2+U5siHTAvjEtSbbiTWS+6DKB6cxIq/Xgeg3IORejpFDSixrSepjc2YppF1JKRSH+bZCelVHIHMJhyPRi//MqPgSv4R/9OXuvrWsXcCSfDhrUALFuy6ShiZ+Ppl93nS++eDLnMEeyfQWniiIONnQZFE7KUzoAOatDaw2aAkwztVMw== 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=5ZqfCkNz6cESzkKFdGF1voMVusdcQyTRfi0LA23StCQ=; b=pxqZ5I8wXYsNNogUGjov9rmcm2/eRw4gZNlDMKUbf7FwwkL/wU1MuXjB9mupxIH3KEx6yBZCqfrAHvc0DigkgUzjoUhwIvxqdBzPlJOhxuTE+CAmtpmG/Y0ZTVDwa1uzyPRtiV6Ksuq8Qos4Nk2wSqC/FPhPtXhsQfuANMb2Crs= Received: from CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) by DM4PR10MB6813.namprd10.prod.outlook.com (2603:10b6:8:10b::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 15:42:50 +0000 Received: from CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37]) by CH0PR10MB5113.namprd10.prod.outlook.com ([fe80::ec55:981e:3693:b37%6]) with mapi id 15.20.5654.019; Thu, 22 Sep 2022 15:42:50 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com, Sidhartha Kumar , kernel test robot Subject: [PATCH v4 5/5] mm/hugetlb: add folio_hstate() Date: Thu, 22 Sep 2022 10:42:07 -0500 Message-Id: <20220922154207.1575343-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> References: <20220922154207.1575343-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: CH2PR07CA0019.namprd07.prod.outlook.com (2603:10b6:610:20::32) To CH0PR10MB5113.namprd10.prod.outlook.com (2603:10b6:610:c9::8) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH0PR10MB5113:EE_|DM4PR10MB6813:EE_ X-MS-Office365-Filtering-Correlation-Id: 4351bc9d-3637-4215-3cfd-08da9cb11aa2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qE78Y16f6oV/rctsyRhq2dbw7Gvl7f3DSziZCXRhIt+d1I7E21qS39I+KiKoRNnL+h9qEWy3oBzchYvGLR2Lv0B4Q6vTD2i1m2IcelqlXFKDw4NFeOCqa0s+VWexNFi374+UG5cNVVLT+8/i6GRKkHW/IMX7i/Q1wQxPlDq1nqhxd4vjJi1GhtZqYKQ6xN5v/amZEMuPVBFe48N1/2w0u5jS8So+oCqVveIylx85KHlnKv77uRyeploL9iodfSkxKMfJL1oQzpXZ6FDmB+i0ARXEBvJUyXCpV03LTup4UfHIXvzwDjts/HG3uFzeOITPpwJyf3l0yPRFu4RUd9/FqlYZoHwPN5cCh2TyMyP/Ue65W88lsvdfnfQ8R++feM5ucXKkiFWMq+QL2kB4j5CJ918g/82dXnpwlJ4IgcO2fYlYkmQyAKfON/eNfIhd5m+vKDP0HUT6z333e1idKR8lm3VNvaN/AH0XJE7KwEdneBXcREvXntTTQYKpcc6PPOxGKv0Bk7JNn/ReNZNnRzIcU4MxvLY5d0I7LtHtDrKmtC85XQphH/FGaZj+TghdNrTv+ALQV3ZRJ+CfcjRRih36jmZ84qKd9dm07C0rm8S45uoUX1RGxsXQShfPBXEJQ0uvfDdiXurCIhexn2Gr7UMNYKhY5MGjK5w9F3ehaOh4UKyz916T6hjda2UaLQzIclJLBwMLjrOi/g2LqCrXgvRK6g== 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:(13230022)(366004)(346002)(376002)(396003)(136003)(39860400002)(451199015)(2616005)(1076003)(6486002)(83380400001)(6666004)(44832011)(7416002)(41300700001)(26005)(6512007)(5660300002)(2906002)(54906003)(86362001)(316002)(36756003)(6506007)(4326008)(186003)(478600001)(66946007)(66556008)(66476007)(38100700002)(8936002)(8676002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6zDjjggXT/dzfEoGZXr6ZXniyb8HgWiizAwTLHrT9L9xBoimHguJZbzdnZok7YCIXdsxnGEOaMq4BdfDlMEifkuVVnix9SxWTM7+p8pi9LaAEiPrvOYU+tsViFbulwdpIPpXIVb9IDNqCwYfKUqrQujCNvcW8ABMj8HMxXMS+AEgqDCAT6Nk74JRIL0KqgkukT1UsyXD2AYsZol03MZyPPVDEU0paWzwBudZpYzioqU/GH7dH+7ppVTtACkb+isU43Q9SdY1UnyEB8HbnhSJi7ECr4GfQL/81zdGP3Quqe++bAULyQFZ6hxJIrhFNIaOsWWZxA/B1kLjkkCk57GAaa7UhKIslGOXX310/6oWoydRhqOWB55hsEHM/6nbSyLyw8FH9klUhiIvgae21bJtrlHMJGw56GcMbgbqYwlR43iSPL/bFh5q5gIDpYJn1oM7J33ewp6GyIaD5PCA5DTTDlWUON4KKChQMRZvT5omt8o2V5Z/zY5vtrf9OFp3oAPz/W0nHpWsVKLs2mICsKJStNFKxqnpvS+s8FULq1s0tadHs5xZ+fAB1DX7cWnbyJLKpb0vLNNC6z4j1Vk9YKi41Lllrk6Y4Tz3k16azHPglsNGPqEigBJH++khVi19W6rRWR2AJNGVXX13DtUUxVaalUTnMUjG3/84unpQ8g68cVGNTHBM9x+7cjCiBjpq7XpGZxYQrjf9H0G+BLldktqTz2vYFry9OH9tdVsYgFux0+PmxGoBkFRCOCprehBEHT8PuJbfeZeFWZFsyl6gB4L9IdF6riL11jIj2yP2RhuPHXxIVWIyIu6hVA8l0Th5sAKqXUN85dikwGDPwnCWl2UL99oFnX+4GY6NPo0X+VxF4mF3EsOrjxE1WbSPIWn/Wdq29mhYPQRSjWgLUnVTFS05KPdnha85d375tid4F6wR/uYEmgFghwJfECq0cGts4qBv9yOO1Jato215o2WoBWN6YRWC7ZtYHWoevSWYsN3cfTaQb0GhsoBKpKJQ7ZynqT5LRjdiddjChta5IubRpTzAPJwfrnevPzhOh0AcRt1KtY4+XJCOG1M/iwogPWb8eOzeWQbW4zEcBFOAHMfh2s9dVToq7iqOzqYoZbBt5ZwWRwD+XEmlODnaAvKq2q0WI7w/Bj2w8eu1DiGbhEj398h0+q51TO2lQ5V885JgJ00okgxPsnV9EkWT/a+qmkmzL58Reowr3chNaS4tS7G43XkyUbi+AwjZOewtfb6tvC5gAKGwadk4/hRJrxq5Sv8EDBWGMwblhIFWaMJsQ1ip/Mr60+UucdHko2J4C2aRQS1BSmTrps4dvnTnAp21tnDSC797yqL7kEC3ZS+CfdQsuFx50ayagqFHVWwXF9OJT3L10FxYFY2QqXH9DFwPG1zIRomDFHhdKBdqHRq97U2WdI+XfBqizvq52hkSLOQUH4IBHp7q65IyK4MHBWKUmKz60hM2xQTDQuVLVZRV/wGfCCrVPmEDVHmTpfMThQrJvpBX74BbNVrLjaXbg7m2n05tAUGWl8QJ8WiyI6/VyyNOKcEiMQuVfCBNs6ZARpHENK9ZbCKjSQgzHgyaO6IY74w+sPaNxqCeMAa2q6JCkj9J/I5GiQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4351bc9d-3637-4215-3cfd-08da9cb11aa2 X-MS-Exchange-CrossTenant-AuthSource: CH0PR10MB5113.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 15:42:49.9781 (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: WNpLMmSh7LqIqnnS9Lssqk1nDmBJ8ZIbjBjzI4whcPuCAywkn0j7ubVt+zVBAjo1Ij1onKyK/x++vA2hJX6pw8oV3Km3KAPVRvQ/Df6C73s= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR10MB6813 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-22_08,2022-09-22_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 suspectscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209220105 X-Proofpoint-ORIG-GUID: tMzL79FvirsCMsd0nJ_Bk3JhACvCjL0j X-Proofpoint-GUID: tMzL79FvirsCMsd0nJ_Bk3JhACvCjL0j ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663861387; 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=5ZqfCkNz6cESzkKFdGF1voMVusdcQyTRfi0LA23StCQ=; b=fYSx7V2RhihZsrkP1adB8gUWhYyfEhAXmkBDw0D63xECkn9PnegaICOPx4x6MmBJKgY3sl 4QKXVBDHY+6fyuV0pzso36vvZnOQEd9pjWwdP0rmOyQYgU9sbvNrWZw53JaexihQ1mJTa6 Zov1fvv9lCY6O2RfTMFo1a0rHqU8Wws= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=bcfDSH2J; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxqZ5I8w; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf11.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=1663861387; a=rsa-sha256; cv=pass; b=ap7mLlYdZ2D5VJmB0HivId0FQgUr6VEPi/oz1MQ6Yi6W014Yg+DyIzeS/n5b5PGraaKyAO GSDSmUWkhg61dAj+ZMi9YMayueCi9eP24j2QuUjDwCFmOlkQPEl7rOfTL2KTMTJwA5Eyv7 a4IUlKJCiMVgBHXYwxGL7en6JGPGWjA= X-Stat-Signature: uhbf69xik9w196ii5y3dmiqogzaaiokn X-Rspamd-Queue-Id: 49E1640069 X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=bcfDSH2J; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=pxqZ5I8w; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf11.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-Rspamd-Server: rspam03 X-HE-Tag: 1663861387-54150 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Helper function to retrieve hstate information from a hugetlb folio. Signed-off-by: Sidhartha Kumar Reported-by: kernel test robot Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 14 ++++++++++++-- mm/migrate.c | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index f92b9e6c8f9e..b4473bc43806 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -858,10 +858,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) @@ -1070,6 +1075,11 @@ static inline struct hstate *hstate_vma(struct vm_area_struct *vma) return NULL; } +static inline struct hstate *folio_hstate(struct folio *folio) +{ + return NULL; +} + static inline struct hstate *page_hstate(struct page *page) { return NULL; diff --git a/mm/migrate.c b/mm/migrate.c index c228afba0963..17b92af421b9 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1607,7 +1607,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);