From patchwork Mon Dec 20 08:56:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12687447 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 B8DA7C433FE for ; Mon, 20 Dec 2021 09:00:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 543F46B0083; Mon, 20 Dec 2021 04:00:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F3F36B0087; Mon, 20 Dec 2021 04:00:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E3FB6B0088; Mon, 20 Dec 2021 04:00:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0181.hostedemail.com [216.40.44.181]) by kanga.kvack.org (Postfix) with ESMTP id 2FCE46B0083 for ; Mon, 20 Dec 2021 04:00:10 -0500 (EST) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E331E180D3301 for ; Mon, 20 Dec 2021 09:00:09 +0000 (UTC) X-FDA: 78937575738.18.9496872 Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by imf11.hostedemail.com (Postfix) with ESMTP id 40B2540046 for ; Mon, 20 Dec 2021 09:00:06 +0000 (UTC) Received: by mail-pj1-f51.google.com with SMTP id x1-20020a17090a2b0100b001b103e48cfaso8376689pjc.0 for ; Mon, 20 Dec 2021 01:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nj5bpOelDWsvGfc4yM7RxdUM4ftOW0E3SXCCNb4y4Rg=; b=JDwBKkfz4DoUozolc1Ofuk3teBl+k3dS71xnwUbbk0If8x1FUhz5+MnsTTD6bu0ZEx mX4Um4loCI/1N4PizQ3MIfgHchCZ4SghVgL/r7EH0Gd9jL5NvSscjz+jQ71oWG4knCmI BxGbK1s5wltRaxMCjsuTQUDJDfdpoiYvjpC0DxZXuvuX+9WQ4F7REbrs/F34+q6oh4lb gfAire8rwlUmwFphmB7BnmcPsH7j8kC4peMgmzcUqOPLsZt6pUL/SMFxy4ZWxqd1qeQD WugFuKdNUEfTZmbq5BpHcgcYXf4kH4U3tdy9N8sD7jCBaNOtHLc9rZHahNhgTADiAY6z pKVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nj5bpOelDWsvGfc4yM7RxdUM4ftOW0E3SXCCNb4y4Rg=; b=Nuy6Ce1ZHh2B4+Ie/mC+FxklgF2MOnrn/hV1yjIQhaSkfykupjRqPEbdI9Rwkey8pJ kXX9dBm+l67sW/qO56uUaXshL7W+Pc8oZRFZ1dbcQvZ604/TBgaOhl0UUZK+mYUZ8g1a OOgXhGzTjwB8c5389Pyw9wOtoZLh4h3g/SCEIcynk3dmP9Ogyf8Arx5nLxHS3kVUH2Ml fJkDgqWJngcv0PcA+WrqrDicplTWnCndUEKuCvzQWfR2cWN3EzR9p94r0WU7L89FfQ0D 4I/BYv0zgbCKJD3sQFhIv3G6mY59o67tPW/tocjACbsxONh2ZKQ38zTkTEr1YtDYjv2s 8tjg== X-Gm-Message-State: AOAM531KBuhqZhXlNi4R/un1Ds5V71dg9dYDJTzwxvkOgWkV5s7nkml1 7HkMM/W3OBfchWJijYQIVSklAw== X-Google-Smtp-Source: ABdhPJyyhJdQS5rF6GJ72AexnZCsiIgIk33FtW1YNTXCIkJoHk3+KGt6KtK30DfUdxLyN/PdvWmPkw== X-Received: by 2002:a17:90a:9907:: with SMTP id b7mr27398035pjp.137.1639990807737; Mon, 20 Dec 2021 01:00:07 -0800 (PST) Received: from localhost.localdomain ([61.120.150.70]) by smtp.gmail.com with ESMTPSA id m11sm18441647pfk.27.2021.12.20.00.59.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Dec 2021 01:00:07 -0800 (PST) From: Muchun Song To: willy@infradead.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, vdavydov.dev@gmail.com, shakeelb@google.com, guro@fb.com, shy828301@gmail.com, alexs@kernel.org, richard.weiyang@gmail.com, david@fromorbit.com, trond.myklebust@hammerspace.com, anna.schumaker@netapp.com, jaegeuk@kernel.org, chao@kernel.org, kari.argillander@gmail.com Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-nfs@vger.kernel.org, zhengqi.arch@bytedance.com, duanxiongchun@bytedance.com, fam.zheng@bytedance.com, smuchun@gmail.com, Muchun Song Subject: [PATCH v5 16/16] mm: memcontrol: rename memcg_cache_id to memcg_kmem_id Date: Mon, 20 Dec 2021 16:56:49 +0800 Message-Id: <20211220085649.8196-17-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20211220085649.8196-1-songmuchun@bytedance.com> References: <20211220085649.8196-1-songmuchun@bytedance.com> MIME-Version: 1.0 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=JDwBKkfz; spf=pass (imf11.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.51 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspamd-Queue-Id: 40B2540046 X-Stat-Signature: p7rcrsmayb6eybq4jh6esj9sq453izm1 X-Rspamd-Server: rspam04 X-HE-Tag: 1639990806-615687 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: The memcg_cache_id() introduced by commit 2633d7a02823 ("slab/slub: consider a memcg parameter in kmem_create_cache") is used to index in the kmem_cache->memcg_params->memcg_caches array. Since kmem_cache->memcg_params.memcg_caches has been removed by commit 9855609bde03 ("mm: memcg/slab: use a single set of kmem_caches for all accounted allocations"). So the name does not need to reflect cache related. Just rename it to memcg_kmem_id. And it can reflect kmem related. Signed-off-by: Muchun Song --- include/linux/memcontrol.h | 4 ++-- mm/list_lru.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 7b472f805d77..94ed3a124191 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1735,7 +1735,7 @@ static inline void memcg_kmem_uncharge_page(struct page *page, int order) * A helper for accessing memcg's kmem_id, used for getting * corresponding LRU lists. */ -static inline int memcg_cache_id(struct mem_cgroup *memcg) +static inline int memcg_kmem_id(struct mem_cgroup *memcg) { return memcg ? memcg->kmemcg_id : -1; } @@ -1773,7 +1773,7 @@ static inline bool memcg_kmem_enabled(void) return false; } -static inline int memcg_cache_id(struct mem_cgroup *memcg) +static inline int memcg_kmem_id(struct mem_cgroup *memcg) { return -1; } diff --git a/mm/list_lru.c b/mm/list_lru.c index 38f711e9b56e..8b402373e965 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -75,7 +75,7 @@ list_lru_from_kmem(struct list_lru *lru, int nid, void *ptr, if (!memcg) goto out; - l = list_lru_from_memcg_idx(lru, nid, memcg_cache_id(memcg)); + l = list_lru_from_memcg_idx(lru, nid, memcg_kmem_id(memcg)); out: if (memcg_ptr) *memcg_ptr = memcg; @@ -182,7 +182,7 @@ unsigned long list_lru_count_one(struct list_lru *lru, long count; rcu_read_lock(); - l = list_lru_from_memcg_idx(lru, nid, memcg_cache_id(memcg)); + l = list_lru_from_memcg_idx(lru, nid, memcg_kmem_id(memcg)); count = l ? READ_ONCE(l->nr_items) : 0; rcu_read_unlock(); @@ -273,7 +273,7 @@ list_lru_walk_one(struct list_lru *lru, int nid, struct mem_cgroup *memcg, unsigned long ret; spin_lock(&nlru->lock); - ret = __list_lru_walk_one(lru, nid, memcg_cache_id(memcg), isolate, + ret = __list_lru_walk_one(lru, nid, memcg_kmem_id(memcg), isolate, cb_arg, nr_to_walk); spin_unlock(&nlru->lock); return ret; @@ -289,7 +289,7 @@ list_lru_walk_one_irq(struct list_lru *lru, int nid, struct mem_cgroup *memcg, unsigned long ret; spin_lock_irq(&nlru->lock); - ret = __list_lru_walk_one(lru, nid, memcg_cache_id(memcg), isolate, + ret = __list_lru_walk_one(lru, nid, memcg_kmem_id(memcg), isolate, cb_arg, nr_to_walk); spin_unlock_irq(&nlru->lock); return ret;