From patchwork Fri Oct 14 03:12:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006630 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 6CE9EC4332F for ; Fri, 14 Oct 2022 03:13:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B15806B0075; Thu, 13 Oct 2022 23:13:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9CB46B0078; Thu, 13 Oct 2022 23:13:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87C6C6B007B; Thu, 13 Oct 2022 23:13:54 -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 6A5D76B0075 for ; Thu, 13 Oct 2022 23:13:54 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 379201A07C6 for ; Fri, 14 Oct 2022 03:13:54 +0000 (UTC) X-FDA: 80018085588.25.8D3BD2A Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf05.hostedemail.com (Postfix) with ESMTP id A568910002F for ; Fri, 14 Oct 2022 03:13:53 +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 29E1Txkf026322; Fri, 14 Oct 2022 03:13:43 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=/ecZZqbF1xzPcqYuCvFEI6guW/DtEAVXatJHoDqN5qw=; b=SM1cJ5jm9wlvT7sSxkI8ePH5XilUFMHpqGD41b1M0uMR1MmpqxV3Al1Cera2zgsJNclf MfJnT1ZMb/EP240L1Ygh4vR3bVu4xw+S0/GG16wjdXM0ai8DTkjYPlzt0dXNDJsqs5io 4Z/t/K0F7MxKrC3usjLZc5aBd1uaZEHD5l+bPNV71Wvcp0J18CzELQxkRjc2Wkajm8Zd 6Vnpe9AlSTT6NHgLrV6kZD+fHhe945ibcpLwt0ShdtirOeXSb4cbCTStK49CoeBXeZGj tunFT6nRZGat08SaBhK/uZ5C1wLuOPWn74FvjUK01P9uvubQcFs5hwsYv3iOIdG3ESf4 7g== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6kgmsv76-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:13:43 +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 29E2fbtg017587; Fri, 14 Oct 2022 03:13:42 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn71658-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:13:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OQ0GgOYTromkX2SCyKCFL6D6IUCKlDOVy9Opad+NReyfOwrObBmoejwyTEQC2GxVZAIvDuNtHDQw564Ax1KGqQMP87qb/1XVXRKyQagb7wQx5C9TzyItZDU2gqkfaVw/bH2MkI+XBLAcxxi2bMFIBt6ejUR/t9GYJKGipYUDfP56X8aGVPOK/FgalIvb5cgG+17P8uXcBsH9yEpR5XXVSaPwWFLaz7mk6cfpS3NU2UrQBywvmikCxgtbIlWaE6xEFfoNt/XqKLd3EPLBM5xhdpJm0EZbzBuYt4mYmD3xkUHNE2we5hPtvW38YjZ79j2KQPCvKIbaS4Wn7+K2SyQ2MQ== 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=/ecZZqbF1xzPcqYuCvFEI6guW/DtEAVXatJHoDqN5qw=; b=mK82J92kn2kTrGZagcfKiVbl5YKcemuZTMtUqoxhAUxtZW4UMwJGsxd1yGURp3nOF0GWzUr0rOo3nykbn963KnrmVEWTZ+gcrC/c1AAXLSnoZWM85eKxwnykqSjF4zltF6LmD6bYGevG2329zfLG35wLwpylxRcARCcws5cqGlR/cyr8rAr8d4Kr1mRlhE/D8wMFmhQ4LTpr5OuYoVLpVoGNKH9AUfPrvaaKJ2B1H3sLqkN8WfmkGRtg6NH/LOpYz/p180CQRZ/Nah16T/QQ+rVi1+AdvgLVQ6jo9YTe6l96QRbKRudAIFhOLDPosiLZetD2Lkbkp/+ly8mrT3x+Fg== 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=/ecZZqbF1xzPcqYuCvFEI6guW/DtEAVXatJHoDqN5qw=; b=WepxlrKuunNDAlX+/ZQizwmhBkBORJjuBrxA+BjfI+kbimCfUcSCIgEeMEXixxzmiwEGRU8SSysoF/9kxtR69Jv90fBomhuXZWxNkVxJI+ihNrLjKgSEWk/u8R79+zJN9t/f7HOoeEYwlo53AAKbyvzoP3XaT8vbiIR/H8gtH6U= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:13:40 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:13: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, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 1/9] mm/hugetlb_cgroup: convert __set_hugetlb_cgroup() to folios Date: Thu, 13 Oct 2022 20:12:55 -0700 Message-Id: <20221014031303.231740-2-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR01CA0004.prod.exchangelabs.com (2603:10b6:a02:80::17) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: dc6527f4-dc10-4b9e-55c3-08daad92175f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H6MvUdOWb/7tPEo8k9n2GM9FqSwYkcBlUr6Kclffek+wI/zerZRg+/JPzqTmpDTkM1NtDoL1arB4CqE0Tpcd0wksNUKjQcuGOVdnZQdUdIIMLeVQcUl7N25oEyYzDtkfB4sSmRFGgV2YvHcBHdCyltZjzhdZ+efbtOSW7RT0AMW/k1b2yX1owfXg+X86NIT8JxRePlREvyBMe2VpT4u2QawZnosFOTD9eKfP3ahttoNDz7c54G7mPt7Iun8SYM6qmys+pNxFO9PHlp43SdnY+tuDm4ZsHzBe/seQLL8XIwvMsls7fxQjS5m6cXSDhKX6P2u/8K24UQrtvu87DUv0joPUvjQJhFMOe8G9Kz9IMZehZqzFWorwz1eCNKDGZ5y7J3RPloAtu0djlAYh0mQ1LfNKRIcLo9m8/4zOgS3NAl5dGFR+eiPWtTfjDWVmzJsI5vjrHkFxnLsPTh5gBOycfTvao5Lp2Gk6H1eCCi/O0RzJExdWW5WszYw2DgoCTuDxtylmoX1Ike/2yrRw5qXWE+8Q/icxMxROZHt5JvnSciFeUuPG1AHslfkRvQBIsRzyc9cFsF45scK53jllZvJuSe8YrmWaB8owhsVuaVNiEkcmsuWBHsJlYUQu79Rquqlj05UXmQZqcQb4rqz/JQkAblpZBiRv7sb9xJFD5Gk8gxv6+2ekvLW5+EJRunC1PPKktu9aG5kWl2GRbeSxkYHhbw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(6666004)(107886003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: K5maBpsnqwsu6LZfrt4CdqJbeaqz7QeP/1SiUVcFqc/2UDma01rdMq7L8pYRjMRQunHVf/atVyahcFqMW7bUnWgCWrrAAtE5b6VVMrqBGeaIFdqdoG2iWB6JLDkg/Z14KzCABDoz/f3kVyMgVmCaV7yN67NjhZxPfRmsXq/s4SBx9jAjQVKayPRGMeCIZMC5JmKXYJl1I94eKuz/EeMo6S0FnEdsISmyKq6HnbNEcmlR0fn17ItjjsZX9Qa6RFAYagdi+VYWhw9XWofWRgeHBlyaHOSLOJdsLlnWzAO1tH3M9OfWdEzfH5MChWWw/P/mb7GG7zilauHTAXAf4N8qWCB7ZcDdoPJPy/3me9FzgOm4t1/0g3t95zVIk/JaiqOXhEzk2Rny3JWWjtGgWE3T5iIpcmXYJxbuYdHBxpQ4bh3lXMzjOUfwkh+RnXbUPHD0ce2kc/xyQodTGDE3iwPjwl6oUUQGk3UpT/IXpONQ9CKsaTho5QQcRAvghbBaYsFfRaPfKoNLXmGNahiQyzEh00WStYuQum3XdPhh2zx69ycabP//vn7r1kIEbnOA4GIi5l4WRrxLxb/Gi9YZ2ZB2k3x2qF7g5cdFWODRW+CHo+ZiyhgHPlzDO4cu4mtyzIz6abzwGx+3QUVAlL97vKuRXCV/Eq/0EJhnA2Js3HnW3QkPV2rad1BJOYuH2TYyJ/uACb6/JBgHImrzLEF0gTzanaylQDUgtP6CLTbsg5/34VL3V3nfFzoTLrtRuNWjcsnoDwqmq0UydB75DIAgnK9XP+XmLH3J/hgs/LfdfzECtII4SNQqyimbV9CUQvQo6DY84ZEYfZu4EGtHDyiarmC430+nLdAbDjeqazAUIG9EBISEyZ+0Ft50rt+5LLLbBrHanjZOcDKDEhUxIs5AgfEyPK+d2FRGlC70IJ11YVl0tJypkdNAEr89qMTgZo3Kl1nlPb9FpFwx6SyvS1aA+4js8iedmZMua2dUOwTFogxRE0XwaAOJiyFMgVTY5OlwyDgEYi/xMOhCEt49gfKlCfItV0Cjk/X4e1CnYYCh+oFHb0UeP6TkFWLqLe5jX3cPdB0hImJp7ps14V1bdb+FT17GqnPulmFzYqKKPHmmL5Nb4tJwY0LzHsB2qum6fJonpbYVj+SiyQno7ESuw4NCcHGq+KIkTQgxZFTQ16L2jYuhlBf7ImA6dGvc+qiYO9AQSn35f6JLq7khxk5uk7N5ZiXifRYrdoSBiZUAjLbmdWh47s3bXZ9e3kAK8vbbjK43v61NusFC9/+qbPVni//b3iuxBaBRLfs61xZ5Z+IOonaatOsfhEkH194umyROTov+1PVCANQEGKaRGGoEKt1aTobbWuA++PP+fQ5Jx4n7Vat/X7YlNw1OF8Vu+pVu8rRd6liADZ2h4YVOvRiuA7bF1VhA0rnPneGHGixaf83fUmQQk1CNiD8Mmr5mLWVaia6H4/ShomUB0mfzk0eJ6l57fIxRm0+ein5Xbe6mudpD5MCqXSdmz7KURjS+H5TkSpCD2HAwnzk7o8UbhjesvJiRQWnLbO5RMT/rjSo/X2iUdPG2StYsHieU8Q6yvG/oZL57YQRM+zE7ZT/EEq2+EWoPjPZZog== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: dc6527f4-dc10-4b9e-55c3-08daad92175f X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:13:39.6863 (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: U5+5rgtEhhFwdglgSfZd2vo/wipHUO7UkfIIb1W9zEtLycFpcNfUpTpQUw9+1aUvjEEDZGfuAWDGhDVbdARNXwUN4cfcBK0Cor7yXn7fGBg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: TCL30Dq5anAP7kFUCiHMkhxv5C36wRiW X-Proofpoint-GUID: TCL30Dq5anAP7kFUCiHMkhxv5C36wRiW ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=SM1cJ5jm; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=WepxlrKu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.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=1665717233; a=rsa-sha256; cv=pass; b=Okc1wBXxumDhk+UX28TRVrXenF5Iv4/XoPb+ro2yerM9OP8X5D6yBRx0uA8pBkgj8L96CF Xrfa3tk1p5Qd0qVWAUPeBwNJqRns8dc0y2l2h2HQE3oMD1gxm6u8RbIeSdEXj7Mg2qe3Pu qdr791Ti3FRJOMKOTHVlorsHbkPUnJs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717233; 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=/ecZZqbF1xzPcqYuCvFEI6guW/DtEAVXatJHoDqN5qw=; b=HyNsSEpM22hbtcic4HxvWoZvqKHln3iKQhW2bRyZk50RzLzKnPA1EPaImMtQkqjE8rcYf3 TPz0AiER8xjOoLi5azGH70DQ0HjoujlfzwJ2XJD/7M5wr/Z3NdyGoJHrMtuKx6/V8FFhR1 ITeElqa2TQpNy/NlIaQ5SA/lk+YudQQ= X-Rspam-User: X-Stat-Signature: ndenhao1bemqxme7qd8c3pned184ppe1 X-Rspamd-Queue-Id: A568910002F Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=SM1cJ5jm; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=WepxlrKu; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf05.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: rspam07 X-HE-Tag: 1665717233-48285 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Change __set_hugetlb_cgroup() to use folios so it is explicit that the function operates on a head page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb_cgroup.h | 14 +++++++------- mm/hugetlb_cgroup.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index 630cd255d0cf..7576e9ed8afe 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -90,31 +90,31 @@ hugetlb_cgroup_from_page_rsvd(struct page *page) return __hugetlb_cgroup_from_page(page, true); } -static inline void __set_hugetlb_cgroup(struct page *page, +static inline void __set_hugetlb_cgroup(struct folio *folio, struct hugetlb_cgroup *h_cg, bool rsvd) { - VM_BUG_ON_PAGE(!PageHuge(page), page); + VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio); - if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER) + if (folio_order(folio) < HUGETLB_CGROUP_MIN_ORDER) return; if (rsvd) - set_page_private(page + SUBPAGE_INDEX_CGROUP_RSVD, + set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP_RSVD), (unsigned long)h_cg); else - set_page_private(page + SUBPAGE_INDEX_CGROUP, + set_page_private(folio_page(folio, SUBPAGE_INDEX_CGROUP), (unsigned long)h_cg); } static inline void set_hugetlb_cgroup(struct page *page, struct hugetlb_cgroup *h_cg) { - __set_hugetlb_cgroup(page, h_cg, false); + __set_hugetlb_cgroup(page_folio(page), h_cg, false); } static inline void set_hugetlb_cgroup_rsvd(struct page *page, struct hugetlb_cgroup *h_cg) { - __set_hugetlb_cgroup(page, h_cg, true); + __set_hugetlb_cgroup(page_folio(page), h_cg, true); } static inline bool hugetlb_cgroup_disabled(void) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index c86691c431fd..81675f8f44e9 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -317,7 +317,7 @@ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, if (hugetlb_cgroup_disabled() || !h_cg) return; - __set_hugetlb_cgroup(page, h_cg, rsvd); + __set_hugetlb_cgroup(page_folio(page), h_cg, rsvd); if (!rsvd) { unsigned long usage = h_cg->nodeinfo[page_to_nid(page)]->usage[idx]; @@ -359,7 +359,7 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, h_cg = __hugetlb_cgroup_from_page(page, rsvd); if (unlikely(!h_cg)) return; - __set_hugetlb_cgroup(page, NULL, rsvd); + __set_hugetlb_cgroup(page_folio(page), NULL, rsvd); page_counter_uncharge(__hugetlb_cgroup_counter_from_cgroup(h_cg, idx, rsvd), From patchwork Fri Oct 14 03:12:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006631 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 98240C433FE for ; Fri, 14 Oct 2022 03:14:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2883E6B0078; Thu, 13 Oct 2022 23:14:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 211A76B007B; Thu, 13 Oct 2022 23:14:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 015F36B007D; Thu, 13 Oct 2022 23:14:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DEDF86B0078 for ; Thu, 13 Oct 2022 23:14:04 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AA5B9C0408 for ; Fri, 14 Oct 2022 03:14:04 +0000 (UTC) X-FDA: 80018086008.06.A9EBA1F Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf06.hostedemail.com (Postfix) with ESMTP id 46944180024 for ; Fri, 14 Oct 2022 03:14:04 +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 29E34A8t006784; Fri, 14 Oct 2022 03:13:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=JmGIt3Tl013Plbg0tYdWooZLBzr8VHykld6KHkpJ/Gw=; b=dNbR+bLLZ8vuZzujnNq0dIM4F3oIOyvAvun42+FLyby+hO9MpoPa92XhttZkr4YmGuH/ W/mPWqf89Yc4vv9lP6XqpkuO2LPKgLzasdTDJ/u4M66ejI+x6uxf7xxynDMJAkcICOGr umseTJ4sGDEyVpNc26qNnt+VpwYASlruOT0PkaumoQciaC/ooO7YSrSNsE3RbuzvSZ7X 7GQe9Z8tesmcbCeJ1GRQyWCBcdsbLClgVoUuwC+Z43Pjao11XxEyh664N58ZNqb++pbV XYmU/oBmsCW3b76X3v+lPKxwqN7U/qoZFxi3vSt9fJMeGSz0Dsoxlf0FJ44l+TUNf51B Uw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6mr29k0u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:13:53 +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 29E0Se7e040328; Fri, 14 Oct 2022 03:13:53 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k2ynddam5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:13:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NXoZkzHpoPJNxD637ugUFu+U6pg//AU8z7cyW5PsoM6+kr3udb53O30pxKN3Wk+q2STIjCwOlDR9RXCfJYr1CB7p2QSRGfjP1mDGUpZFSWq9VkyRmDNhKyms7mAparDOTSWbuytDX+dj0niWLJ4Iy7Ky1xZQDIt7A/6oT+ziv2CZG/wjzQra1yZHGMCq/JSXSHFltKo80Qvj9kSq6WNGHnRDZCGziTnschuBWH9j7p4tUIdBqs4nwxDfdzlz/zmUTf8gqwobAktY3E08sZAcWzmCkHu+f70HeKrKMSnm8H4I7w3GYOhxIBaWZ4C58rwUsVhUo/2rRyIK6XowhWNlXw== 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=JmGIt3Tl013Plbg0tYdWooZLBzr8VHykld6KHkpJ/Gw=; b=H88dikQHMIayqDCmqsD9rqPhbP4TRdivpCJapImKOjVGUkkcQ94TXoGZWDv1c6/uhDptC5unCfcpi/Fl1bgAmASpUTQdzuG/WXp45PjoTUu/CsL1VmDIbyuhoQ6FVgC3sNjZKIzdf5W5tVTH0c5Tiggq/hn2EnW+Ap7hULrv5hZZtx5JXV1b8kjh8HKWGFxS1g1xLhzPEqyIrmK2s00VBSIBKbli6JBVxwF/BeLpNuoi1RNTkOaHhWJeTT/K/Q2edFlmZstKhmw8qaiE02lSqfLZLV47APsbsW1gbUwE/W+euq32EmGZ7JefiNxlh5oZrXKXW6iHkLZh6xId0q5XAA== 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=JmGIt3Tl013Plbg0tYdWooZLBzr8VHykld6KHkpJ/Gw=; b=qQhuDwsltZeJKmXufwbMyXszyeJ8ps9QVFZta6JMl1GBSQRfVwkskFKUL2I+fnirKIhUn5FKtRmgAxWTjNdCOjUDcENNazNqGsUK3LHm/RkCbJT4YuHLyWW41FzqQ5BmwPggLY5Rluk0D3pjcKlRWzFMegal5U43wzUOfJ6RNHk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:13:51 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:13:49 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 2/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_from_page() to folios Date: Thu, 13 Oct 2022 20:12:56 -0700 Message-Id: <20221014031303.231740-3-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR04CA0012.namprd04.prod.outlook.com (2603:10b6:a03:217::17) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: 30ac85bb-b9c4-41ed-af92-08daad921d61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vdhOnA6KRN2YfQIgJaufFxOvo3l3uPE1cBWSmrQfVdivfQNCeKERPFHRbvPqt7omySufVJURCHY34/ziAaCKR67wOp5eqjaqS0Lti+BLdixm3DtPcKFVKdl1aGYuwhaT6om1eely/6vatUuvkJd5pIdgS9aBc8DGV/FeaP/2JufGdeHRPScS/r1eXgTctH3xntcw3JPkKonTBw9jqjA+SFOlmMkbEqI6POgwvO95C9cje8ubRPzhawHqkdw5G9cx8V5V/qpgJpkchqKtERLS04X8naCMuufqsCSEc5HlNqRToK/+tma4jadGvvGmUC7ehc+8gHEADuPskACohKW4CCQuaxVsALUXY1XSJVgn0CKWWLGNnXvee7nnUlq7AEmmXpM2GTGva5XYW2cWwNzNHCoczLXuKCDfp5q8GgXz5IdREDR+9jH7EcO76hB8W1c7wdvqsfxTcNUxN+oW0giYc+bobP4OOwVCmK6lHHyEgIFb9ntbMAk9lK0ZUKAWJy0gdyDtBxWu48kWl96cBbpp8b1VMqYTHrak0Gw9gtxKo730toEBhzcwnmwBXW6rTcYCVbE2aZMQmQJF2oIC66aYOZR7q80unbNe3LwofdnU8One14cYtFLpFNzqBSO9uK8JqbNYm3hUu+nay3nb/nW9i/4YbZWl1ZI/srPtRsctC7kKaxpS3ONSgfkYgwEGH/BVgDBBKW8+2BfPJ1PuK3ztLQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(6666004)(107886003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: A/FoYYz8IMVnM83IGAwCpnHZa0MrnEGO45Vrbd7OlsrppL3dPhnlfPrLaz/DQsebwqcVUll5PjfMOTTNqyIRwup9ZHSXcHxwJig3alnQyrOI9wSadCfOLnCkDfKcw3kLow1UKw6riyurNb7L2aKvRBTjs8H/6zmeP28r/ql1M/QfntFBtuEHPIyILO6bl/k35R1w66uHSTB9kabSOqrssSyoFZoH1+rLFPhx8ola0tPhsJ09G1mojg6+aZ5Dv9h55+DprkHMdz5eeN1cmMWpYxy0tAX2MzYBnhdQo+aJbmqpevDy/p1YDJMIxJXMDDQDpuvxYpA6G8DVfedPwEz9wgS3FeTQQhodHHcAeI9eN5A9Gd6qVvgPNWRdWbTnqUBNNOoJo+8Hbm4wL+0UOCxz1m+JDFpjaCJOZSW9OlahaPaRTSdNUCoFWvXn4Loe8oeuz9kJHj60MtCIvQZ4Dxdfhd53obKsBopo4tzcZ6Pe/2tx+BIToiVlwfsfQS/i3+99p6tOcHgGshSNizu7x+07Z2akNd4iZ9B+J4tvjbeB1SbFiqrenlilXaEBl609o5VdSl+Pq5apo0vMBrKG+ZijjQt6F1NUccQevlG21LeT9R5sdzpNYDNqQt5e/m+Hsv9O4W26+KJh4OwHvSB5/BWjSK1GMh/Cv+2macpn/rl57Thp/++y1g+S3GLvayyopRUhcp590T4+aiEcg59JXQkWn00Lrf3csKDybENUcrkVT8fX3GNnUxIciwPSnRltMOKXEQO3cq/nFPyQMbQ9UyRlD+DBC6zT/tx+E0egixu7+UYrNysmaQP8wan9rEzueztUSsgSfuAmyjDZMv+Is+udqTY0sSSMwGEuaAbaxXsEFilWlijwi9YUqgC3LoSsNwaao2HD08/OSFO2tDY230m+yR8/lOLJ1T2RazvKrO9xHpo+MwgfOZPazB4ZaP080GgO2mt5PyQKbD8s3c124aPXlOYaNifxluJFQRGpTIjA69S7n9sk7fq3eQOoikJxhoAvEYZdjcvLP2tfLdeJhFLstyNoT4IYpAjrPrzkmFXjFW+iQD8dguibhpbvbxpW4m515mO5xg1xmOlbBCEdFYkzca36+qiLqkOEUNIyWYub0vgJzKRfPwBisC2ttAJceW8+8iMBo1VhXXbYsY2IFtQXE4vTEiZTxUqGs7xCq+xLujLrhdwwvGlVvGYvPJHX5ymikjNE6GNNDexZ7a/aNbjxxd948GkaDhawr3lw4CdI2D3VjCnGgLkHvO9vz2jkQD2+9kclaFAaFGLUjBEAUDYr/1y53A3fYulPVGoFkwPD1zop1yKwPbbAbPr++CxDoQDPZ4+G6eIZrq0y+976xixE6F2FRsGnphAKZbMifiydnAuGaBaPQScoWmPY8GLqJSYM1sCj2M68lwf0AqvPsTr2FCJ9PeTRVqZ9aAV+N9qem4iGoAScUrg5S9a1GPkpzS9NkNYH5otQNFBVMhDDS5cOWq27Sp4ItVVe+U0+hEwISEYO2deOCbgfVNwhFOf9hV+OBO22PU44S/GpzCEKsssNlwPt8jH45hPN5h9tyOWITprt/Ap1V740zMQ17+TPsjs7H7yaJtI1m8l1uuupLvhchg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30ac85bb-b9c4-41ed-af92-08daad921d61 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:13:49.7524 (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: njRMgr3Vzcy5mr2BrQdr2oxnbUFmSJs3njciWcHlgAODZzGJJO77Urm8LzllUMdIrkNmOV3sh3TtiZZcB+dN5IsoVSawpua/+YwOhV5Bqws= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 malwarescore=0 suspectscore=0 mlxscore=0 adultscore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: 51biPprJqisMaHiT_z5g2AkJAxiTTztY X-Proofpoint-GUID: 51biPprJqisMaHiT_z5g2AkJAxiTTztY ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717244; a=rsa-sha256; cv=pass; b=rCI26ZRr1sNDSSZkGpWBLsJigiq+Qb6XKCZPF2KhEc1XgEHy3wjUzz2ZlpNy9gS+GD8yQ8 e3QIAiiBk+zrWbu31N/SEDcPPi5pbMhkLuzfMaIBaR17x1wOpPFonxwz6rwYNQPmYSY1h0 kA2h8ChgS4W0OAjzVWDJM4CjVGcawRc= ARC-Authentication-Results: i=2; imf06.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=dNbR+bLL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qQhuDwsl; spf=pass (imf06.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=1665717244; 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=JmGIt3Tl013Plbg0tYdWooZLBzr8VHykld6KHkpJ/Gw=; b=loIo+J7mUxFatWgszfT12K4I2FU0MIayz5bjUcdD9A0u5KepxgbeJH+yndImT9NyLVimqj qGyBJ8Qz3yZS9GMHSvAmtabXf4Exg/tAiai9793yv7eKFALapSsFcHp1sC/eGcm4dAIHWG nrEYSmE26GRa7J9IQSuUUhs2TquP1LM= X-Rspam-User: X-Stat-Signature: pg1zn1inqy7d391rib7dq8m8bpeq9jfo X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 46944180024 Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=dNbR+bLL; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=qQhuDwsl; spf=pass (imf06.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-HE-Tag: 1665717244-378898 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: Introduce folios in __remove_hugetlb_page() by converting hugetlb_cgroup_from_page() to use folios. Also gets rid of unsed hugetlb_cgroup_from_page_resv() function. Signed-off-by: Sidhartha Kumar --- include/linux/hugetlb_cgroup.h | 39 +++++++++++++++++----------------- mm/hugetlb.c | 5 +++-- mm/hugetlb_cgroup.c | 13 +++++++----- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index 7576e9ed8afe..feb2edafc8b6 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -67,27 +67,34 @@ struct hugetlb_cgroup { }; static inline struct hugetlb_cgroup * -__hugetlb_cgroup_from_page(struct page *page, bool rsvd) +__hugetlb_cgroup_from_folio(struct folio *folio, bool rsvd) { - VM_BUG_ON_PAGE(!PageHuge(page), page); + struct page *tail; - if (compound_order(page) < HUGETLB_CGROUP_MIN_ORDER) + VM_BUG_ON_FOLIO(!folio_test_hugetlb(folio), folio); + if (folio_order(folio) < HUGETLB_CGROUP_MIN_ORDER) return NULL; - if (rsvd) - return (void *)page_private(page + SUBPAGE_INDEX_CGROUP_RSVD); - else - return (void *)page_private(page + SUBPAGE_INDEX_CGROUP); + + if (rsvd) { + tail = folio_page(folio, SUBPAGE_INDEX_CGROUP_RSVD); + return (void *)page_private(tail); + } + + else { + tail = folio_page(folio, SUBPAGE_INDEX_CGROUP); + return (void *)page_private(tail); + } } -static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) +static inline struct hugetlb_cgroup *hugetlb_cgroup_from_folio(struct folio *folio) { - return __hugetlb_cgroup_from_page(page, false); + return __hugetlb_cgroup_from_folio(folio, false); } static inline struct hugetlb_cgroup * -hugetlb_cgroup_from_page_rsvd(struct page *page) +hugetlb_cgroup_from_folio_rsvd(struct folio *folio) { - return __hugetlb_cgroup_from_page(page, true); + return __hugetlb_cgroup_from_folio(folio, true); } static inline void __set_hugetlb_cgroup(struct folio *folio, @@ -181,19 +188,13 @@ static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, { } -static inline struct hugetlb_cgroup *hugetlb_cgroup_from_page(struct page *page) -{ - return NULL; -} - -static inline struct hugetlb_cgroup * -hugetlb_cgroup_from_page_resv(struct page *page) +static inline struct hugetlb_cgroup *hugetlb_cgroup_from_folio(struct folio *folio) { return NULL; } static inline struct hugetlb_cgroup * -hugetlb_cgroup_from_page_rsvd(struct page *page) +hugetlb_cgroup_from_folio_rsvd(struct folio *folio) { return NULL; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4133ffbbeb50..bcb9bfce32ee 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1434,9 +1434,10 @@ static void __remove_hugetlb_page(struct hstate *h, struct page *page, bool demote) { int nid = page_to_nid(page); + struct folio *folio = page_folio(page); - VM_BUG_ON_PAGE(hugetlb_cgroup_from_page(page), page); - VM_BUG_ON_PAGE(hugetlb_cgroup_from_page_rsvd(page), page); + VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio(folio), folio); + VM_BUG_ON_FOLIO(hugetlb_cgroup_from_folio_rsvd(folio), folio); lockdep_assert_held(&hugetlb_lock); if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 81675f8f44e9..600c98560a0f 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -191,8 +191,9 @@ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, struct page_counter *counter; struct hugetlb_cgroup *page_hcg; struct hugetlb_cgroup *parent = parent_hugetlb_cgroup(h_cg); + struct folio *folio = page_folio(page); - page_hcg = hugetlb_cgroup_from_page(page); + page_hcg = hugetlb_cgroup_from_folio(folio); /* * We can have pages in active list without any cgroup * ie, hugepage with less than 3 pages. We can safely @@ -352,14 +353,15 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, struct page *page, bool rsvd) { struct hugetlb_cgroup *h_cg; + struct folio *folio = page_folio(page); if (hugetlb_cgroup_disabled()) return; lockdep_assert_held(&hugetlb_lock); - h_cg = __hugetlb_cgroup_from_page(page, rsvd); + h_cg = __hugetlb_cgroup_from_folio(folio, rsvd); if (unlikely(!h_cg)) return; - __set_hugetlb_cgroup(page_folio(page), NULL, rsvd); + __set_hugetlb_cgroup(folio, NULL, rsvd); page_counter_uncharge(__hugetlb_cgroup_counter_from_cgroup(h_cg, idx, rsvd), @@ -891,13 +893,14 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) struct hugetlb_cgroup *h_cg; struct hugetlb_cgroup *h_cg_rsvd; struct hstate *h = page_hstate(oldhpage); + struct folio *old_folio = page_folio(oldhpage); if (hugetlb_cgroup_disabled()) return; spin_lock_irq(&hugetlb_lock); - h_cg = hugetlb_cgroup_from_page(oldhpage); - h_cg_rsvd = hugetlb_cgroup_from_page_rsvd(oldhpage); + h_cg = hugetlb_cgroup_from_folio(old_folio); + h_cg_rsvd = hugetlb_cgroup_from_folio_rsvd(old_folio); set_hugetlb_cgroup(oldhpage, NULL); set_hugetlb_cgroup_rsvd(oldhpage, NULL); From patchwork Fri Oct 14 03:12:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006632 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 27B6DC4332F for ; Fri, 14 Oct 2022 03:14:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9E6E6B007B; Thu, 13 Oct 2022 23:14:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A27496B007D; Thu, 13 Oct 2022 23:14:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 805206B007E; Thu, 13 Oct 2022 23:14:16 -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 696336B007B for ; Thu, 13 Oct 2022 23:14:16 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4295980799 for ; Fri, 14 Oct 2022 03:14:16 +0000 (UTC) X-FDA: 80018086512.30.396B25C Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id BEBD340027 for ; Fri, 14 Oct 2022 03:14:15 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29E0HvRI025579; Fri, 14 Oct 2022 03:14:03 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=1b2Agnqraxu+oJn88SnZ5zrHf4rJCayWbQEFBe9+MkU=; b=WSlTCLG5ruakkQSnrgZjNgZhoI7yK8xPwuMNWZfoSXO2+B0utuvkxP2onlzN8/QgNEGB gKHm6LQZd44VJGDzKk/mDhnBVVB5EZNHjGZKd4pD4r2gAc3kTpE4RywTdIefOf3cXgCY 9AGlP3NEJnTy5XdXenCyFwaDyVpiuPV2hkKYvRZlbGIaxtBww/iqgxuOrtMgtiGZ+32+ ZdAUT/ufT8zcunu6PpmnTnn4zTWggsD/wMlBy39qSDGrmi1CEXcw9LFFeTQ/4S1tNdvj KOVJSwjGCUvtXHVkfxNwtzdPGmiHKujc1KvcFzaNN9bOch0yT+QY1l7KpwEB5XaE0lr5 uA== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6r4v8tm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:03 +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 29E31XVp033961; Fri, 14 Oct 2022 03:14:02 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2107.outbound.protection.outlook.com [104.47.55.107]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn6j1jp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KHJRPJnTwZQbFMv8PNMvUxM7wanjawELicy31RDc4fVRpkgIScRkVqKgxjJb1jCDED3uJgJQ2hwyRKUuGBAXoL3OWqFwGNq7UoDfYT5f0/5vllWKbLi8JdOKNsbU2NA9AdvsRP3/TFQvrvaVjQZrB2lqk1f6dSuqCW3tbpxFKRPYFFr70ZXB2cNHavonjGgyfYCL/Uni21YVDD5YxgCYZl0JU9E+gvlvKhpu6qyVMAT7tCoBnv6z8hXDS6gWrVW4k/z/rhXYiM/Xit7c9r68yyHdvvp6ygQ3A3p6vrhZc3RGx53Wfozdl6OYajCr9mkyFYHNwq3nPj8k6K8ZJwW7Mw== 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=1b2Agnqraxu+oJn88SnZ5zrHf4rJCayWbQEFBe9+MkU=; b=ByV1ZhdS81/YYw6nHRePJfOccMQfKo96yzKshyeZOuXAqOGyPd85vNIZqFeE5vBWtLWjpc31Pj3fSJ0N4jpvNsSVL6nQU6J80HSeh2BBCBxoKk42dHMc7ta3x2w5nQfnCCWbTQp6JNIsExFsl2u/awsLOoLRcG4ej92bkUY/ALvOZuwYFWF3Ucgkgqa8dUWqO8FjytKBkX1VvSsrzBe9BP8gml7eVYJO1TKJap1FlB66TzejuVo3ge2J23rneBemrW629JvwkDOXASj+flYvJeZ0KDuzuTifMcmAVjikSvNTEcXPtO7PDvTe2Kyj8q2/8XXktQ63dc5dw89/ln95qQ== 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=1b2Agnqraxu+oJn88SnZ5zrHf4rJCayWbQEFBe9+MkU=; b=ZfFI8mUb0b2tp4tMgKExrghM+p6p+rx8uboLoRrydnM58qSVsh6KOpJTbxiK/ptgqMo4uyMjDeX3ev+GLt/vz/6kmlnPiYrc6QeQsikeKwvmr9BifaInbaAvrAoF1yraKVRbtNpH6rYXMgOHejYHMeUnj3oSxb2imeJtqiktJrQ= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:14:00 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:13:59 +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, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 3/9] mm/hugetlb_cgroup: convert set_hugetlb_cgroup*() to folios Date: Thu, 13 Oct 2022 20:12:57 -0700 Message-Id: <20221014031303.231740-4-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR20CA0014.namprd20.prod.outlook.com (2603:10b6:a03:1f4::27) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: b5c46b78-2333-499d-39ed-08daad922340 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tc1JQMK5n/omnoZkDGChU/t2XQsWPrOHyQbbYF3PxiUCW3GnI7VDdvldY/F/FBycLdY49lg6tKUgvzXbNXFQhza6cVkTGRvkj0KffJAcDPALGoBsNPyb9kdPupONwr1tsXY6g+dNyQSgK7aUelJ76w/5Uo/zZy0Oh3adV8fJC6aU+HqM7GLs3vVgfgWWOCEVloX1jU4k6O0ZuWYt7r3W4iwTq2Z2IOx356ASzm6Stf2ef01pSWOzmB15a3i/G9HFWYj9Z5FgsiRGeLtO322EasJXv8+VT5O2EQwppyYo12R3XZsGynaT3dquAoJ7eojagw0eUbGbFBpnMnBHgY57N26Ef2GGBig43cEuBrgshPK73lHB/MPCWcb+GrzkSwGsc5Ivclg8dqZGIn4kobntpmd+KfVFSVi1Df9M5d2a5Lz5++jDduLuYVnyChH768Q2tfD2nfZGCiOMVzKpVu3qsZo6LTdumndBwqX/XIgDSnLfPKKnJG2ixcOzSHJOcxg017ggCzE62Gs8zhsPdXbNKISiDsZARH6SoRIdLTS1GXO8HvauYLfaYPQcPj4eSD5Z6e/P6iG2ms0ZvlJzsPhFm866U451M/02pgrg/eBlnxAqyD8XtBVdwbB7ThmYFX1a2UjuGm16gq+6hvRvR7C9lqKNdTgB/6UJ+3o7sXVjexESdVM2WnLU+4G14CMKl/iP2ILKvovpcy9WS+bUtTGB1w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(107886003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fJx0UHXk3LbwlDu+fvLVbWC+YijCFoV8pMsMZ0KwiXuQESgOexuRTx8Wf4oBQDQMFAbnj89lePwFAz8IkQoA0MzB0LHbdDWCuuu3ARwjaoj/VFvoNAp5Y3Dmr8TSYTFTKryezKhsFcCcuGGptOz5lP3+KdPm7uhhZyB/fp0D+JPhFQBoarxW3BSYWAp+6JGdPiQSG87JxLi/7S1BTN6GfBl7r2Etb8/ykfY5cVJMveyN3bThlf2wtdZM1vIorPTL5U+rUiZBf7T64r9ROw+bkzqyTaa+Q44xTy9Up5D4vA9D06wqtPJ17h8dPusnNM8fV5ReiT0iqhltMtJ0SBdvG2GO0GFwjKIfeXngTLJTiA55KqsAAyrYelp8TLy/gD9guYIJfTPrZOlerxBQPvaxmVlEhRWLrrHW2ynX9WAwOpwcRt3JQclbmQzEepeUOi1kyuwOg/FbR5WStelzqs9eR2E+MMuqWWeBfwGhijncSEiUhS6xieLLRyndM29Vj6hb8VjIU/lb/dchd5B3emxPbgcoa70rOkhB8WzAC7DMzw4jvA6r0tVy3UQdjgwNFcs2kycNoie4W1ZbsNQ+QPyI2hFgHoCr1wmNwuhU6008+d8Dm3GIuQICgL/0lfN2XcEDPCU23JCiIytyYTGwsEDNa+TMAAl6jRmWcJ98KHkqihzu+ZOA5PmjvsU2imOUBRM4H5TazIDD/gSiADK3+FyesCdUyUXgBaOJmkYaM1Ms7yGCQ2bdZgjoyC5bMbNqyrYAGs5WyKdFs8WNrxFg0nv7JJTCfBIKy8VB64ngzTFzMUo/XYp8tOyoVgqThlA4VuxLXVkNE/GeVOCnvuRUBodEwk0KwFaqzXQzLAZ04rukzXw+Wjw12RP8PXeGynE7YskMbllrFfvyXcKv3dj/WaiM2Ebtal2BL5evIjk4eVepYlRo549cHJX7MahTBWiYIRPBu3UMUQhZ8Sqy5z3XmsT70046wgg305m9Kgq+gkeI9Bu+iwcqCOG4IH4ubwyOV6o+qVxzAGV5gPMweSt6JQ6B5NosqxGz2t7d5KxXVjEWpvaZf5ZWAnetMd226YCbRfwSv0DCukOS++G1pdZbzacWKfcoDkbGNgh8ZKdLX505ebgT7mDSuNgsOCiAkykIulfQyp1PkbZAxR0obgyZVG/nN7UTbi4V75xoJSOA89d81E8WdL7CfkcsZUl3NoZllSvrF1YKKYR1XSKjPTtQ/g0Lnx6B7SdMANmdWBTUiH/r1UC8mWQVpY5KDotKdYv2teNdg3gQieuzgQv6szVP6KwAnbzdLi2VLt+VVJxT+CAuVUZS2DTEpARCS5Yw1tV0CjyAknm42mjXzjQ4DnP+lUHJ0RKjoKCfkLJ/bozbmq0/lwKGvLB+u5IvdO0hsyaOK1AWqqCQM60TVWCiJN71c7q3uH7ln1/+vcjwRwRS+dWh8L7SbXtaWOQte0JczVc0tMdhhoBdW8BIMKMt476eDhGrfxQ3SE5IT2iHvq/m3Pwowyq6Z1e1I4p1hFW8Y3zwMMtVdQ1MKxs9aFJvS7A4aYLBoAj2W14h3kX42+z9am9cyL8iPugiH1mv485+k8tLzRufTWEFdL+4DJAB66dtN+k7BQ== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5c46b78-2333-499d-39ed-08daad922340 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:13:59.5526 (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: dTb4ZCoJ4TY6vq/f/oAIc9vWv+GxnKA3+F2MW4/YRlrRcOaWnMjc6K2BjG1gbQ4J25F+Yu8IbUURc47gonQLpXiAQ438249tvaKJ8ZdFbyI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: VgCWlwDxQRs6oks54bePRwP_a7ha_Usw X-Proofpoint-GUID: VgCWlwDxQRs6oks54bePRwP_a7ha_Usw ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717255; 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=1b2Agnqraxu+oJn88SnZ5zrHf4rJCayWbQEFBe9+MkU=; b=Y9JO82684jZo7sskzwOhOHBSZnTatRB583/U2A184h9VSPGwISV0V/9GJxjNhTqMQuHvp3 oQwR31EwF1oz4M/WZjXvn0lnQL8iYy5jd8XmwRi3ynW9rqIkHSoE8owluX94edJUxOMJR9 E9MqlndDgJ/u2JUK8kBFq8Q+lkVppmY= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=WSlTCLG5; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZfFI8mUb; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717255; a=rsa-sha256; cv=pass; b=dX7dqM/csTWxMV8puP6jZ4ixsoWKw9ISYwmD4FgYd4UX6SVcsVeap/Rh6qFQf6iXXwsWc7 YhIBdJrrk+EoKCTrsZMQDijg9WDzFYao9gxXdQi9QrANNQRbXi/9SsV906tzEpShERAAAl jS+BTbF15pcSd2A1YZ/br3f+W0liFfQ= X-Stat-Signature: y1791i87ky11k1j6o9x5ybxrxaaom8t5 X-Rspamd-Queue-Id: BEBD340027 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=WSlTCLG5; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ZfFI8mUb; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1665717255-459754 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 __prep_new_huge_page() to operate on a folio by converting set_hugetlb_cgroup*() to take in a folio. Signed-off-by: Sidhartha Kumar --- include/linux/hugetlb_cgroup.h | 12 ++++++------ mm/hugetlb.c | 33 +++++++++++++++++++-------------- mm/hugetlb_cgroup.c | 11 ++++++----- 3 files changed, 31 insertions(+), 25 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index feb2edafc8b6..a7e3540f7f38 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -112,16 +112,16 @@ static inline void __set_hugetlb_cgroup(struct folio *folio, (unsigned long)h_cg); } -static inline void set_hugetlb_cgroup(struct page *page, +static inline void set_hugetlb_cgroup(struct folio *folio, struct hugetlb_cgroup *h_cg) { - __set_hugetlb_cgroup(page_folio(page), h_cg, false); + __set_hugetlb_cgroup(folio, h_cg, false); } -static inline void set_hugetlb_cgroup_rsvd(struct page *page, +static inline void set_hugetlb_cgroup_rsvd(struct folio *folio, struct hugetlb_cgroup *h_cg) { - __set_hugetlb_cgroup(page_folio(page), h_cg, true); + __set_hugetlb_cgroup(folio, h_cg, true); } static inline bool hugetlb_cgroup_disabled(void) @@ -199,12 +199,12 @@ hugetlb_cgroup_from_folio_rsvd(struct folio *folio) return NULL; } -static inline void set_hugetlb_cgroup(struct page *page, +static inline void set_hugetlb_cgroup(struct folio *folio, struct hugetlb_cgroup *h_cg) { } -static inline void set_hugetlb_cgroup_rsvd(struct page *page, +static inline void set_hugetlb_cgroup_rsvd(struct folio *folio, struct hugetlb_cgroup *h_cg) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bcb9bfce32ee..4d98bf7ba81c 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1758,19 +1758,21 @@ static void __prep_account_new_huge_page(struct hstate *h, int nid) h->nr_huge_pages_node[nid]++; } -static void __prep_new_huge_page(struct hstate *h, struct page *page) +static void __prep_new_hugetlb_folio(struct hstate *h, struct folio *folio) { - hugetlb_vmemmap_optimize(h, page); - INIT_LIST_HEAD(&page->lru); - set_compound_page_dtor(page, HUGETLB_PAGE_DTOR); - hugetlb_set_page_subpool(page, NULL); - set_hugetlb_cgroup(page, NULL); - set_hugetlb_cgroup_rsvd(page, NULL); + hugetlb_vmemmap_optimize(h, &folio->page); + INIT_LIST_HEAD(&folio->lru); + folio->_folio_dtor = HUGETLB_PAGE_DTOR; + hugetlb_set_folio_subpool(folio, NULL); + set_hugetlb_cgroup(folio, NULL); + set_hugetlb_cgroup_rsvd(folio, NULL); } static void prep_new_huge_page(struct hstate *h, struct page *page, int nid) { - __prep_new_huge_page(h, page); + struct folio *folio = page_folio(page); + + __prep_new_hugetlb_folio(h, folio); spin_lock_irq(&hugetlb_lock); __prep_account_new_huge_page(h, nid); spin_unlock_irq(&hugetlb_lock); @@ -2731,8 +2733,10 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, struct list_head *list) { gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; - int nid = page_to_nid(old_page); + struct folio *old_folio = page_folio(old_page); + int nid = folio_nid(old_folio); struct page *new_page; + struct folio *new_folio; int ret = 0; /* @@ -2745,16 +2749,17 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, new_page = alloc_buddy_huge_page(h, gfp_mask, nid, NULL, NULL); if (!new_page) return -ENOMEM; - __prep_new_huge_page(h, new_page); + new_folio = page_folio(new_page); + __prep_new_hugetlb_folio(h, new_folio); retry: spin_lock_irq(&hugetlb_lock); - if (!PageHuge(old_page)) { + if (!folio_test_hugetlb(old_folio)) { /* * Freed from under us. Drop new_page too. */ goto free_new; - } else if (page_count(old_page)) { + } else if (folio_ref_count(old_folio)) { /* * Someone has grabbed the page, try to isolate it here. * Fail with -EBUSY if not possible. @@ -2763,7 +2768,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, ret = isolate_hugetlb(old_page, list); spin_lock_irq(&hugetlb_lock); goto free_new; - } else if (!HPageFreed(old_page)) { + } else if (!folio_test_hugetlb(old_folio)) { /* * Page's refcount is 0 but it has not been enqueued in the * freelist yet. Race window is small, so we can succeed here if @@ -2801,7 +2806,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, free_new: spin_unlock_irq(&hugetlb_lock); /* Page has a zero ref count, but needs a ref to be freed */ - set_page_refcounted(new_page); + folio_ref_unfreeze(new_folio, 1); update_and_free_page(h, new_page, false); return ret; diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 600c98560a0f..692b23b5d423 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -212,7 +212,7 @@ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, /* Take the pages off the local counter */ page_counter_cancel(counter, nr_pages); - set_hugetlb_cgroup(page, parent); + set_hugetlb_cgroup(folio, parent); out: return; } @@ -894,6 +894,7 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) struct hugetlb_cgroup *h_cg_rsvd; struct hstate *h = page_hstate(oldhpage); struct folio *old_folio = page_folio(oldhpage); + struct folio *new_folio = page_folio(newhpage); if (hugetlb_cgroup_disabled()) return; @@ -901,12 +902,12 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) spin_lock_irq(&hugetlb_lock); h_cg = hugetlb_cgroup_from_folio(old_folio); h_cg_rsvd = hugetlb_cgroup_from_folio_rsvd(old_folio); - set_hugetlb_cgroup(oldhpage, NULL); - set_hugetlb_cgroup_rsvd(oldhpage, NULL); + set_hugetlb_cgroup(old_folio, NULL); + set_hugetlb_cgroup_rsvd(old_folio, NULL); /* move the h_cg details to new cgroup */ - set_hugetlb_cgroup(newhpage, h_cg); - set_hugetlb_cgroup_rsvd(newhpage, h_cg_rsvd); + set_hugetlb_cgroup(new_folio, h_cg); + set_hugetlb_cgroup_rsvd(new_folio, h_cg_rsvd); list_move(&newhpage->lru, &h->hugepage_activelist); spin_unlock_irq(&hugetlb_lock); return; From patchwork Fri Oct 14 03:12:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006633 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 3C530C4332F for ; Fri, 14 Oct 2022 03:14:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE9EE6B007D; Thu, 13 Oct 2022 23:14:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C714F6B007E; Thu, 13 Oct 2022 23:14:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9D016B0080; Thu, 13 Oct 2022 23:14:23 -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 91E1D6B007D for ; Thu, 13 Oct 2022 23:14:23 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 610C7AABE3 for ; Fri, 14 Oct 2022 03:14:23 +0000 (UTC) X-FDA: 80018086806.01.394C268 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf12.hostedemail.com (Postfix) with ESMTP id E43DB40028 for ; Fri, 14 Oct 2022 03:14:22 +0000 (UTC) Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29E1kIlx007683; Fri, 14 Oct 2022 03:14:15 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=YwOiu07DhwM1iywJ5BTRvmCQY83wPPOpkpjDxWRM/bk=; b=0D0zkiWafRtlqKX4JxAnAa/PJAPIHFUTacS290z2mvAtYfNIv8o7DGmwqExeqg7IYtD8 kW8wD6izfjvwSDKdZVs7rDbIRszAVbZTIDt4pEs3tX5cDJtbHEdmGFN0Rs4VcpH6tWXF 0tWp2b/OTA9Dh8iNY6yGL+w76MM8WEBTdilfUqe3JI7Od/p5pBJoSjcDVj87cyNp6Y6V rRqsyXsuiU7A9wr7NNrbTlipiUeO4FTeO7bCh0nW4rw707EkiIyXDRQCECG/PM3a1pTW HQMNda5ZUvlV4g8605mm1kvudNbOq/WV/9E38GvrYXnoLNEu99mfZGyrn6AiE9956wwk Ug== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6r4v8tmf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:14 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29E0IiGT003847; Fri, 14 Oct 2022 03:14:13 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2105.outbound.protection.outlook.com [104.47.55.105]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k2ynd5qme-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:13 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I8D0eMVm8BVuz5YqRLdkPghyhzwse6L6VY/4geUrpL28dtOugHWYyvPt/n6Y/VNpr5kyH247VSh08daHF/i7/ufR1L+08GfbUemsHfJ7SrKf4Z3rBJAPBYbMFG+YknGv3zgRXxL7Mfm0V0UrnNnVWVV2uno6Z9uYPJL1TChqilbsdfWtnrx+hqREOUwjvkP3UbuzeFqdv7vR/ny7KUlfb3pkVeTBU+zDElNEuRxQyGsaDRiEx0B7/00WC0Iwck39tvrCzW83paNC+SooEchGuG5PuMfh0GqeFrf9JRENDA6oMjNhEEbFG70WAYA3aC+1aMxiBKl8gM6oK/1cg27QMw== 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=YwOiu07DhwM1iywJ5BTRvmCQY83wPPOpkpjDxWRM/bk=; b=hpyIFzH3B5+y17+U+LjdhgH73IDRlg33IR3N83XjdWqr5AnpBM00GRNBDp1+QMtjFeQ/6K+lSrS8Ib3qomUOxlLhBAT1YX0hznb4CiD4wIPTCLQShmkC1TCUBc2HaYRFO6Ww/pGSlFVpXLT1yU3laR+rbvVeg/d/EvT+P2um+jTFsSmL2CIkG65Zh4DuSJOWvu45KVNcuvMXJfCu4iVBdbu+BP917Z8Uj7rj1czxVy1V1eoopolLyBlaMTPC/GXWh/EQOFWXNILclWCTkJgpBxYEGV/Os+tLqyWHojPKIjAc0gqUbHsTzrjop/lkrusP14/csKRazqd+27I9qK2nfg== 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=YwOiu07DhwM1iywJ5BTRvmCQY83wPPOpkpjDxWRM/bk=; b=VaM1WJiiFZcGSFZKshISexMYKmUFx1CodyALEOFZe0+W395oL9vrxmnwabupkJfpV5HVe3Zkol+wLZ4m5EraZetDKXolcQLA2paoZs38Edvh9FvTwk49LfAQMqEIOCNfOcSDgZsT7XXJeA0kccI8n77r6TQxpB18eWM1/9Qv2Sg= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:14:10 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:14:09 +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, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 4/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_migrate to folios Date: Thu, 13 Oct 2022 20:12:58 -0700 Message-Id: <20221014031303.231740-5-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR13CA0001.namprd13.prod.outlook.com (2603:10b6:a03:2c0::6) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: 748f0995-e5a2-4a1b-e145-08daad922950 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LgHImaNHMGSga3CR11Thk2yV8s7ScpQpUDWh3lWIpQQLPM1Aax8yzS87ehDn52xnW647+02m6lTDE7yXeJybYQAFAso2G1cp3g65BDKoq0J/aOldPc/DCnE4zXCkLAay42kuUt+NVNWuDd2hnA5qI3pA+af3Qt7kpa6lyLeNcAcdff7FVqd/uuefuxf5FIBoD3DCDewux8ry0VW7dA5Vo/7lJMe6vtgUufAjJ4avaURdqXOhtVVMihR5kYtwg+oStjI3MCg90UjJW1uUY3u9FdebwhlnUH6fjo62Wku748W7pgx4hwcFb2axuFXyiickqxfg/QmvEuwxw/YZRCl1ePHpJ0O8cnTuwj+8ksnULZvAekrJ4kIqUj1dehyoFx6dbUWaniiTn1k5ukOVMEa9oCEcCpMNkf4ITRLrquZXty95hczsz8k2w6xAIQp7vXUZpr/fzO9spnipVwz0TrRGj7UnHjLXiGADn/Rzv4uEpquG5gU67w8zPfWccSXRxrd5sI1K6O9sVNDE6lJ1tV7ahNXian8OsGb2mnbNr86LeyG2wWGFUkzLUrsLnDA3p1Mj78aaVd/PnfS7b+0g8xMCJO3sklw3nyiFSRMRIGbfaFQLumhn27p63v2uzpzXOsXElOLDTxeJcH5R8keovnJPs5M3uTUsR2NZVDY4h8iyqxdntdeS7oOndqPJYQaEvjsYf+Ny8nTNJdC7vsVyAI0O0w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(6666004)(107886003)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mcf9Bnd+bsbuN8GK+h/PbtHwdf2S1NVZ2zdynb4JlzrMQvDM0pSCKlIfoatsd/z1IJHi1OTz5LVRdJXBLu3lTseZt5SDA1oioEu9nN7C6vArxxBd7Zn0WLgWHYWFJhggQI1jocmHe/WJVZfv1mFvaI1EyBiwakY3DLPP49kgqrU+5NJtTxBqKmMzJ8mooCUwblZPLhP8yg4wpldeMw24JpoPYFrKRh2wvs3DuXXYj7bd37/U7xKV0Knw+OQyG+YpzFwhvwj0Meoq3d0PShz4NW3pV0Ko9ZhJXu3cptKLwHuWcAJBdZMnqKUW1mzL5Fob7oYt0RIO0eDBaEDohCvD59cy1ooAqA1ipiDIepN8dbYOQAGaBphnKTkw+jkLciZHYRdEEP5GI8ADbAI8zPPDPOnk8ZnvBLm0atTKlZ/nI3oKHC+JqKUTL2vRUzYWir01Oc829YAPIiU1I+nQdB5B71C4jAT1091hOB1Bjn3cAn3bqVPqhCgbdfwgs1hBxWmM3osEA0XpZ16DIieYmzyUwcbub1LCpocyCBVsC3GRQi+RzpuaVGAGScSfYjgBOy4PxJiOMx97f1NCJpkW9vqe/tyl/efzFO/bnfTR+uPOq3PVDTR41kjdIbJ1lSppCnDDKqxt1yxX5Yo/HugS2vkBsg/uB2Ezjz3F5bYdrlWNfjMQ6FwoSKg9FDubeuUGa+7DdcMh5yrAe3e/dDoGo05TzzHK0WUwBRwgKlBwCxt6QODJ7aofurdLsjm9ACatP+VmLwf0ABuUOafJG8af8NJgkoO/PkJavCl+mw0iqN5PYg1EBwfqA/Vswa9I3XJBSlWcYFRBa1F6xeyi78oa9wEfV2oe9/hQE41dSjiC3HpBGPbBpZMrozPiLUSXCNGVGMYRjmLCGmCt/5WdpzTwsO4QgnOXU5p9tLXuTvNofPrJ1P1DIgOc2w8vMFQoaqY/8EwhfO8K8OrNVKPAP/djggaxRi94gNojD4jFmFvp8gkE2Huw+XOhSF1DPdip9mn9ioP29MPUrflJfA3t7QdqvdYeImK16AEpIDcEduOwHV7ojCXzdvnGbIr198klQifNcMgHRE6hT7z1D4q+2XjL0aJRXRmme9TpIBm2iYn9oR4xHz/ZfM7a1o6yhU9cdAOCRhKEunllEvRFGgIiC83OYmSarJj6Ut136GLnqOEEdQtHKIhiHNSiQlwF0fLPzZYnebo1I5wGFMO02GtIn7chFexQvyhmYOCROYxDlOeB/6Cn/BF+87s0LlGAJdvtrTBWyMapfDVQVLvDSn0WhBEmIkMWw0AD1TsYXcWn0pzn4XEZkkt/krqmw7m4U5KvJv4t+unJQfCqyD3sHY9rtdvXFgz+0nMKVErbdaAP0fdHzKS49RnY6S66POo13ydx0UAERWNkR7zZMPrcWrPzXg5UlwuU0J8nQyTAPX39tTUMs4l0cMKrtJXoj1IwiYij38kGPkzTO2DM+4x+mKLEDX/myue9BG/Gl3Hyr5PdxlAi3XsQXkkZ5e02KctlfFfB7UdXGRgWL2uokmVdm+97YJhfSusBe0ZU3pZGlZC3o5rawvvjyGnBKWWChj59xP/anKOe4mcFUGptkSIzk7PGUKLNNXRojw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 748f0995-e5a2-4a1b-e145-08daad922950 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:14:09.7280 (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: 997jn/dhCaFUJQgOxgze+cJp1AZc77da6JtNTEZf8TkR3PwlJDqApnBOc8fHsYLioinZVBB0OLT8RaIRYi3g47IaBYKDG2xw3Z3aYs449Hc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 adultscore=0 mlxscore=0 bulkscore=0 malwarescore=0 phishscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: sotljtfVBdFULi6CehXL45UcHx8xALbD X-Proofpoint-GUID: sotljtfVBdFULi6CehXL45UcHx8xALbD ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717263; a=rsa-sha256; cv=pass; b=xkb0GaPpInnzIjGmT2AHbAg2JoX0t6Plc8IXlqdeRfacG/ELRA+3Low+iGKKQPwkf2jY+E QV9mol3+BsyrFgBpJ/4PHJ9SpUseJPUfMTauYsR0So7t82T4M7UGHBntergXenSLLJ26W4 7xA1sRzM+lpD+udTu0B2WY+L9M9Cgb0= ARC-Authentication-Results: i=2; imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=0D0zkiWa; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VaM1WJii; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717263; 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=YwOiu07DhwM1iywJ5BTRvmCQY83wPPOpkpjDxWRM/bk=; b=8VBFVGGIX6bg/9ug2vMtRd7eZT+IAXt7qefLhOgdi13siYp/Yy8QtbZKAU8nUp2oJtsDBy O5jKqeyFhdRZ29IS/dLeRpzbBeCXZeyyaTE4LWPO3HXnvUQV7o7ypZ1lz6xc+2SsThtkSv eS2Z5cFht9l8gdowOYAA1ikwEWU2QLo= X-Stat-Signature: qpzkmpzwihboyuajzp4sew7mjdt6bc9w X-Rspamd-Queue-Id: E43DB40028 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=0D0zkiWa; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=VaM1WJii; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf12.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1665717262-775558 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: Cleans up intermediate page to folio conversion code in hugetlb_cgroup_migrate() by changing its arguments from pages to folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb_cgroup.h | 8 ++++---- mm/hugetlb.c | 2 +- mm/hugetlb_cgroup.c | 8 +++----- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index a7e3540f7f38..789b6fef176d 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -177,8 +177,8 @@ extern void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, bool region_del); extern void hugetlb_cgroup_file_init(void) __init; -extern void hugetlb_cgroup_migrate(struct page *oldhpage, - struct page *newhpage); +extern void hugetlb_cgroup_migrate(struct folio *old_folio, + struct folio *new_folio); #else static inline void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, @@ -286,8 +286,8 @@ static inline void hugetlb_cgroup_file_init(void) { } -static inline void hugetlb_cgroup_migrate(struct page *oldhpage, - struct page *newhpage) +static inline void hugetlb_cgroup_migrate(struct folio *old_folio, + struct folio *new_folio) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 4d98bf7ba81c..e2dcc9cffb2b 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7289,7 +7289,7 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason) { struct hstate *h = page_hstate(oldpage); - hugetlb_cgroup_migrate(oldpage, newpage); + hugetlb_cgroup_migrate(page_folio(oldpage), page_folio(newpage)); set_page_owner_migrate_reason(newpage, reason); /* diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 692b23b5d423..351ffb40261c 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -888,13 +888,11 @@ void __init hugetlb_cgroup_file_init(void) * hugetlb_lock will make sure a parallel cgroup rmdir won't happen * when we migrate hugepages */ -void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) +void hugetlb_cgroup_migrate(struct folio *old_folio, struct folio *new_folio) { struct hugetlb_cgroup *h_cg; struct hugetlb_cgroup *h_cg_rsvd; - struct hstate *h = page_hstate(oldhpage); - struct folio *old_folio = page_folio(oldhpage); - struct folio *new_folio = page_folio(newhpage); + struct hstate *h = folio_hstate(old_folio); if (hugetlb_cgroup_disabled()) return; @@ -908,7 +906,7 @@ void hugetlb_cgroup_migrate(struct page *oldhpage, struct page *newhpage) /* move the h_cg details to new cgroup */ set_hugetlb_cgroup(new_folio, h_cg); set_hugetlb_cgroup_rsvd(new_folio, h_cg_rsvd); - list_move(&newhpage->lru, &h->hugepage_activelist); + list_move(&new_folio->lru, &h->hugepage_activelist); spin_unlock_irq(&hugetlb_lock); return; } From patchwork Fri Oct 14 03:12:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006634 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 BD657C433FE for ; Fri, 14 Oct 2022 03:14:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3C2966B007E; Thu, 13 Oct 2022 23:14:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3491D6B0080; Thu, 13 Oct 2022 23:14:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 14E2E6B0081; Thu, 13 Oct 2022 23:14:32 -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 F1B176B007E for ; Thu, 13 Oct 2022 23:14:31 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C9847140583 for ; Fri, 14 Oct 2022 03:14:31 +0000 (UTC) X-FDA: 80018087142.25.0FD41AB Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id 4C65E40022 for ; Fri, 14 Oct 2022 03:14:31 +0000 (UTC) Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 29E386Qc000494; Fri, 14 Oct 2022 03:14:24 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=4r0kBUhUUQoyOllhANKTHwaqm7Sl8FIuHUpB7uEibbg=; b=FjeGlljgeM5zXr/CtGEw/yWRMAmtV/TpJKyxmykdQlbSsDqbVWcMs1GA9Z6XlJoWVOQn b+V8WG8MhAik1tvap2DBgQI/tzCuBzO4ZH0fBrsEGm40P4PBtlNpamrS+QrB25TEA0Ip hLpCYhhP1hsNPWOuSHuPQI9S8fXAoY9b/PPVsFGWF6bRgvxfogrNlfGnPpk72b0TuqtZ +Jn28Lx1RgTo3Sme6fxh3RPhgROygoVbt6ZaLrr57n6+H4MwQBF46vDpTDAVFZTD/NrH YtaQKUdyrQgJsks8qu/ehracGiIvov1NBH2jDlD3Nvg4LQCcpGBx1SIAVSqIcckaI1/w QQ== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6qw7gwvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:24 +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 29DNg1XF009730; Fri, 14 Oct 2022 03:14:23 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2104.outbound.protection.outlook.com [104.47.55.104]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k2ynddber-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TTZXAwGeQDmBCTvncmLKfZNXZpvgtpMqzooj+qm3XthGZZ3tDyxNJApmqw5CB130ndHPrPj2/pl5kiqb2HTemoqqICA03GtPk+abvBKCijU6Uz7D9p2fcgtKLoSBGF3W29GajXlewcExm6EENe4NtaLdvUmiXjLq4VJCXkoW67H2aPb09nb74Et9ppTOKGha57Jy7d5vTb5DEkvAu2XmnWocpDjcGmiuOxn3advel5bPOXBC418OIPCk8VnAn0Vn4blTuRvfK/c6k/ahbxtf3HDLQpTi9dVzZqJj87NrkJ8meIGm1jVk8IPpWEVP7/iQCnqlwoFPUMeQE9MnBOc7Dw== 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=4r0kBUhUUQoyOllhANKTHwaqm7Sl8FIuHUpB7uEibbg=; b=e+jGCe4t3X/kH4+aTPmbd+JiCConFQdkHw3fi5uQWMJbIFjigAUETXlhF5/mUVXkZ4aaOvo0zGKDC/roz9WLgmhIYMWacHTtarmY+K3Jev5AgPd+34ajgPGafaN7HvvD+kWnoNSE6HuV2FzWmWW+T/rMgtDw/EHgFbRuQzsS4vzj8KQrzLbgov+nUVqWHW+f1JXfCEr1yoMWaqA4kzDvMXpFhJAlwALB+h98fJRPFXcrV441i7vWqFsvkB796ALctqdMVOG7iJwjcJZbSPwKA52qN3sqF3X6jMtkb2BrfPF0etozfu0XnW8zky4JsVpVecoTl1zOHl2NE9m6roQn3A== 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=4r0kBUhUUQoyOllhANKTHwaqm7Sl8FIuHUpB7uEibbg=; b=G5p0nr92j3ZyxAhOFggW2qGYdokAvufz6gVvxaD3SbwF57bbRp/8yeCP6mWeX6dQgQv0D4qLv7rc4EZaaWUhP9YwOj56RhvCycqw0kBZgyb9ttYurvsoRdDcF1axjQR4fUYbiDBVqPNrtTWQgEAsK/G7J8SqJn4iABcKpkP0VRo= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:14:20 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:14:19 +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, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 5/9] mm/hugetlb: convert isolate_or_dissolve_huge_page to folios Date: Thu, 13 Oct 2022 20:12:59 -0700 Message-Id: <20221014031303.231740-6-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY5PR04CA0025.namprd04.prod.outlook.com (2603:10b6:a03:1d0::35) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ef9c240-2fbc-4d54-4427-08daad922f45 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bM34Bz9noFPvv4Sw4dpfbhVG/t4UfUbHvRqF4I8e13OxsaU/6ou2XJxmBDGwnySqrF+/RZz5+I0ewE+F2yjDcEIJjIG2VGK1a/U8W+raaBirkb+RvNzysdRTnlPkwEGA4cCrbCCtiWbQOuSexGQH0P6m0f11E78LSRU16KMaEYuu/LA2dONI6B+975PW539FcP4r+Vqh3Bpi6KFOCFCwOuMkgtApb51OyckeXtZBr4MYWemT417emxJwixU2fblIC1d393Y2kWHDCjcnUePNnualVJ7mOcwvK8e+YKvozlKdoGVr+N7cNt0ze3KFdSvaQFE4rJwGiEfHTr21qKunWnuc+iwvXSQRjqo8rTxA7KRcRoD6gHjFCjbaegKKawJC4bxHyhHtw/HBLKebjr/iIDdjmN2/tU5Qb0lutCxadX5wLUHPerZfprKZ6BgK+Ms7CzgGhKiRJAWQRbSHvvTYUjLibFKFbydzczvFR/wEF9VeIQTg+j+4BxgPOYvZkaIU4LoYzXWtLqN/i06fugeCO2oVG/U160xKAJQ11oI8Uy0PwXuS3i5jymFJjVOlnZFnPlU0EdDpO5mRo7saWM1c8n+hwbBLJ73WVr5HGLcFxIVWjHHwatL837K3sm4gea0I1yM+p3DpIdovSSDYqnQhN8AB4s4s4stGryIZhrWAD+3AksRbUMUSP5c0Z76ACRipf0RhtXeSfb7doWesjbXUn+osT9JIBdnjqk8UNo9zUJTqswF1xVvvyEk5mB1ljyRb X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(6666004)(107886003)(1076003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: PIyqcFD1kPm2Psf4TUPHab96WU9cijJlKGGGjyKsvWVYzWyrucAoxTwX/wekpRTQtIjH0oxK6vK4l5aewHGrW7czaFsVtaENRB1uu98tdsBuWyYGfiTSadHwW7DsLy0YU6XNJt4ifGWSgavQ0IFjoKjd+hNfJltRyVZif04EKG3lodDyDXoCapzZpKw11rZ2dy+TazThqH8WlWRHUCMjbvq269LkS6YDcnu8gqJ6K+rDVUBjhBVt6/PNLI1Rji6vKnSi5DaWgDXEf1HqHA5XCIvW04Ap79nPCjBbqHg4eTfg2UTbnsb7RZxGt6RMee8GtmXAwoSdl7kuMnZLg1TA7WDPnMhNwVv6/s/lnOF1Jn6+dFa4eyw7Br5d7l9P5lUmmtRyo1W3XGiT1LhQXgMKuGp6wF8vnajg2SY0GigiVmBOuraLqOXM/F+hcc5LU/SVwMTissVR3yVK8S0Jw9xPDOiUX9i13XKAJhKkrbgSEuczCPGbUipM03MfoNrFjyJ2X/PQxNKxSyOC5GMlWIYPjXcwUn4Asy0m3yoUIkQLW4U4k7LeNipmMiofRBzF/c4fS6i3f+92QfbvrrIB7gaFc+L/UzZ/or8ouAorqBvuBScuxvSHzSr+/fWjzknyZPb0ZHSeaWY1iP31mjS8/mzNq8n7UxMLDW/3RQu3qcWY6lal+P8HQCN7gA0PhYyfegZM3CY8jkjAkun/5g4XyUbgaq0p7WLeE7oj5VPQ3yMJSkGLgjKMMck1DctI0KebdaAI+Yb6oMm7dnFK8ZCC7xgp6ccQjh0/6Wduubd3cm++T9Il29bqsZxDDOSVfb1XBQ/DmMreWa7JvWZWr8547XktMsmOJCYs/mei6c/g+CQh8lWz7L6j5h//VEEO3k1Dij//i4Vv1zh6zW+Y1NVSBgPXlhyNrXNJLkz/NlBBg/7WfrDdhpxF0mZAiWFeHxgyRP90rTzwRUMDeUYvMi14J3IxaE99yP2+c/fw26JA/PS2FhjWyWc++8h7kWMF0+qvD4jWA2r6rdK69aF5LN6rPAldfn0JdSjMf3e1FYlRXo32Ys7zcZ2iBGW8YC7OzhxTECNeFUknmNXR2aEOQWoIx/Qj/HErJQBkriPzk7mVTGBhZHlFntNRcZO6+aJDoTa5j+NT0sTW7ehVK31BysKCBuioQ7b6zfE/cWJUKOnZ2udix9aewHzlstiYrGSPNyAlAiyiipNy5PxS0sRWrDYXFyu5VDHbcFEQ+SXFm28RvqmVyLHkkjicx+l7APQkqJX832UOBQk4qMruE5EiFJ/wJol1wrJjdOmQF0zVsVbBBw+h9fL1Jf2X/T9rhZD+JxWTl++xJRCpHZmaTE3ECkxOjH4k24qlceeLn+QazZTfaMskwczK/vyKWnuOy4fuBOAq3lpZiVZsARhrgh8gf/UIhYYNfab/p+8WMDyXeN2qPosqBj3ueXUQ0StXx4FfIGNR4ZzejSKHffo9989NT2WxJhJrvH5n17sZhYdDh3mciTPPxunT1IH1WXZSdZ6wkqGOJoJfnCUqcVXJUtEHRHaqG2yAn9JiEcOX7mtGhq6AbxEWoHZk24uZ5c1a0Gb/nYTdP65C64zGBfCAoKsKZCeglVoufg== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ef9c240-2fbc-4d54-4427-08daad922f45 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:14:19.7339 (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: 5y6t2LN7fvIGvLipJqZJRqPOTNSaasJta+BozytKrxX93J8c7nv3OrN0bLSDwRWN+cLzWQUB3R9vI1OEWow7ufqjA0XUPLY35q8E8Bj066w= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: f7SNV-cu7ldKIF1UQtAN0QgtMpE-0b9U X-Proofpoint-GUID: f7SNV-cu7ldKIF1UQtAN0QgtMpE-0b9U ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=FjeGlljg; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=G5p0nr92; spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717271; a=rsa-sha256; cv=pass; b=mwZp3BchYrRe0TGLqd2i9ejWoSc2lLVhkQHm1qUh41InOtJw5s5VPzl1DeiJ7l/gVrQipn pMXL+FZ1+pVgeJ7eg5eLmGFSsrMdYg6I+1wMqM3c3C6Qo9Gg7gDT3doG7NLZTsMaQBrI+E uqKIbO8hHeTX7Ww/GxLOqvWl1NSzzhk= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717271; 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=4r0kBUhUUQoyOllhANKTHwaqm7Sl8FIuHUpB7uEibbg=; b=gbZj0GvuCxPKJyCstt1KZvXiC1TIpF3UjW+eGCd8C0RxjmlF0LolXbyan/7iNZj95A0US4 JQO1OEj6pKgnSOfv7L+Te3fdQRGydVyxnxjrmPfgFbv6Z/zZC00HyhbviaieYof5zM6Vas jjOoCNmYxwdaUOCYtlp42l8BlTm/6MQ= X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=FjeGlljg; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=G5p0nr92; spf=pass (imf27.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 4C65E40022 X-Stat-Signature: 9u7qqprwzxyb97ct6n1inu5r4u75cjb3 X-HE-Tag: 1665717271-461385 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 a call to compound_head() by using a folio when operating on the head page of a hugetlb compound page. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index e2dcc9cffb2b..44a9a6072c58 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2815,7 +2815,7 @@ static int alloc_and_dissolve_huge_page(struct hstate *h, struct page *old_page, int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) { struct hstate *h; - struct page *head; + struct folio *folio = page_folio(page); int ret = -EBUSY; /* @@ -2824,9 +2824,8 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) * Return success when racing as if we dissolved the page ourselves. */ spin_lock_irq(&hugetlb_lock); - if (PageHuge(page)) { - head = compound_head(page); - h = page_hstate(head); + if (folio_test_hugetlb(folio)) { + h = folio_hstate(folio); } else { spin_unlock_irq(&hugetlb_lock); return 0; @@ -2841,10 +2840,10 @@ int isolate_or_dissolve_huge_page(struct page *page, struct list_head *list) if (hstate_is_gigantic(h)) return -ENOMEM; - if (page_count(head) && !isolate_hugetlb(head, list)) + if (folio_ref_count(folio) && !isolate_hugetlb(&folio->page, list)) ret = 0; - else if (!page_count(head)) - ret = alloc_and_dissolve_huge_page(h, head, list); + else if (!folio_ref_count(folio)) + ret = alloc_and_dissolve_huge_page(h, &folio->page, list); return ret; } From patchwork Fri Oct 14 03:13:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006635 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 99155C4332F for ; Fri, 14 Oct 2022 03:14:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 373106B0075; Thu, 13 Oct 2022 23:14:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2FAEB6B0078; Thu, 13 Oct 2022 23:14:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1004C6B0080; Thu, 13 Oct 2022 23:14:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id EB1726B0075 for ; Thu, 13 Oct 2022 23:14:44 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BA976140697 for ; Fri, 14 Oct 2022 03:14:44 +0000 (UTC) X-FDA: 80018087688.16.B5E3959 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 34B11180010 for ; Fri, 14 Oct 2022 03:14:44 +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 29E33nZo006589; Fri, 14 Oct 2022 03:14: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=9UkqaIPxVIAGRp4AHqMGFSJkoHo7vYoVRFk1XahV5z8=; b=beoHE4A2zZR1WHmaRroXAfVJ84/y+nX3mM19BJaZPuwdbwwwnBdnDnN6eSbq/4tAm6qp qslX3F4Q+S3PyG3j9yl1r5q45zkYHxCL2pc2sqRTrFtdNHSLbjl/eOPl1XQ9V3FcrhlE eR9qcMFX32ogB/4v4NVga9kn083N1WrkKw1OpMgghmLxqFbh8cuc6hPgPVl23rs2SMPB 0ZzgXSdvLF7ffuTYr+qzKKUyldg9oxqY+yTcP7ysXmH9slNyqbj2VQ+t5qjI/++16zhJ sAIJ+1XaTusEQ6zkdMvEumQJQgq1O2rA/Vuv5cXvtfQf0POv8ToiNGedszYs2H9ON2Vc XA== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6mr29k1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14: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 29E1eWcv025311; Fri, 14 Oct 2022 03:14:32 GMT Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2108.outbound.protection.outlook.com [104.47.55.108]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn716v9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:32 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YUXRyubV9hzkGbXEOMsJL/tUns2elKAOdl8GnZJ1JTXeFXxBbL4r4Lv1JPo1r92R6L55uFR5vlgTdwG9NLXFZ3uCHv98qjLXUXTHu0jliH28BZ2blRLmv0hoxv9x3c55sscT+TnIeRRz5+Az4KfRVhVkz+fwmoClVPpJp19QV/ueeBnpnumvLPASZ14NV1b5LXO4l+3W0SFWDPrTVb/M0EC7Vv5ZBaqhVDolqO6w3SSvLBe2OCdSOTdE5q18thHBQGBCk5a0TKiIT2qUOTJnyFIlZAvOLia/e4Nw+JJ9aHUpsszlaCRWjEA/6lGgryrFmx9f/S3z4Y1CuyetPvkNrg== 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=9UkqaIPxVIAGRp4AHqMGFSJkoHo7vYoVRFk1XahV5z8=; b=V8cWKj3vsFr6GaYB/CJc+R8CiVZ++h2xDY2xjcTxJljmJBVlWkED1YXvGKTqxJHp/GuRkv7MBdaBBFjLjvSXT2CLblStUOuEMjUL+z4nASKy4a5yCshcruKeknZouxl2FMWdED8ae/aVJmxQ1x8OHjrBk/+B5BZ1UJiPZbzFFmm8qUsYDRCm+mZk1eaWAQeQFbUbNNlGMeW0o2t6UQxfwM9YsQxrSSYkn/EQhBO4CjyWNmx8yuNyHGEAeJ6OW5j/xbbMZE4YxCoFvlViKjTiJsvJG8R+C/Q8Psy+ctCkGhuqwzQQl98w50mbmMbl4zw6zEjOBCqLJpD7177V55NvWA== 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=9UkqaIPxVIAGRp4AHqMGFSJkoHo7vYoVRFk1XahV5z8=; b=r0nbVOZjxFge0ealZRjq8naKYXXwx4R8HRngtvZ4iXEpf06L14AJoJ564gh0Z2qE2EdZtMIS2U7QzWpvmoEdGsqb2+ZwzYcfjMsw3O0GREdl1qwPQdn6LwssdDDHhD5ItbDW9P//0d3NbSu4NTCITz+nKH0zwilOhf4ZsD2xHqc= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by CH2PR10MB4182.namprd10.prod.outlook.com (2603:10b6:610:7a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.29; Fri, 14 Oct 2022 03:14:30 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:14:29 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 6/9] mm/hugetlb: convert free_huge_page to folios Date: Thu, 13 Oct 2022 20:13:00 -0700 Message-Id: <20221014031303.231740-7-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR05CA0140.namprd05.prod.outlook.com (2603:10b6:a03:33d::25) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|CH2PR10MB4182:EE_ X-MS-Office365-Filtering-Correlation-Id: 5572897b-ca4c-4c65-afb2-08daad92351a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0Lax5pIOuAsvxvnALBUIxTDdvu9n9gubIEOnO7Oh2sbxA4kJgPMNV2NUd7E+pEUh09owDvVF6LB/aq2MDDdYp9eet8yihifK/NE77sUeEzb/MCJZpwA5yGczqkeXqpfCSyUaHm+5ADcnKZ2nHK+kDYAa7mbju/70ZsD3ZfS0L4aPz5YXkzjc9rueEQWyt1xP9Mb1fhqccPPkMtXXqG2OEYo/tjRWNXeK9jXGKVRLTwkun+nf60gPMmm+1xWqSL0uv5I3YVecJiFpO+r6wAkWb9SP+7H+UzGvpQdPRwRLfiXy52SSrTPSry/8QmB2IZ2WsLBdwuAS6Z/c6KstFYYWL9VY46tdJNIYX6MrGrggh/teHGwZCH+amIv1vyzyViX2zKZxeIOjlQq/6YqLDIGLYpAgPs+ph/TEQpEMX7ISGB4uhQVzAykM1zKiMstS+LBUjfP7n9yEEOLRy4EAEdQh0Yoh71Xpz4bVHOGGVL40khtJMS43M8GYrJbr2ns2fgOM2AwyVLfiBJHKMR/2IW9aBfpsjCWzBAwXqcU+H4NZuE1Qkt9mvWdKRlUwKqolB4xXchLn+PyUQWoNyldtM1T6g4d/pcftW7a9x1si0gRmqk5SrwSqtKaew2jU5tBmBYtOjgVSkWWrpsG58TPC5cpMSdK5BuGR3DVJDkrawJ7LRHrtqly8FWr/Azi09g0JW3FIK3bgDfP7JIG67Z4oMTBVKdMiij6LaWnf51Ax+4N90PtCn6TPe5kFtdivatip+p+E X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(366004)(39860400002)(376002)(346002)(396003)(136003)(451199015)(478600001)(6486002)(8936002)(66556008)(66476007)(41300700001)(6512007)(5660300002)(26005)(36756003)(2906002)(4326008)(8676002)(66946007)(83380400001)(44832011)(316002)(38100700002)(6506007)(86362001)(2616005)(186003)(6666004)(107886003)(1076003)(14583001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xzXqxjnh5aLIAYnUh4Eqv8X75jfrXiDeyXi42J2mreHcgLAKCrAbLg5ureRxn6kE5XVPXP6NGnJz4c3DTcN/CHC+KiVP4n5FZW2ddpYHgT6W5X9Oj4DoP/6KXmwCTn3ZVUrLnlB0utINnGcATfo6RPYL7wjx3rH7XDzdJ5QZQZqf0WnI1etsQK/vzMqQLrpN6c5vZotfYIlEEyvo/t+gWPB/PfklLuhc7mtSy4FvlLZWpAAU1sOAbZb1NKj86IISPE8Yd/aBQSnHR59RbrovENcU4KDk6KXdRsIkuIboG1yPegx1yCmGENWxxx2AfEo+wp4e2hOiBQUiG4hhVz3wsJ6K+ZGowQjA1/MaQjDZbHdbiLgqFgSWGYZwNJrKHKEX/CO+8Je3J4xCQ9WtGOd2G9kpP/4LRTnaTLrQntqyjFPD90hXNvkp3xbKm77GQph6QRmPnDFXVtTKl1K+RgPLTJsTYR3QCw1hltGkYC9Ny3ENVxFG/T1C9uKeg3/A5sde2K8chWuRzb3ybdrLKobwjukA/zigf3WEAITXcuMfV9ODoBVnr8C0Avp3hD2KRCXpayvkjgWFviSsezUcgfoSpkud3OwZ3udmLij6swN54OMT2pwDF3YjnmogErrAL43jpo/T2kpI0zCe1V4jniYKH4iawqiMr2gpFQ3gIYGjFzhruu/myeQvmJHExFUQDF+TG327upwxxR8PYtXM2npgl5yMvV8Kb7Nmo4TWXwND7L4kJj7Rj5wkprohbO7Z5ctxOmmTNooTzWIpFPCRD8QU07semBMWHsmppfmTOyJSYxyGfRt2yuOJB8IskWQfyEJphvldwsMckNaDpzBgjKN4iLUCLBg7SHpHrP0UdPL75b1rGvSZnNkMQ06Dch/WoeNRZZthVk68tm/Ha4X4KQ5o+1XKqlTMHyR4L0Q01ixYnZMi+r4PARJA+ThppxZSHApR4J+iUcDgZoY1+d7vuvLPE3znqZJhTKxx2Bu+dh/y3PJzxcWZLIOKl1QIrDW3ZbYwtwThcgj/zZCXrn82nxc9Cav9KiW9pcR/qleYx+QqJh6NvS2e1ZiSNCpauPEkHCBle6bLVWxBUskDMDXBtDdcjAeyRF1tpa+1fBIvsL49xo6OwLfXMWnydNvb7BNkDHHA2Vwg2/gQjLxVkigXzXWktDXAFgh1WFXLojM2WhYtsMGUUUbr33k78CrqpAbpBQccZpYotp6VG/aw8klk4L3oGx21PlR6b5H/165PNUwz8rh35yXWCGpPEzyVYPiqLMhDffzjU4E+9S885o2Wa7TqY2lAIc/ffdw2jBjPs0aXVF5tUMZs4e9LshK8iTwDy17cuBvSaHZP6Rlp4vEzSab+9X4QvMBidL2RsMdoy/2rBJT+szkpEWatMPnCV6Qirm5TLRhYnqoSNooK9tMu7bjYktvVP+Qc/Hsk28aX46k7Gskq3c0kOm/pnTf8HgE91R2dysic5cFxhKaz+zlrjWs3xdSe1ZIDqLaJ6LFyJsDVjHbExzGGR4SKXKXGUPKviwCO0PYLpgjlyVwuxq3BsUbiZw9P+uucsg3UBUhJlSGmkIkrTzU6joay19uXfwKe3otlurYDqQHC1UQn/4bkwHFKSA== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5572897b-ca4c-4c65-afb2-08daad92351a X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:14:29.4903 (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: JGEP8qh9oHCHSwynRrDGAkyrjIkMizaXEJi5Q8TUvhHJKmWVmHb1pJZv9FnoWyKVFHYq3lKMDV0k3iT7Ab3VIy8GUqlwyjCvxYBEBNo8YOs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR10MB4182 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 phishscore=0 mlxscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: GmNl-L8uOwKaYqJ_n1erL4C-6NSAQnAz X-Proofpoint-GUID: GmNl-L8uOwKaYqJ_n1erL4C-6NSAQnAz ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717284; a=rsa-sha256; cv=pass; b=FFpu4stoeUzFOa/SzPMlaDrD60fH1GeJSFDIXJKqMaYYfh2hmxvC9KxzX20yK3uJ2p3Q3Y 11K+uU+tTdh0KVdV1FLeQejmR5vly7kNVuOFqEjR7rWy1nYM5M1/8sMXutQnfC2D0RoMQf 9eGRTwUwh+nB/NnEFnRGuWS565MJrYU= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=beoHE4A2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=r0nbVOZj; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717284; 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=9UkqaIPxVIAGRp4AHqMGFSJkoHo7vYoVRFk1XahV5z8=; b=M4K4VRawDed7tagJpag8vj7R13qzxBnf8Q+0sDE/n2ChRO7jN1ic8okxSXuQm7caZEXsEk JYWVbThEGnf0FcGlnBXV5q114FFjz5KNfj5Q66m1wata1r/l9avYnG/TdZMcWOQt+hGMDb 47ITplfbNhDGF6ZwP+y4OfUUhfSsgkQ= X-Stat-Signature: tnpng399cza4r8fcqezpuh8fmn74gn3t X-Rspamd-Queue-Id: 34B11180010 X-Rspam-User: X-Rspamd-Server: rspam08 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=beoHE4A2; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=r0nbVOZj; spf=pass (imf16.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-HE-Tag: 1665717284-822329 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: Use folios inside free_huge_page(), this is in preparation for converting hugetlb_cgroup_uncharge_page() to take in a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 44a9a6072c58..5228c2b805d2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1688,21 +1688,22 @@ void free_huge_page(struct page *page) * Can't pass hstate in here because it is called from the * compound page destructor. */ - struct hstate *h = page_hstate(page); - int nid = page_to_nid(page); - struct hugepage_subpool *spool = hugetlb_page_subpool(page); + struct folio *folio = page_folio(page); + struct hstate *h = folio_hstate(folio); + int nid = folio_nid(folio); + struct hugepage_subpool *spool = hugetlb_folio_subpool(folio); bool restore_reserve; unsigned long flags; - VM_BUG_ON_PAGE(page_count(page), page); - VM_BUG_ON_PAGE(page_mapcount(page), page); + VM_BUG_ON_FOLIO(folio_ref_count(folio), folio); + VM_BUG_ON_PAGE(folio_mapcount(folio), folio); - hugetlb_set_page_subpool(page, NULL); - if (PageAnon(page)) - __ClearPageAnonExclusive(page); - page->mapping = NULL; - restore_reserve = HPageRestoreReserve(page); - ClearHPageRestoreReserve(page); + hugetlb_set_folio_subpool(folio, NULL); + if (folio_test_anon(folio)) + __ClearPageAnonExclusive(&folio->page); + folio->mapping = NULL; + restore_reserve = folio_test_hugetlb_restore_reserve(folio); + folio_clear_hugetlb_restore_reserve(folio); /* * If HPageRestoreReserve was set on page, page allocation consumed a @@ -1724,7 +1725,7 @@ void free_huge_page(struct page *page) } spin_lock_irqsave(&hugetlb_lock, flags); - ClearHPageMigratable(page); + folio_clear_hugetlb_migratable(folio); hugetlb_cgroup_uncharge_page(hstate_index(h), pages_per_huge_page(h), page); hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h), @@ -1732,7 +1733,7 @@ void free_huge_page(struct page *page) if (restore_reserve) h->resv_huge_pages++; - if (HPageTemporary(page)) { + if (folio_test_hugetlb_temporary(folio)) { remove_hugetlb_page(h, page, false); spin_unlock_irqrestore(&hugetlb_lock, flags); update_and_free_page(h, page, true); From patchwork Fri Oct 14 03:13:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006636 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 A7B66C4332F for ; Fri, 14 Oct 2022 03:14:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40F2C6B0072; Thu, 13 Oct 2022 23:14:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 397B16B0078; Thu, 13 Oct 2022 23:14:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19C436B007D; Thu, 13 Oct 2022 23:14:55 -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 021D96B0072 for ; Thu, 13 Oct 2022 23:14:54 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id C9775120410 for ; Fri, 14 Oct 2022 03:14:54 +0000 (UTC) X-FDA: 80018088108.11.3766CBC Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 5B1DD12002C for ; Fri, 14 Oct 2022 03:14:53 +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 29E2hdXx000655; Fri, 14 Oct 2022 03:14: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=BSmQMWtOsOQUlCDLLHdXQwox8wfT3/Dgx95AOUTYQoQ=; b=RDc48+5ZSbe3A2hf1ZFX/OexCkXL8ZnYs7+bQAUg6SIfU7jnjeMBotfeD3zTAxVzHb0w 5eu2GRARH8tDkUHgC98LjF5qvxcpd0c9rjy9Vf6mB+xPCnKX8+yzMMynXM1YCikDt/g2 crXcxiNFaBAx1v3d72MQj1qhviOm7yRKtjNuR23Nv2cBgx+7zHHa1U3ivNDi4VDdDI8c 9AABaXKX5xPt5EWkIjTtcXNB8fho9kzlWZ6evjU0DkXfofkb+OzrqiDi5NVRP7A6zOiV d9k6CvhKjK0kJXg4+u/J9zQltjxihjdeQfqDeG5QUpduvY7Qbn5lt2/h9nHSp+ESM+ZE Pg== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k30ttf35f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:44 +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 29E0MWPP018229; Fri, 14 Oct 2022 03:14:43 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2049.outbound.protection.outlook.com [104.47.73.49]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn6t0up-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V6ae5n4+0X1SoiKP2CKee7mOnHUV+6h3jDvIukG2hTg+igExKJ1xXK1cr+ava3XmpLCypsIjJoysCAfmhnqIWHI8kIW6/n2wC6eri1KfAU2TiwSZ3labL6D57MBsoHIXJcAnZezmhVvQf0penmXqLcocbOO6BgW7ChCjPfoq7BlLVXNAUfe4yPcY1ZgitpwGiiRkcWeI/qNiL3bpNcwxypELwm5PpbRUF+4s1/Zg5mhnzJpezoh1OHAI9eAFS0rCasMlNTPG3YQypEatWswoUPhe6MYe8hVBJwBudohqjhhEoQrCAua8Sri6wJKDDbvhyVCHIskvbuKbZ3ApcHyIYg== 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=BSmQMWtOsOQUlCDLLHdXQwox8wfT3/Dgx95AOUTYQoQ=; b=YdsMXWU0LDNMyrQRfGa/plKp6RqjFCgzXDgO5hKLW/AFFAqzwk26Hk0Lov6Pj5wpeAunltaJUxcwNBU4wLnVYOAiRV4UhPBMg0sZC2cdzlp8gXfwNUUXW/1qxDxd0RWFKsoqXTkeQKShpDJUBsxV74HU37xvM8YfZ5FxzcG4jLmG21CQAIXG6DRqzl3N3FlY96v0iFnWByo1GM219fbY2kYZgclJXzy/etUCwiJoPiCENsZOgx2keNv4QHEDC4lqLlF2lITZo5oLwrnO8bKwYEl9/Q5zS/+4yWvD6byNP2cpcol0YTX0IUIGY/EZpLGEKK4UbasXOBNCx4H0KavByA== 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=BSmQMWtOsOQUlCDLLHdXQwox8wfT3/Dgx95AOUTYQoQ=; b=kWffB5G9Gp1dXT4vgKnNl+ioUnH2u1kv7zP9jDRSExRaLlkvcCyYQCzpIG63vUatciyc3yfh+hhcy7+ax9nENjiIsPHZjXwtOi4DvSMcjTAv1cCez88kCwlqqXxmXqGv+mRedmAw3N07S+cgxKgYrtAVpZ2jYb9jco/nhgI1Ysk= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS0PR10MB6750.namprd10.prod.outlook.com (2603:10b6:8:133::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Fri, 14 Oct 2022 03:14:41 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:14:40 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 7/9] mm/hugetlb_cgroup: convert hugetlb_cgroup_uncharge_page() to folios Date: Thu, 13 Oct 2022 20:13:01 -0700 Message-Id: <20221014031303.231740-8-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BYAPR06CA0064.namprd06.prod.outlook.com (2603:10b6:a03:14b::41) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS0PR10MB6750:EE_ X-MS-Office365-Filtering-Correlation-Id: c9ac0c45-a099-4ce8-bf4a-08daad923b4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HgmKRxFb2smrcmp5PonCS1vj6qjYqoz2voBcm52Nak++KK8G88q90ph7gu2q/hFjMtd8jhYg1cvAGshQAyY3f3xKEgwzLpk6z6qk0gNSrSc6QA++hcbPbcr011a97Lj82xMbltcT/axO7I7mxeQjDmXaFWF+J9A2PszcIGCDs5vjQ/nOyag3nSb1oTiUBSZ7EwOQOLGelq0h4jpLa8y0ncX9N/Cz7llLlE03lVOvAjlW1Bl+5T4buo8wlbkNEH/HelxXJLRmUBWX7s38IMOQtM6CrXp6L+n4guc+dECGYYa9jZ0IbiaT9t9KrLqjY4UOQl7v9Cd2t1u+dCSFALUOZbgNOcXpIMdM3OoxUyBmPT1vyMqRhytFLg6Y2vbFsYUrScbQGD5vOoLzwhJ8WUluGXRfDoiB7syYGhuktcgOsY0qvzJkqUHYjwLlbBYzgskIcqyHjUdCebRU6uE1pWwbALI0I2B/gOWvuCcGi7HgfuIdfw9rTfXOX9zo2wvNj6B6x5W2GOW22MS3mh7s9oTlieuVF8WFYGSAkFHc1TSAs8dzpYzttRuUvZFtgVCDDu8xb+yySNriuoV35ZuFchKjU6b1OYMiYCW255LFY1E+YxhLBUN2rejn08T/fCztjUNmniJZuHe/CL6Zw6hMLPI0W8srIT8KDViTVlzxXH9BTVLIpipobj4/FPz31JEtwKqMEMvFQDwbNrYGg23Ix5IKvQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(396003)(366004)(376002)(39860400002)(136003)(451199015)(83380400001)(2906002)(86362001)(26005)(6512007)(38100700002)(316002)(478600001)(186003)(41300700001)(8676002)(6486002)(44832011)(4326008)(5660300002)(66476007)(1076003)(2616005)(107886003)(66946007)(66556008)(36756003)(6506007)(6666004)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hy3tMw8em/E6Nvm4wYNkhbJl5IO0IeU9kZtKHDuBOGKDiditeKEAnbKEx9x8ckpImFqqDERsSbVdpBsE3OXya1A1k0OIq7K5Cz9SdHw8BaqYpnQuX4yXCyaiNQJZmYqdhK7QSlvy9cQ6zdmAVbJtDsgVRQPvzNR8f+jPe35mP8+1/vnF9vc8u4BnJfxmpslKFTMQdFMiQ6KCcSlo5s1uH+cYBi30KIo7trAysEHSutTmzYshtGWi9gWQgopVOgpuFkfZv0qJyZJtKKN30Iv+qD8F/7CeOzt9RGxoh4aYAcMFBlvUwZjxOiy2pC673IHWVL4W0FksJVjJ+Cc+AFczL1rSYh+OaggOuxzzEqjIjRdwzTbC0AeF3k22WeC/muXjTvYw0GKRqN82YE5JGG6ae0Tkz+CmmotEdRR9dnRlzYzJElBMST8Z/JCCJa3BYvGoBG/jc7cuL1DTeLrgsCBH57qJHth45UundkcUnWXZU/ru39oUypMTaQhanBv/Ty2ve0WcJ8wmvWrUaZbVp8BnOj8vU9OUFzKWkM+VI17cK/OiRVSvTirHlD/G0jtFRhb9CNR2saKMkhSowiYR6lReh0UMn5i+ubN7PtG2i3AaKl3TLsnySc8HIB4kByMMUNjLR7HULSHOHmm4zMO3o6ckD4SXadJCOd7yLC4RdBMnjMb2aXmLAysdXkFhYkuOqtZgROxT1hD//IEZZKiOFgrUeF5M0NjblJFPrE6UzcTkJZEK871c9GWzSfQf6kvOth4jFp0NHpJ+3wHK6XXFaaKVsmXNpsPwhNT8Q0uZX85h9g8wBwnq0qpEECtpD+JVQ34h+LtX8k25BRKO0RVS3uQc4rZvf/ziEPiVrRuYvFHK+z0j8k/gf9LxEtB94WE+HJ8Kfp6pPqhcJaTD1haX+GW2neR5e6r6fxd7ypZV4hKsSs0NHLdS8BagRcHnou+5jFVA2/knhgMhc7A2RNgzQDa2+sPNeS2ff0+gTBB/ccfbV1Zq/+TIzcYyw2VtP1+HGqQgyB28HAJ4StGm56rzVi8rT/xKgzrD1JzPCi8BQ1OUyEbIgxPsv62dGLqrhAVj1XenhdNIhW9iZgV1AhBAaSClrPqZkwxjYs+sUgFn8IehtkOWG3SEwVA75qV6UA6rs/6JW5HhSSOz6rJXh6Yo4eJDYlFjIj7GdstxPbaN0wG64OxgRtGHMs3Lgz8cZNEQkfdvViM8afwz8McszRzz5CLCPMMxqglaaOdDYT8yDiPcfJfUzh5UK6KNZVM0jA9Yx0l2bKbnNs7miJrtwHKS7t6hrVu6OJbFgmKbTW1NuUvx3wx/9oRQQuurDuEwq9IuQ6xGG4GWAErPBoQn7eB7iuyGMqE3u6gkqIjWYFbUzYpBWlPo1g+I7vl133qONQ17RL4rJ/1yUsKUowyuAX+Q6gJjd/swBYiCa5x/zzYw9ZpsqNrKOJ9w3WgvRozMUFF2/h/meEAn5973vxs1cZsKUBWEoM2QAJfLpCQ7ZmAuX3Ygud4I4KULG2to9r7M+W1JCU2D/j3+aCrFP6gyOwI2KrGkkuLtEswswWuJKr0ptLzKlwegwznf0Hro/eyJkKc2gEvJ0NY5IVHNjjW2p4oDYEkLJw== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c9ac0c45-a099-4ce8-bf4a-08daad923b4e X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:14:39.9130 (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: Az2xqJkpd1nksfJFDKGlZf0bNjjNb1ssUC5uRGup16NySQacrk9wn1meIpGUs7cZfa5pC+OafDBk1/PIGasBuTsbtH6doWGb8T+ZdR88Vgk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6750 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 bulkscore=0 phishscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-GUID: H4ZpfE_l9dEB1_i2hyjL4tZXrNhjrGkI X-Proofpoint-ORIG-GUID: H4ZpfE_l9dEB1_i2hyjL4tZXrNhjrGkI ARC-Authentication-Results: i=2; imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RDc48+5Z; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kWffB5G9; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717293; a=rsa-sha256; cv=pass; b=0Ap6zdkTne4jRXd/tLPK9C8lLsaYeMmQcQXuHDbkE8/ESMe9YdUZGHVfLRMnqmztQq1N5g JPQs21maU0nKrmj5YCABPNyPoAJuDG+YHNFpL+MCGckvXgnCxiqRtlhVk2ZrUnDjRmMO5g ihUYB/MQRYNdTiBfFEdEYeRgz2t42ks= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717293; 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=BSmQMWtOsOQUlCDLLHdXQwox8wfT3/Dgx95AOUTYQoQ=; b=FxaYJUMo6KOHFYdTGrZCb4HwuLfAwArsFJmDTCisd3nQxvElZnCrzubMtqpfWiIm/o4eVR W28MtAhQL8ltt+a+IIaYO8C6w9Dn4xdNaJoqmxTWuyWkJcKAzUkhIDE1f9uvLsfpASVdcG 8iEcbyauhXMxl0SnyJVu7cFHdr2hmfQ= X-Rspam-User: X-Stat-Signature: j9iq363q4iybm4afcx473omiaczep8z7 X-Rspamd-Queue-Id: 5B1DD12002C Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=RDc48+5Z; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=kWffB5G9; arc=pass ("microsoft.com:s=arcselector9901:i=1"); spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam07 X-HE-Tag: 1665717293-589267 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: Continue to use a folio inside free_huge_page() by converting hugetlb_cgroup_uncharge_page*() to folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb_cgroup.h | 16 ++++++++-------- mm/hugetlb.c | 15 +++++++++------ mm/hugetlb_cgroup.c | 21 ++++++++++----------- 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/include/linux/hugetlb_cgroup.h b/include/linux/hugetlb_cgroup.h index 789b6fef176d..c70f92fe493e 100644 --- a/include/linux/hugetlb_cgroup.h +++ b/include/linux/hugetlb_cgroup.h @@ -158,10 +158,10 @@ extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, struct page *page); -extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, - struct page *page); -extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages, - struct page *page); +extern void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, + struct folio *folio); +extern void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages, + struct folio *folio); extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg); @@ -254,14 +254,14 @@ hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, { } -static inline void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, - struct page *page) +static inline void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, + struct folio *folio) { } -static inline void hugetlb_cgroup_uncharge_page_rsvd(int idx, +static inline void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages, - struct page *page) + struct folio *folio) { } static inline void hugetlb_cgroup_uncharge_cgroup(int idx, diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 5228c2b805d2..d44ee677e8ec 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1726,10 +1726,10 @@ void free_huge_page(struct page *page) spin_lock_irqsave(&hugetlb_lock, flags); folio_clear_hugetlb_migratable(folio); - hugetlb_cgroup_uncharge_page(hstate_index(h), - pages_per_huge_page(h), page); - hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h), - pages_per_huge_page(h), page); + hugetlb_cgroup_uncharge_folio(hstate_index(h), + pages_per_huge_page(h), folio); + hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), + pages_per_huge_page(h), folio); if (restore_reserve) h->resv_huge_pages++; @@ -2855,6 +2855,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, struct hugepage_subpool *spool = subpool_vma(vma); struct hstate *h = hstate_vma(vma); struct page *page; + struct folio *folio; long map_chg, map_commit; long gbl_chg; int ret, idx; @@ -2918,6 +2919,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, * a reservation exists for the allocation. */ page = dequeue_huge_page_vma(h, vma, addr, avoid_reserve, gbl_chg); + if (!page) { spin_unlock_irq(&hugetlb_lock); page = alloc_buddy_huge_page_with_mpol(h, vma, addr); @@ -2932,6 +2934,7 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, set_page_refcounted(page); /* Fall through */ } + folio = page_folio(page); hugetlb_cgroup_commit_charge(idx, pages_per_huge_page(h), h_cg, page); /* If allocation is not consuming a reservation, also store the * hugetlb_cgroup pointer on the page. @@ -2961,8 +2964,8 @@ struct page *alloc_huge_page(struct vm_area_struct *vma, rsv_adjust = hugepage_subpool_put_pages(spool, 1); hugetlb_acct_memory(h, -rsv_adjust); if (deferred_reserve) - hugetlb_cgroup_uncharge_page_rsvd(hstate_index(h), - pages_per_huge_page(h), page); + hugetlb_cgroup_uncharge_folio_rsvd(hstate_index(h), + pages_per_huge_page(h), folio); } return page; diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 351ffb40261c..7793401acc12 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -349,11 +349,10 @@ void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, /* * Should be called with hugetlb_lock held */ -static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, - struct page *page, bool rsvd) +static void __hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, + struct folio *folio, bool rsvd) { struct hugetlb_cgroup *h_cg; - struct folio *folio = page_folio(page); if (hugetlb_cgroup_disabled()) return; @@ -371,27 +370,27 @@ static void __hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, css_put(&h_cg->css); else { unsigned long usage = - h_cg->nodeinfo[page_to_nid(page)]->usage[idx]; + h_cg->nodeinfo[folio_nid(folio)]->usage[idx]; /* * This write is not atomic due to fetching usage and writing * to it, but that's fine because we call this with * hugetlb_lock held anyway. */ - WRITE_ONCE(h_cg->nodeinfo[page_to_nid(page)]->usage[idx], + WRITE_ONCE(h_cg->nodeinfo[folio_nid(folio)]->usage[idx], usage - nr_pages); } } -void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, - struct page *page) +void hugetlb_cgroup_uncharge_folio(int idx, unsigned long nr_pages, + struct folio *folio) { - __hugetlb_cgroup_uncharge_page(idx, nr_pages, page, false); + __hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, false); } -void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages, - struct page *page) +void hugetlb_cgroup_uncharge_folio_rsvd(int idx, unsigned long nr_pages, + struct folio *folio) { - __hugetlb_cgroup_uncharge_page(idx, nr_pages, page, true); + __hugetlb_cgroup_uncharge_folio(idx, nr_pages, folio, true); } static void __hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, From patchwork Fri Oct 14 03:13:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sidhartha Kumar X-Patchwork-Id: 13006637 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 4CFCBC4332F for ; Fri, 14 Oct 2022 03:15:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AEDFC6B0078; Thu, 13 Oct 2022 23:15:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A75F36B007B; Thu, 13 Oct 2022 23:15:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82D3E6B007D; Thu, 13 Oct 2022 23:15:03 -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 6F9936B0078 for ; Thu, 13 Oct 2022 23:15:03 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3BEF0120245 for ; Fri, 14 Oct 2022 03:15:03 +0000 (UTC) X-FDA: 80018088486.19.39363A5 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf04.hostedemail.com (Postfix) with ESMTP id C50A34001D for ; Fri, 14 Oct 2022 03:15:02 +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 29E1TqPq026262; Fri, 14 Oct 2022 03:14:55 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=acRyPjuqLPSR4zKveinzMUspL/hbEcXs3/pnXWlB/7k=; b=QYjxsLER206aFIgr0nV9f5qTYEAn71KjFuAR8NwXHIClLM5DokM6h84IxWFoh428lz/N Uz4V+kaV358N2l874XKSivZnx9RtGOHa06X3AWPL3qtI+Sxx8Oc1NjiMOj1C25C8Dzs7 ntCBmWYBs3fmnljRR3FfsSqdJ91ejBIs3Cd0x2waUrvzQpQ/CzPFH7nyQPioPxNQHpr6 ZEl6CwroL41Wov9zRKWifd8CVlrn2eM+I2RvNJiINqQX4qxGFyMFUuxf8kt+CT0Ji6wd 0gL7I4JHqMVqifR0zjiTYIu5yzeWkZXTb/Z5cWyVs2pHwnqFVJin8e0zOmjskdiGbvNn qw== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6kgmsv89-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:55 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 29DNTev3009827; Fri, 14 Oct 2022 03:14:53 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2040.outbound.protection.outlook.com [104.47.73.40]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3k2ynddbsx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:14:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ai3wZxgUXeUmyRm0GRC+Z9C1tZLnRF4BQCcAaMa0vyC1f3YWsHUkS3kcJYntO4y4LlxCcxL0ygClgq24cJKqe5QwVKwDLHWP3tOC4Nnclum6tu3cOrTdjzkJGKes7RsoOAvjFFX09K3hDsG79nSwTJ3J4TfPBQ7jBGUGTWpnlTjcw++QihAY5aRF85a4JviOB++DnzAVALSC8TOJFloHNF2vu19sFdM7zZogM8NYIzbjyaZiEdZiwjzfkdywvK5FYn1qH3bXgct5wHxDgeSFQGDZ+J2gZaKq5ZFuCYAkTI3G6JfJf0fn6CeNdfvSAw53aSdCSKxRy0oaaJHfMOcBwA== 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=acRyPjuqLPSR4zKveinzMUspL/hbEcXs3/pnXWlB/7k=; b=gHWE14+94/b4If9BrrDk9XdCjrHGBL7ROR2fj32/SedXQshnAo29ptd30tNhzwzexKOPrY/pvwhZnhCs0IDb9HcuONRQBOBXGXH+a7PLpG39wjX5oHoGJXAhGQyCjvnpdYvD6sY3FIZVsx2RjjdTC+cEwHK5uyTxVGsUCokbMzYTPiWmztDShx2NzUxjwdXEBitkIvTbJj0CpyVJbNwEmIB7Et2+BxGOyVXPDok3hdcjZ2u0YG+bHmBehP9gWiOYlxxdz6JUDS2N/VM4+lBK2DmrIGIMHOPrp97cm0LRMXKP1HVPbpn6HKkzeJje63RuS3cWS96Q65HtigxZ6v2sRg== 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=acRyPjuqLPSR4zKveinzMUspL/hbEcXs3/pnXWlB/7k=; b=p+pF0e3pOtoaaL1kQBdq+3pZ+Zvnd9+U9mqalLRe/ZlAtp7MCM0+34Ke+bnDilEm0MNQAxXgHLGE9glE+hMxvHZT7DU/qXzNMjfoSzwIS3DUp3+L8jsAMh1RGtaBb/KD9OjCUuEXT1gK2T5qi57LVyzML923KIZ1PwgYN3UhdzI= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS0PR10MB6750.namprd10.prod.outlook.com (2603:10b6:8:133::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Fri, 14 Oct 2022 03:14:51 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:14: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, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 8/9] mm/hugeltb_cgroup: convert hugetlb_cgroup_commit_charge*() to folios Date: Thu, 13 Oct 2022 20:13:02 -0700 Message-Id: <20221014031303.231740-9-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: SJ0PR03CA0097.namprd03.prod.outlook.com (2603:10b6:a03:333::12) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS0PR10MB6750:EE_ X-MS-Office365-Filtering-Correlation-Id: 5e93baa6-74f0-48f2-2e05-08daad924164 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f6D0IsgLhrJughfin1Wu73W9us5lUi3Oq1m9J1iOedOv9qu4sYIiboFa088DBsJTwXu87gS3XDF/uOYeEVdLdYCdf7yDqZsOFZ7vvsc2kVf6CepVoDRqylpTmn7UBzetdOgJ+fHVgIpMqnVGFZ48cc0Pl92TeOCAAbrgI5DxVGecWVXbzM/sB9ga3NISpv1EPU9Qjw9hRnEchPb29vZcU/Gw40HsddJoqms8qDEDsHDxyephzFnjdo2bd9UjKJOV+wfZ9VPag64MI7XfSCNRCUyfjRdkXv1gmthcoKTJs2wlxSgdv1L70IoZQmUa0mtGHh+HJMrhB9s1FMMOvCiCcNVNgarG7KeDIWFQd/CVmTQ8TD/AHP+sM/eoWZak/4K5PKh/E1mr9dzTx5i7tZ5JpOKbUBYhFRfcgIEAErWytDkVQm487hjnjBCBo6ZFoAAn+XPE8Q2rMZWr7HWOr+oJ+buSf4JgTE4nGuiUM1/h5ZHqF2i/ta35TxIiEmq3cClVyrF/fsnil5abEgFmqyIu3te79wEhqf3oE+4FNkSLU0oGE+DCeh2O3WFJYLsuOgMRxcC/S1JA8y2yDgpUqs/z8E/mVVeGEJAwRuaJbyDjhZ7H7dKJNhmEsPS0xxUAAeQ9oW0IlvOiRPE5ZvoJqGPI1F60FIQXWZoMo32rTdLa2nRDFc2S6Jn7gNKpxG8a85mFGDgu2r7HnO6tn8V8IF19/Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(396003)(366004)(376002)(39860400002)(136003)(451199015)(83380400001)(2906002)(86362001)(26005)(6512007)(38100700002)(316002)(478600001)(186003)(41300700001)(8676002)(6486002)(44832011)(4326008)(5660300002)(66476007)(1076003)(2616005)(107886003)(66946007)(66556008)(36756003)(6506007)(6666004)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4gHWK9DhOCbYgkDfP5mt0FYRQ7peUrlA7auNQ+Cv1TnA4UKRgZhpLCr3Qwk2NZxYslBlHQvu9rD7kO7nWOFEFSg58ndZwq3c8kqxVrc7StIOorB/6IAU6y4lpY1gqQf02d6ztdfdyCreLfWQDc7b93k+6G41e4VUKAH6FhJC12ys/DpJAPPzifr/+KbUBwOyIPJNhWdvUTV0gwgmIMUQCxB5dJ8PRedkbiLhtl4Ztx6We/f+dWRm9L3BYJ9wFU68N0x3fSk5aQ8dPY8bJhzGSn0Qzj4KyEUGz89Ywg8GRu1NLYn9yyCMmTmlyi5I+1e3RoopefLkS24jt74Co7HZugbMV5oEtJz1dQb+P38inB9gKhs4HOc6Jpqd7LZjU7oxV5Np7j6wDVlaagbto1WwFaLPlS6m0+4/qEvoayTIF6TBIVb5hrrh6+/2b+pyTlQRMaf7MJlx2W8hcqa7jJz3j/vo/FSHsgQrXENPAIFcN7sRWy3R7pFvRfNAbDhXY34+gf574+oRhSNaoDHI2b8nvd9OFOvc6YX9XyYJ+L4Lyhebby4rgkaxK3M9u/KadK8it++npr1zNQntINhNezGB7051QpVVWE0vIBHlrarDJM5rWSSDW35/uDgGgmY3mBo0YgPqW/rCDTW3KTOcRkBPPaZGn7w4d+/d1HZ4bJrED43yQOsfFLYoLDVEecxBZPsAd8jdzGpV5snuJ5F8BdyzpbaPRziDJrG5FnRoh45scTq9IcUGV73MgbGuGrm9glQq4WnN0ZXPhYwqaAWoEDAr1Jy54mdGnGiNTCJnfa4lAo6+HBwSrbQnTmS9YfV2bVIShF4tHUKIu1nHpYVew8P4r5dQCyAbof1hIcR8cLNxfyUjZCs7OnDeYB+CIy8moCQkRV8fJrDD6rUQcm2FgB4MdrR/zU3E27+125EY58dSGq2Yc2h7LS5/jtPp7cVBmzYB4WoIqFE+q0jX2WBE7XodCwVxLGylm+0VE19uCnj+qspxcYBuY/LGpbug+e41TdNnGoTZCvY+U3C/5s243ToYF6L3LrEYlZ4JE1+q9QPDQSIhY5Y/iF/dRaF6YUpP8oV2GIsDCJpV5U4ewLXXWkCpEy+xraP9I46QBJ9BX5fwBaUjJznGpX4INtgCMEczIyyHYFNaAuI/TEdz3SA5mwMIQfhdnzz7bN/WPK+tWSV81MwZ5Y4ZoZRiklbQzpWLkhTiAq712bYvaz0CAGZOEDwojJK9bEkaSQs7QHGjqVIhnc+QFf7daoNdTMBqMpzoxtOEXjHyyOrlEa154WGNTDC695DyZpv9ksFJomg+43rImco1+gKijKHvk6weiHV+ZPg94uvzpi7eRoX8rSFnEl6abXYhMuP9ycX6zd1JD/FrRmiRRqTEC749e5xuenbQelUUqEwV4fFY9nWvayR2xPth3JuIR2dFbbdHzeg6ST5msmuZ3agHZYK/8Bm9IaqduUgq5pRArwncjZyj8h8vAMLbFpUEQ7pz27t7JAPkYrvtAS3pFgsn8sMmik5xeTQTpww/69EYPVfIKLAWFCaOnjLxaptyOfdeaqW4xKNIU6JxdnsDlEHVefkaoqgNuwtLsDU3DpP2LqFhnR4i3H/JuONx3A== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e93baa6-74f0-48f2-2e05-08daad924164 X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:14:50.1510 (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: o+4T3B6El7tpAgQ6U42mUqSB89p1WXALF9bXAsElcOi9p6UC24Yd9e9nh0eU5mWTuXQQg3WN8Nd61BigE6EAhpru4dGeGjeLna15dXiCI1k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6750 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 malwarescore=0 mlxscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: pPwva1lBgqkQBwVpuC9D3uMQufBsCTjB X-Proofpoint-GUID: pPwva1lBgqkQBwVpuC9D3uMQufBsCTjB ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717303; a=rsa-sha256; cv=pass; b=e9T+tDtFxdnMB01lXnYjLArG2CpAt5MSg7tpT8wC0LdgU0EdBFrcbx6l0Lphdf0BGzKK7K bb3BXN4XrkwB0fCVRN2xIsOicymr1nspAyTz+kejN+jUZ71AOc+yv+Z50qGlIe1/TB7lr3 fms4n9ddpwc/sGuKFyrVCJybwupVSSw= ARC-Authentication-Results: i=2; imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=QYjxsLER; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=p+pF0e3p; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717302; 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=acRyPjuqLPSR4zKveinzMUspL/hbEcXs3/pnXWlB/7k=; b=YMYjqsWkyW8ZIX4GryXLxDNrwIWqKIXk9HIWbzbkAKNKu4RpUE4RbVXAv+zXDhQB78URqb 1J3t1RUbIuuGxU8jgJ5CWCBQHBt+1B81znajPZR45t5HGiNhNb+X07HcooMwmx3VAqvaAX TXquZVP56eDva0eZNVFADnDHeRB7B9Y= X-Stat-Signature: pye7c8s36grx79b6s6ac7mkadwtrdxzi X-Rspamd-Queue-Id: C50A34001D Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=QYjxsLER; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=p+pF0e3p; dmarc=pass (policy=none) header.from=oracle.com; spf=pass (imf04.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com; arc=pass ("microsoft.com:s=arcselector9901:i=1") X-Rspam-User: X-Rspamd-Server: rspam03 X-HE-Tag: 1665717302-782423 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert hugetlb_cgroup_commit_charge*() to internally use folios to clean up the code after __set_hugetlb_cgroup() was changed to take a folio. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- mm/hugetlb_cgroup.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 7793401acc12..69939c233f4f 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -313,21 +313,21 @@ int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, /* Should be called with hugetlb_lock held */ static void __hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, - struct page *page, bool rsvd) + struct folio *folio, bool rsvd) { if (hugetlb_cgroup_disabled() || !h_cg) return; - __set_hugetlb_cgroup(page_folio(page), h_cg, rsvd); + __set_hugetlb_cgroup(folio, h_cg, rsvd); if (!rsvd) { unsigned long usage = - h_cg->nodeinfo[page_to_nid(page)]->usage[idx]; + h_cg->nodeinfo[folio_nid(folio)]->usage[idx]; /* * This write is not atomic due to fetching usage and writing * to it, but that's fine because we call this with * hugetlb_lock held anyway. */ - WRITE_ONCE(h_cg->nodeinfo[page_to_nid(page)]->usage[idx], + WRITE_ONCE(h_cg->nodeinfo[folio_nid(folio)]->usage[idx], usage + nr_pages); } } @@ -336,14 +336,18 @@ void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, struct page *page) { - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, page, false); + struct folio *folio = page_folio(page); + + __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, false); } void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, struct hugetlb_cgroup *h_cg, struct page *page) { - __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, page, true); + struct folio *folio = page_folio(page); + + __hugetlb_cgroup_commit_charge(idx, nr_pages, h_cg, folio, true); } /* From patchwork Fri Oct 14 03:13: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: 13006638 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 E730EC4332F for ; Fri, 14 Oct 2022 03:15:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 853E86B0072; Thu, 13 Oct 2022 23:15:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7DC806B007B; Thu, 13 Oct 2022 23:15:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E1E56B007D; Thu, 13 Oct 2022 23:15:15 -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 46A7B6B0072 for ; Thu, 13 Oct 2022 23:15:15 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 243B0405A5 for ; Fri, 14 Oct 2022 03:15:15 +0000 (UTC) X-FDA: 80018088990.05.0DFA0DD Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf09.hostedemail.com (Postfix) with ESMTP id B24B414002B for ; Fri, 14 Oct 2022 03:15:14 +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 29E33xiP006651; Fri, 14 Oct 2022 03:15:05 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2022-7-12; bh=ISMhie7jByGxhiOgIqWmSQOUNT5Ar7QdCS2YsPKVfQc=; b=A5lMSoUICiVAJLhjTUhEO0TBol4Nhh3DU7O8WMdt3aUEjjU6wa5wG9d/Fd8BBs1H+5Vu bzayVRDURv1YEXN9AEMg7kZZQi434ZINhL761MwMdIqqLfgAvSCnlnc+Mmv1oMPABygt dI6l/nufQCsibZ39oO5W7U42TtB7DuKWX04fl/BzsSj6Y2j5d1LFuaEpjpXSpk4Pupb6 tsF9mgAZzSO+PrwWj8v+4tpS59+HVsEHAdl6XdcVcUu/VYK5x1P6Q2Z0c/589E0nIUjU fnoSGRZU9t4iu9wcxdmuCC0PcWBsMjhmnC42sTpjN3gPbPgXPuDAtoNU5vhMiy56Z5if SQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3k6mr29k2a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:15:04 +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 29E2I8UM020773; Fri, 14 Oct 2022 03:15:03 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2044.outbound.protection.outlook.com [104.47.73.44]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3k2yn6j2af-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 Oct 2022 03:15:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E08VCO7VlCl9Ty6zyh2DDEcdFbsR3npv7PqAUGswypvE3fgxKgtClMUmUJ19uNN30xfWVZ08flVeT0Pwn33NkUJcI5Gdy+XuvM0OZ4Gstgqd6UxWmpfibhbXbOs3VGN+WNk/JX/uZ8D0zHCcAyUAjhbspvzVVOgNl+C95IIxE6yP4g47SiOF6XYS3nGfIDcPgKy78nW0PtFMQJSUPo0apUyixzYfWD/LFZytR3M2Ik9QTdj0P8HzU7x60o1C0t2KvjuiZ+cS+Muw0Q0tmCjNxyzLPKogZY1fFTsDwjddHVBwdwo7UnB/aostfseOQXz3Q0wFM3R/f7lXFINm4N4PLQ== 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=ISMhie7jByGxhiOgIqWmSQOUNT5Ar7QdCS2YsPKVfQc=; b=fhDbdI034ceX+vIHjl1pz1qTMTmKrTl2WMxbMkVGcNydYJBfcNVilWyxLEZtvVXCwB4bsUza6SX4kUCJpzKwRlOjltgswF2cZpW1j6B4C2TL9H+cHmMMz+XdDg4OaSsAYJ9lquUo0Cv3qk8oS/1h7/FsnLTSWoeeDzVVjO5TqIPcKv7FPrsZt1taMLyJNpFPmOKxsHRd2+bcZSORPP2O5YesYtmkRJk8U6xxj54cLCLreFUuMNZmWh19L1YmhifYguT+8t+W8MT3moSSG0rz0D1tQDzhEXoFKFLbmV0xr7t0COSgoBk7p1LESKxTucT6oQQfuug8fw7dBYG8t2Tgvg== 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=ISMhie7jByGxhiOgIqWmSQOUNT5Ar7QdCS2YsPKVfQc=; b=cAwoyvcpIYEpq2bK0qoThgR3DqmP5Zd9qzvFEAFvSwVYw/yhlKCu20WEnKQOwCKUgwHKa1i1Gty7yfgjpj7cZm2B5CXXSQU5HylWtFk+SVonPFJ84Oyvov9UcRQFK0FFosaxv/VsnkPkkUsnjclNMr34G2BKVhQVix+nzN4xJYA= Received: from DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) by DS0PR10MB6750.namprd10.prod.outlook.com (2603:10b6:8:133::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.26; Fri, 14 Oct 2022 03:15:02 +0000 Received: from DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8]) by DS7PR10MB5117.namprd10.prod.outlook.com ([fe80::c026:d7f9:58f6:a5e8%3]) with mapi id 15.20.5723.026; Fri, 14 Oct 2022 03:15:00 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, willy@infradead.org, almasrymina@google.com, linmiaohe@huawei.com, minhquangbui99@gmail.com, aneesh.kumar@linux.ibm.com, Sidhartha Kumar Subject: [PATCH 9/9] mm/hugetlb: convert move_hugetlb_state() to folios Date: Thu, 13 Oct 2022 20:13:03 -0700 Message-Id: <20221014031303.231740-10-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20221014031303.231740-1-sidhartha.kumar@oracle.com> References: <20221014031303.231740-1-sidhartha.kumar@oracle.com> X-ClientProxiedBy: BY3PR05CA0033.namprd05.prod.outlook.com (2603:10b6:a03:39b::8) To DS7PR10MB5117.namprd10.prod.outlook.com (2603:10b6:5:3a6::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR10MB5117:EE_|DS0PR10MB6750:EE_ X-MS-Office365-Filtering-Correlation-Id: c52a8082-5bd3-4783-39a8-08daad9247ac X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lrV+FqnSwXYO50CZ8TSn/FAH9BbkeL3ycKKuD4N2J/Td9fHMLc27XMhlaNbCQlXae+PyaxsXSxkCupFxXRXRGR6dfxb/vJpEzqkTOcZm/fWmjhGZLylhzstoH4U+U1V9FnP7reKI2aZ6Smnj2ogWlD//94RK4kpmobB3SpNOKtMreTx9p87hqfKi3OjW12N5avS5jnT/rTmUF3/H5TWgbFEDzmKi6Ovx9u8ucAgMRNRQQA11OgyufFg5gs5KsE6doT+5EDKLfrDznVCn9DctcCp7HvjAMiV4M//u/FsolqBOtjmZUI0jX3OaotmAuCMTtqY+n9qJ50Oaxkry/ZKeCEdxZF6WIxt4d4VdCtlT7cTR5NKSYiSvUaHR/F8ap79d0XamghNQB54nKqwiBqAHcjGCTGZmoJsTQohh7tCHtTVFs67HnQh2KJnq3hOtOu6VdGzrPzBaNjL4W5YnVL7rvnWTbpz+dKX/Sr/pueryV/RFxa8LXnO2jUTVF0AkBUyPpXj5Y89tRp/hmE4eA/e5exL1prkOPTPQdp9bPcivkRX7XuBWUepcqLNbBMImuw086KH5s6slUyTe1Cdr5ZFns3k2pKUxO+BgQ53xFQ4APxPk4vGQwoJuUyGKZ13CxzILi5tEMjmpMCiAoauMxIljgA3eDMP2/yXYpITbwkUpJrsIIqiWrvMIK3dySB1iv9t3gCujrOkGcJVwYkKgKcP3JQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR10MB5117.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(346002)(396003)(366004)(376002)(39860400002)(136003)(451199015)(83380400001)(2906002)(86362001)(26005)(6512007)(38100700002)(316002)(478600001)(186003)(41300700001)(8676002)(6486002)(44832011)(4326008)(5660300002)(66476007)(1076003)(2616005)(107886003)(66946007)(66556008)(36756003)(6506007)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aqnwsmW4gpkm2D8e4XTRyJZIaqiAd+F0W4WTw92AR4C/S88HwoK9qRTAC/RebOJvtLxyL9GVv7TFe+PKP6gg4aL/A9n1QwR5n2SK8kIpYMSfjrYAFs6q0DboLqlyOpciYiEWLGfoUZyu9gSsSGLFdsdjwjkB2dUr9GZXs9Y6HvvU++mBzx4QxMytpWEVR0KeTimi3F/eA0SSTG/Bbzz91j8oGc1wJgojqMWpJUSZzhzDB/qrJPGB6mjJsHmls127dgRfugNDinVzhRRT5XHI7ZstZJkZD0BVAbX7H5yjYViqOIDTELwOhav31Zi7a7BeOIXjWcTj0O09/2dSuKtPUAVnYucb3/rK0aK6G4aGyTYcLG3zgAxB4OklmMkZCsuhcvbZilf9st+896tMcBUSZVD4zlt2EqJsMFRvCTKtBQcmQiXuLVwhJg/MF+ci4ohNC+ErUF3dWkdOZuqQu7kcpD4g6V6P7Zy6HiBHOfb/UwAJ43XooDWagEgOOWzKlbWWad8MnuSgFTmSG+cdNmh4b0igvNy3DibjZygmpow/VWocxFXuXSYsLP6l5q0/blsmTQkc1Pbmt/YmMjiO2MliYPK4qvvQ3PeO9QcBVcyMLnTH06g0g7h6noH5/tdNhfdn2pLn5L4LAEcU4JaoAKf1OS/Mis4MsrL2VOTUx92SOugV+EC7U6rLrqPPz0p56gKPM+tNqY1ru7SNTmvaJA3pfNUSQ6zTSZgB9LIjCKRlX2nBW0SA0Fk7jq6WKNsfEccRTlC1sHa5WV44zKMuOv9RRnlmNIclV7aKJCOXpAeF4cPsjVKLeFtvEhvkb5aclXg0KWT5L/B2hgPny/g+qJc/4lpzYWbeATwmWiXmsi7Z1UfH2+FK4fXFEI4DQO6f4Sy7gt0qr+87NAg6CNLcDFPQOmkoRuuP0v9e8snOk1sLM9H/PEyBj4JXI0/AaUAQ0MdK0MQz17fPEedqx65oG4vWecgbETbXKgWPdj1/dT3T21P8yae3fel5Otr1acc/BS/QCVDzvHiRLFXZoffTdDxMR2Fcgt0f06j+QDVTp18zyVg3l6a1yWrZMzI7l8JXAeZ3UVwQoUYaQIk4Im+q3G/LzWjegY3aQlVnI06Kp6i8cIKU4AxvT0drFQ3+7EZLEG/203ylhCChKrF7VAGwELivThAsdVXTxKw9f5SgZIrqcGw96ZIEBoo11UNBmdGVxLkSAH8eHnu8uHRHG9nPc/fpBdqMV8rZe4QeYQIjCMEFagBrkLj6JTT9GthamiIjbDF0FRsmzaFPVy/kX443mG8tv63eXJakV9B+7w6yUtNiSfYXIjhVnsaMjmu3zpXFIkw9FXeyhZpKw99XLWKSjOZs/k5tZRA8ekcMnkLqBT4ryNEfCtGi/XviIYOGR4HDZVBDKkrhetlUKEfQZhvjApWyoH984a4zuescRWNxDKyWdwh0nWmZ46hi7R/jBzGkg3dH6VwAQ3qaYWqnqKh/3K6CFLJI3M6zysK/oakQ2oHRytCCGFWCo+XGduAA/oSND//vUpoq7LHmqZ9nebVWyzzrx6p2txtIsFyGSEb/DjlGxMppYKP8wcN23g7NLZvSsT4NCciqEo0pwoqp1Lqg4O193g== X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c52a8082-5bd3-4783-39a8-08daad9247ac X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5117.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2022 03:15:00.6271 (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: IKFWBqwmJ2ZMwneJzAq5aH5q4ehVQGp0SUXWUN41ugaYbau6niLd9wWoiQfdXNwoqY6eQV0nPPgCXDgpFTsy1gSSy3M1FYg8QfTKi+DkbUo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR10MB6750 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-14_01,2022-10-13_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 bulkscore=0 adultscore=0 malwarescore=0 phishscore=0 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2210140017 X-Proofpoint-ORIG-GUID: dHjXz6wSVy1VdDHsqPk669P7pF6F__cB X-Proofpoint-GUID: dHjXz6wSVy1VdDHsqPk669P7pF6F__cB ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=A5lMSoUI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cAwoyvcp; 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"); dmarc=pass (policy=none) header.from=oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1665717314; a=rsa-sha256; cv=pass; b=Z0dshmeRwNtHSfk80lvhC1YB/KEf5xQXbPszGWhD5DcU8GTLAD+oAn/G2ePaqlFpfH54gQ UTCV7pWf7Tr1JE4DINWDCHf+SCF3rKIQl0BTlTKQlrTwLehFcVUPsHc4zKXk326p5rxrqn 6inHjB0NOIX0Um1ZFfHf4zH1bI3tGmw= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1665717314; 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=ISMhie7jByGxhiOgIqWmSQOUNT5Ar7QdCS2YsPKVfQc=; b=y2Gr+zOTqMiBQgwucpfqF0533lDqtdwvIUNQADlUKcbbymk7a9YLIKFUA2VnAuURTM1ICW oEVwvhiCzUHFAUGm4xS1awMdvKCj01b8w/UXno+DIG33X+RJ34m/cjreGEPf8ffdTuiqHl 9imYefET2DYRjk7bM3GZPw9/NoON9xc= X-Rspam-User: Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2022-7-12 header.b=A5lMSoUI; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=cAwoyvcp; 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"); dmarc=pass (policy=none) header.from=oracle.com X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B24B414002B X-Stat-Signature: b4jyzxm5sffq9ba7k3xq6u8o5wi9z46x X-HE-Tag: 1665717314-810224 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: Clean up unmap_and_move_huge_page() by converting move_hugetlb_state() to take in folios. Signed-off-by: Sidhartha Kumar Reviewed-by: Mike Kravetz --- include/linux/hugetlb.h | 6 +++--- mm/hugetlb.c | 22 ++++++++++++---------- mm/migrate.c | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 8cd8854f41d4..bfce1b48fbaa 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -183,7 +183,7 @@ int isolate_hugetlb(struct page *page, struct list_head *list); int get_hwpoison_huge_page(struct page *page, bool *hugetlb); int get_huge_page_for_hwpoison(unsigned long pfn, int flags); void putback_active_hugepage(struct page *page); -void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); +void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason); void free_huge_page(struct page *page); void hugetlb_fix_reserve_counts(struct inode *inode); extern struct mutex *hugetlb_fault_mutex_table; @@ -438,8 +438,8 @@ static inline void putback_active_hugepage(struct page *page) { } -static inline void move_hugetlb_state(struct page *oldpage, - struct page *newpage, int reason) +static inline void move_hugetlb_state(struct folio *old_folio, + struct folio *new_folio, int reason) { } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index d44ee677e8ec..351e7c8a585d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -7288,15 +7288,15 @@ void putback_active_hugepage(struct page *page) put_page(page); } -void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason) +void move_hugetlb_state(struct folio *old_folio, struct folio *new_folio, int reason) { - struct hstate *h = page_hstate(oldpage); + struct hstate *h = folio_hstate(old_folio); - hugetlb_cgroup_migrate(page_folio(oldpage), page_folio(newpage)); - set_page_owner_migrate_reason(newpage, reason); + hugetlb_cgroup_migrate(old_folio, new_folio); + set_page_owner_migrate_reason(&new_folio->page, reason); /* - * transfer temporary state of the new huge page. This is + * transfer temporary state of the new hugetlb folio. This is * reverse to other transitions because the newpage is going to * be final while the old one will be freed so it takes over * the temporary status. @@ -7305,12 +7305,14 @@ void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason) * here as well otherwise the global surplus count will not match * the per-node's. */ - if (HPageTemporary(newpage)) { - int old_nid = page_to_nid(oldpage); - int new_nid = page_to_nid(newpage); + if (folio_test_hugetlb_temporary(new_folio)) { + int old_nid = folio_nid(old_folio); + int new_nid = folio_nid(new_folio); + + + folio_set_hugetlb_temporary(old_folio); + folio_clear_hugetlb_temporary(new_folio); - SetHPageTemporary(oldpage); - ClearHPageTemporary(newpage); /* * There is no need to transfer the per-node surplus state diff --git a/mm/migrate.c b/mm/migrate.c index 55392a706493..ff4256758447 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1328,7 +1328,7 @@ static int unmap_and_move_huge_page(new_page_t get_new_page, put_anon_vma(anon_vma); if (rc == MIGRATEPAGE_SUCCESS) { - move_hugetlb_state(hpage, new_hpage, reason); + move_hugetlb_state(src, dst, reason); put_new_page = NULL; }