From patchwork Tue May 21 13:15:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 13669403 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 7CFF0C25B74 for ; Tue, 21 May 2024 12:51:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 03DBB6B00A0; Tue, 21 May 2024 08:51:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2FEF6B00A1; Tue, 21 May 2024 08:51:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DF7B76B00A2; Tue, 21 May 2024 08:51:07 -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 BE1236B00A0 for ; Tue, 21 May 2024 08:51:07 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 6DF34160848 for ; Tue, 21 May 2024 12:51:07 +0000 (UTC) X-FDA: 82142388174.30.EEC8372 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by imf25.hostedemail.com (Postfix) with ESMTP id 54058A0002 for ; Tue, 21 May 2024 12:51:03 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716295865; 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=eIXO+AO/dlriaIMnN47gp/6AEpJtJpuvFYS/w/+Dn34=; b=sKB9I+PZtoZjHY/pQF24DjVNijFXLH7DTEZBKenTGtfVllFXdtJcMc7QIuzUdWX/6krDsC ghrob32YqzuxMTfix4C+IwHAMsCFzB2eT8Ablxp4BDGAgtSntTPZsCkS7GbpWnvfvsYulu R3unpaQtYNAb1MnpEuf4uUvKOj61kck= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf25.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.255 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716295865; a=rsa-sha256; cv=none; b=Qe/ss/EQTa+QLPLD6UkdQ1/WnkAvmhSrLjq4iy+z/wl8LN76txqrbWcIe/HAzB/mkKaV6Q OUG7PLu0ZC1V64X1zkvO8CGRvUJ0vxRpvUBHFjxh0X7V/c3fQAh7ZKbyICsaoiK5W8px27 H5TeATHfrrP+4hPWWZX3dbPBmK6OcsA= Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4VkDjQ0Tkcz1S6GJ; Tue, 21 May 2024 20:47:22 +0800 (CST) Received: from dggpemm100001.china.huawei.com (unknown [7.185.36.93]) by mail.maildlp.com (Postfix) with ESMTPS id E5D2918007E; Tue, 21 May 2024 20:50:58 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Tue, 21 May 2024 20:50:58 +0800 From: Kefeng Wang To: Andrew Morton CC: Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , , , Kefeng Wang Subject: [PATCH] mm: memcontrol: remove page_memcg() Date: Tue, 21 May 2024 21:15:56 +0800 Message-ID: <20240521131556.142176-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm100001.china.huawei.com (7.185.36.93) X-Rspamd-Queue-Id: 54058A0002 X-Stat-Signature: 6xzh5hytqnihqufmppexd7qj6s6qy65h X-Rspam-User: X-Rspamd-Server: rspam04 X-HE-Tag: 1716295863-669775 X-HE-Meta: U2FsdGVkX18uu/fU9XRIrEGwE8JLzwaTlnEZiYEO1ecPJjTiwlYFcUQUJAXzVP6FcbnxxwInfLaDkjkbNvWwV9XrcA2rfEXOT+bWXwwOLsHnfWOQ9R6YRqT7RRI4O03f3rlZYt5RoMKCNaroqXStf5eXRn6CnJ4myG2YQgKUoqwUlVrS7+SXmOnGcirKvO4F/b0hUClKHerfunmKSf+hFPUjbrstIPUnFmrEEB3lD8D+JaSbz5hRtS72G7Ld1tL5lb+nzlatorCTZ/B5Mh4MLLPiwrn3aQ/flRte4nb4LyKe3AWeOcYneTJ8erHyqA4gUFIkBiR+9tevO2GROqe50ugfSTv//qNAbhCDYXEu9QxG10fP0E2HJjvewR8qR1ia+UxElns6whM6+GXaof3XgaGojEUX4ZopdxVB844B61+9REgGz7T6Ip2Zi7TL5Vapjaaup2jvj9zMi0DGi9HQ3rJ5LaV71soY3h1UnztJkG3Jrij9IlIn8WpTnMSoyaO0kv/UwBdd8fTiCsisvoc0uQAyGoZBIk0SN4lcHbJDV8LBg3uE/q6OUu+T9OJCSAQrjeHyfxuekokcx/K8Friz6B7cZB9KWe5uUHtJvs+o5RWiH0lLFFlOORJLHbA945vJfsiMGjsLJnZwn7Oa9hzeEP+Ie7bZhQ508A8stSLK6YdzxYgpUnN19Tj6TTy8Z4Gh5q9tIBGgDCeWriW2gA7nlOdgsbU4e4KCuXyix5SZCkQIg4Kn+cRmmHPfMwfTlf2hFZfDBZFrX7PD9FGPrT4VDQ1S/SpP7C0UlAP+V++dTa4ylZHXptxiOLmcJ0MdMQFqX0a3wRh5SadcM7Jzv2niOop00sigjNCwpTOxFfbZT0iKFlYWtrzc7uprkWuFjQDQtSxcg6QW9lnbWK5Ulw0BFwJomWYIKUjzQ4WgnhFaalvXF9atvfD4XB1dZvIk4dIbQ+5f+cAvDdzEFtiDH1u qMVbkHne fS7EofzQ376xqPiz8qMb/WRDvFBEd+9beKdqnDTUopbVEo2vWeQgI+xq/iTNCJ2NxyR295dFYYlS04JPOnrPz2Xvf/fSP/X8uKH74sZCGWHZhh80lrIyN2ZFyQbajkcgLM0Yxy7TImcefxGVoSAPqsRPtDCC8regv+xAn3OHcwHKAS7q1OMLPMFIMknj9BYlNQGQz 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: The page_memcg() only called by mod_memcg_page_state(), so squash it to cleanup page_memcg(). Signed-off-by: Kefeng Wang Acked-by: Michal Hocko --- include/linux/memcontrol.h | 14 ++------------ mm/memcontrol.c | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 030d34e9d117..8abc70cc7219 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -443,11 +443,6 @@ static inline struct mem_cgroup *folio_memcg(struct folio *folio) return __folio_memcg(folio); } -static inline struct mem_cgroup *page_memcg(struct page *page) -{ - return folio_memcg(page_folio(page)); -} - /** * folio_memcg_rcu - Locklessly get the memory cgroup associated with a folio. * @folio: Pointer to the folio. @@ -1014,7 +1009,7 @@ static inline void mod_memcg_page_state(struct page *page, return; rcu_read_lock(); - memcg = page_memcg(page); + memcg = folio_memcg(page_folio(page)); if (memcg) mod_memcg_state(memcg, idx, val); rcu_read_unlock(); @@ -1133,11 +1128,6 @@ static inline struct mem_cgroup *folio_memcg(struct folio *folio) return NULL; } -static inline struct mem_cgroup *page_memcg(struct page *page) -{ - return NULL; -} - static inline struct mem_cgroup *folio_memcg_rcu(struct folio *folio) { WARN_ON_ONCE(!rcu_read_lock_held()); @@ -1636,7 +1626,7 @@ static inline void unlock_page_lruvec_irqrestore(struct lruvec *lruvec, spin_unlock_irqrestore(&lruvec->lru_lock, flags); } -/* Test requires a stable page->memcg binding, see page_memcg() */ +/* Test requires a stable page->memcg binding, see folio_memcg() */ static inline bool folio_matches_lruvec(struct folio *folio, struct lruvec *lruvec) { diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 54070687aad2..72833f6f0944 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3811,7 +3811,7 @@ void __memcg_slab_free_hook(struct kmem_cache *s, struct slab *slab, #endif /* CONFIG_MEMCG_KMEM */ /* - * Because page_memcg(head) is not set on tails, set it now. + * Because folio_memcg(head) is not set on tails, set it now. */ void split_page_memcg(struct page *head, int old_order, int new_order) {