From patchwork Mon Aug 19 09:52:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: JonasZhou-oc X-Patchwork-Id: 13768134 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 84038C5320E for ; Mon, 19 Aug 2024 09:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 06C1A6B0083; Mon, 19 Aug 2024 05:54:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F365D6B0085; Mon, 19 Aug 2024 05:54:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD6A16B0088; Mon, 19 Aug 2024 05:54:28 -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 BAA686B0083 for ; Mon, 19 Aug 2024 05:54:28 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 654778103A for ; Mon, 19 Aug 2024 09:54:28 +0000 (UTC) X-FDA: 82468535016.24.8C3BE7F Received: from mx1.zhaoxin.com (MX1.ZHAOXIN.COM [210.0.225.12]) by imf16.hostedemail.com (Postfix) with ESMTP id 9AC8B18000E for ; Mon, 19 Aug 2024 09:54:24 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of JonasZhou-oc@zhaoxin.com designates 210.0.225.12 as permitted sender) smtp.mailfrom=JonasZhou-oc@zhaoxin.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724061208; a=rsa-sha256; cv=none; b=OT4j4IG8uAHjS1YdoZ5s8N34DGYGXL5moG6Ldq5tSDt9rQK17wdZCdrL3B6iUS8ZNLl3Xf 2OezIuPSUoCmk/J5sg7+nwInqetDtBACBV4c3TWhVLQVlsJffzkcRDsox1PveRGsPqd0Sy 9xQIMp57DDeXItVJcFwwESwxJxlKK8k= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf16.hostedemail.com: domain of JonasZhou-oc@zhaoxin.com designates 210.0.225.12 as permitted sender) smtp.mailfrom=JonasZhou-oc@zhaoxin.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724061208; 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: references; bh=c7VF8jDtXmEBleL62eSsyZkeWQyGyGyE0Pccjp09veo=; b=kMSfOI47J2bYon6LeSD/SKynOq45OIz9bZGdCL6Sv2Ba83WS7B2USGQEpRLllf57NoLRc+ U4qfvwRcJfedpeX02WAUObhvrQuCrehwNHkHOjrAElUJGxLIvxXlf5b7O8hwaUJg13kSSJ B/KblIxu3lGeZrJoFr29SzDyuzsTI2A= X-ASG-Debug-ID: 1724061254-086e23761062170001-v9ZeMO Received: from ZXSHMBX2.zhaoxin.com (ZXSHMBX2.zhaoxin.com [10.28.252.164]) by mx1.zhaoxin.com with ESMTP id 1mUfFjGZI3vDJADx (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NO); Mon, 19 Aug 2024 17:54:14 +0800 (CST) X-Barracuda-Envelope-From: JonasZhou-oc@zhaoxin.com X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from ZXSHMBX1.zhaoxin.com (10.28.252.163) by ZXSHMBX2.zhaoxin.com (10.28.252.164) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 19 Aug 2024 17:54:13 +0800 Received: from ZXSHMBX1.zhaoxin.com ([fe80::dcd1:d46d:263:77e]) by ZXSHMBX1.zhaoxin.com ([fe80::dcd1:d46d:263:77e%7]) with mapi id 15.01.2507.039; Mon, 19 Aug 2024 17:54:13 +0800 X-Barracuda-RBL-Trusted-Forwarder: 10.28.252.164 Received: from zjh-VirtualBox.zhaoxin.com (10.28.66.66) by ZXBJMBX02.zhaoxin.com (10.29.252.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 19 Aug 2024 17:52:48 +0800 From: JonasZhou-oc To: , CC: , Subject: [PATCH] mm/hugetlb_cgroup: use folio in hugetlb_cgroup_move_parent() Date: Mon, 19 Aug 2024 17:52:47 +0800 X-ASG-Orig-Subj: [PATCH] mm/hugetlb_cgroup: use folio in hugetlb_cgroup_move_parent() Message-ID: <20240819095247.6403-1-JonasZhou-oc@zhaoxin.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [10.28.66.66] X-ClientProxiedBy: zxbjmbx1.zhaoxin.com (10.29.252.163) To ZXBJMBX02.zhaoxin.com (10.29.252.6) X-Moderation-Data: 8/19/2024 5:54:03 PM X-Barracuda-Connect: ZXSHMBX2.zhaoxin.com[10.28.252.164] X-Barracuda-Start-Time: 1724061254 X-Barracuda-Encrypted: ECDHE-RSA-AES128-GCM-SHA256 X-Barracuda-URL: https://10.28.252.35:4443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at zhaoxin.com X-Barracuda-Scan-Msg-Size: 1810 X-Barracuda-BRTS-Status: 1 X-Barracuda-Bayes: INNOCENT GLOBAL 0.0000 1.0000 -2.0210 X-Barracuda-Spam-Score: -2.02 X-Barracuda-Spam-Status: No, SCORE=-2.02 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=9.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.129250 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Rspamd-Queue-Id: 9AC8B18000E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ny36jntaqk7rqzrw96n56uzzj83jya5e X-HE-Tag: 1724061264-294816 X-HE-Meta: U2FsdGVkX183BBegW0zi+VEOH3xMEW0nm7wDraG4kMRpxXBivMC11Bxg7EJlARjUGW8Euep1TpjX1Amca+mHyV+Jo/MMWFvYvnH6JTWca23rRib2y9Xui5HRJFRcMv3ZzKw/ngRwruXVNvJMi8FC/mJh2srnrXuUz94oPR2PwpikB4SuUx/j2omyHbCTCIxVmfMjjY3y5aQgaWIceQZADljzI5rsN8C3Fr2TYMLGKIXVSE5nmNhtwsi73EA7F6UnsdhUQzqwNADAXg0+0FZunjocHTkz3izPr023hDbOiRyKqx0RRhqq8cjtfWTujEhcgG0XoKaPWZoH2I/MY/9y4COOt5gTGUT31uIbVOq08hLnOLS+u24dWeqqQqWTuHHiO8H+L5Ty8YsE8iUcYgKAj3ecR3GVdqu/+ptWzv6fv4EKxyqhet4T1st4f7isd0dduPqCgj0289JN+gVnEOkerjpaBx8FXK0PmVqjAthMClhcUeWQD3eEENdOA9g8ZWmLbZYxM/pF6yk/L90EPHdiH5zR5v/xVB2MwHDy7TJGrJw9ioNa9UNPQnoJD11rk7QhRnblFapiej8z7XmmCVKlDWY69lvHBVZVFmCsa6AI8UGLlI3e7kV6T+hMf8QSv+VEEUrSvcQiQ5yAn6NUyR5vkX8kwsaBHJMCB3p+/4WdA4l33QBvdoXDDKQvDiN0IhG35jpITsh2qefsPGXaw7TbNkQVi3va2B3cGem8fXkynx7kjpEukqAoU7TW0pAPuwJj//7pQz7KJCGI9yDde70CI6MUHF9YYO5w/frTY/szdf5lB6C22wNQhjudvPZ9FQDiZng9vsF+JWczZufu1beEF5x0wCF/6UtDewHhsrmiFrls3Ccu5U29KBRFPGwvxJ2zWIDurJFHm7rZJtVAyOqK06oQlQcRa0jVpEV0JdR4sYMTN3qj/gHR77C8nhBd9dByXlyRpAVbuyWH0xHgInf 0P0LMCsM ZeFIMIHoFyIBSjC3eAAri0eNwFydxTHDbs3okuVOiXjMI6l+6Gld6t4Nm1a5XGcq5H7Dfswmf9lqRHpbT7QW9JoGX4jyE//u5wzuxngYZDNrmrTMrfhbSmMA9ts01t56Lgch5Z/sMas1hn4hsn/5BXzW8UTagkvmxAnZ1IxRE+a+JKOMubNB2LB4spO7xxvqMZ8jCP6uXRWFzCJXJnTcheRrnDrcM7Ly+7S/Sj+jhPT5IaycS9/S/iFCfNIS2pYHqkfV8c9YfCFjYOuo= 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: List-Subscribe: List-Unsubscribe: Since we are dealing with HugeTLB, we should use folio instead of page. Signed-off-by: JonasZhou-oc --- mm/hugetlb_cgroup.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/hugetlb_cgroup.c b/mm/hugetlb_cgroup.c index 4ff238ba1250..1433a3e57c17 100644 --- a/mm/hugetlb_cgroup.c +++ b/mm/hugetlb_cgroup.c @@ -195,13 +195,12 @@ static void hugetlb_cgroup_css_free(struct cgroup_subsys_state *css) * cannot fail. */ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, - struct page *page) + struct folio *folio) { unsigned int nr_pages; 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_folio(folio); /* @@ -212,7 +211,7 @@ static void hugetlb_cgroup_move_parent(int idx, struct hugetlb_cgroup *h_cg, if (!page_hcg || page_hcg != h_cg) goto out; - nr_pages = compound_nr(page); + nr_pages = folio_nr_pages(folio); if (!parent) { parent = root_h_cgroup; /* root has no limit */ @@ -235,13 +234,13 @@ static void hugetlb_cgroup_css_offline(struct cgroup_subsys_state *css) { struct hugetlb_cgroup *h_cg = hugetlb_cgroup_from_css(css); struct hstate *h; - struct page *page; + struct folio *folio; do { for_each_hstate(h) { spin_lock_irq(&hugetlb_lock); - list_for_each_entry(page, &h->hugepage_activelist, lru) - hugetlb_cgroup_move_parent(hstate_index(h), h_cg, page); + list_for_each_entry(folio, &h->hugepage_activelist, lru) + hugetlb_cgroup_move_parent(hstate_index(h), h_cg, folio); spin_unlock_irq(&hugetlb_lock); }