Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp447132pxb; Tue, 14 Sep 2021 00:48:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR3S9N2wJPTkh3+hpfcX07MS++MF09/pH9Lg/dUTpw0secDV+OOnv9ZCQ7z3dz0fMDUwy1 X-Received: by 2002:a05:6e02:214e:: with SMTP id d14mr10423108ilv.142.1631605727982; Tue, 14 Sep 2021 00:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631605727; cv=none; d=google.com; s=arc-20160816; b=qtJes0aBHpw2cMMUnqHAwEH07QOs6cEkcd4MexKuNZbTdkA2ghdPHzOMx2q0lujsxv 2XDyFbUXppGi+lHUKjvz5DOvO0twqWWG4QOohXGEYIamXM4mDag6CV0LRn4fAf1ezOP7 hWBHlu6ClGHGvoXcM4d2gZINEO2WbIyzEnNPd0Tps6kPxjwaDMSlDRjDF0Tx2vimoiIh s9togvlADYNOHEteHxk7O9bvyiPzlo7FhIP0AzZj+trtxGHlFCIAKY86I2C/MT3e+UWQ jSy3WiYR4upJLUJgeFIuS72igNt2BFZ1FmxHwmTtZrXbtQwPhWBSn1zVjONr7AoZFpdR Q8lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/CUB88/FqeRt+OVWlft0iBfJ40Vb/KWjqElOuPdMD70=; b=QSl/J5bxLOwMZ35YeWtZUtpBZUuIaYEgNwwKTpuF+NuEVuVFgt7vn8dIGRv7iF6eXY o7NGxqFjhtSMTNdbWe538u5MibrHtlnpEBhew8iq7apxDo5/L3WYL7JJ2hczIRb4uUaM Fcch3O0lfMtRK6+VWnzMh4g8m8ZJe0qXZuUzB6YtbQVU5Wvs2nGKUpulvJifoIzwOY/k /mDO90c6YXv2RiYS874oDcUI6pchuCl4zXtX3fNktE7SkHKHrWz0pKmxF0xvu0APn3yX AX1Q/buqvfJpYk4R+BrJBFPn6cwkYrssVDWJ6maqFUnjkQ6oobNIfKE5eTd2EiFWyVvP yGUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="rTJJ/eMi"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l4si8729755jaf.96.2021.09.14.00.48.35; Tue, 14 Sep 2021 00:48:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20150623.gappssmtp.com header.s=20150623 header.b="rTJJ/eMi"; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231203AbhINHsq (ORCPT + 99 others); Tue, 14 Sep 2021 03:48:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237431AbhINHrv (ORCPT ); Tue, 14 Sep 2021 03:47:51 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34DDAC061A2B for ; Tue, 14 Sep 2021 00:42:02 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id c13-20020a17090a558d00b00198e6497a4fso1457469pji.4 for ; Tue, 14 Sep 2021 00:42:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/CUB88/FqeRt+OVWlft0iBfJ40Vb/KWjqElOuPdMD70=; b=rTJJ/eMiE+Avxnn6TesM3SKY0q/LBFL95nxNlqPiFb0QWIihuVfQq6xQqgeFTwvmAl tIRfhq3xNb0KzfufoUgbX2K2vXKNf1+jNptKTW/XhwEM3xUv00+pbwZrWtFFGrEM+Eyg W7KvfKxYMy3wdJNxJPfj3/jeh0fTBH86WeGHNC4dm29fahTON9a0fX+QEYFopyaEXu9A EnQ6ZuzbwiYn92qbSNvH/pi5NYQoHHtIqNL6MkzmqQ59JmP7cCY7ewb2xzNilHG/+Qyw g9BthK+IwaDnI9b/N2LDXadLAObW/BHqeyJ3FO677/RjuIg53p1jIEed4dPS1A6M6EiT AB3Q== 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=/CUB88/FqeRt+OVWlft0iBfJ40Vb/KWjqElOuPdMD70=; b=2I69ksLS3ShHH5oKqqH9Dy2BYAUuK04LtcFKNprKIWWwbrYZf4vWue/ShHQU5OabBC SHw0Z2skDtrLGDX3VGPNaXtJmqX/4RyWzOGmY+dshMXpKqgRjqKeK3yBlB7ECVGvUSAT 41rvBv3qDQ9cCpOitXTS3RY5azKTBLJIwKvwXZVrgpatxEAqIUSd7R0HNc+tfxkuAThn nryj7rbNd0ly1ZqnOyDMnlxUZti7Ca9GVBS9g7+Kwg0oxyoxVXamA/rq7KmI/uiZfX5s 2w8UpEWeTqVWuA75DE2hVx5Bidr0mkCunKEJJP9UFglq4jO3jp7V9MtSubTiYDAvcl39 xjDA== X-Gm-Message-State: AOAM530yqX39cSG2XbuyMKoa1XYxY3EBEYCvF6RjlXwgSIOvK2RkvBL8 Qrew57b6NjxPyBOQSusZn/tlow== X-Received: by 2002:a17:90a:4ce3:: with SMTP id k90mr540686pjh.237.1631605321784; Tue, 14 Sep 2021 00:42:01 -0700 (PDT) Received: from localhost.localdomain ([139.177.225.244]) by smtp.gmail.com with ESMTPSA id s3sm9377839pfd.188.2021.09.14.00.41.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 14 Sep 2021 00:42:01 -0700 (PDT) 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 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 v3 76/76] mm: memcontrol: rename memcg_cache_id to memcg_kmem_id Date: Tue, 14 Sep 2021 15:29:38 +0800 Message-Id: <20210914072938.6440-77-songmuchun@bytedance.com> X-Mailer: git-send-email 2.21.0 (Apple Git-122) In-Reply-To: <20210914072938.6440-1-songmuchun@bytedance.com> References: <20210914072938.6440-1-songmuchun@bytedance.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org The memcg_cache_id is introduced by commit 2633d7a02823 ("slab/slub: consider a memcg parameter in kmem_create_cache"). It 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 | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 33f6ec4783f8..6541ec768a60 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1713,7 +1713,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; } @@ -1751,7 +1751,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 371097ee2485..8fb38dee0e99 100644 --- a/mm/list_lru.c +++ b/mm/list_lru.c @@ -74,7 +74,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; @@ -181,7 +181,7 @@ unsigned long list_lru_count_one(struct list_lru *lru, long count = 0; 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)); if (l) count = READ_ONCE(l->nr_items); 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; @@ -463,7 +463,7 @@ void memcg_reparent_list_lrus(struct mem_cgroup *memcg, struct mem_cgroup *paren static bool memcg_list_lru_skip_alloc(struct list_lru *lru, struct mem_cgroup *memcg) { - int idx = memcg_cache_id(memcg); + int idx = memcg_kmem_id(memcg); if (unlikely(idx < 0) || xa_load(&lru->xa, idx)) return true; @@ -518,7 +518,7 @@ int list_lru_memcg_alloc(struct list_lru *lru, struct mem_cgroup *memcg, gfp_t g xas_lock_irqsave(&xas, flags); while (i--) { - int index = memcg_cache_id(table[i].memcg); + int index = memcg_kmem_id(table[i].memcg); struct list_lru_memcg *mlru = table[i].mlru; xas_set(&xas, index); @@ -538,7 +538,7 @@ int list_lru_memcg_alloc(struct list_lru *lru, struct mem_cgroup *memcg, gfp_t g * memcg id. More details see the comments * in memcg_reparent_list_lrus(). */ - index = memcg_cache_id(table[i].memcg); + index = memcg_kmem_id(table[i].memcg); if (index < 0) xas_set_err(&xas, 0); else if (!xas_error(&xas) && index != xas.xa_index) -- 2.11.0