[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210729125755.16871-3-linmiaohe@huawei.com>
Date: Thu, 29 Jul 2021 20:57:52 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: <hannes@...xchg.org>, <mhocko@...nel.org>,
<vdavydov.dev@...il.com>, <akpm@...ux-foundation.org>
CC: <shakeelb@...gle.com>, <guro@...com>, <willy@...radead.org>,
<alexs@...nel.org>, <richard.weiyang@...il.com>,
<songmuchun@...edance.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>, <cgroups@...r.kernel.org>,
<linmiaohe@...wei.com>
Subject: [PATCH 2/5] mm, memcg: narrow the scope of percpu_charge_mutex
Since percpu_charge_mutex is only used inside drain_all_stock(), we can
narrow the scope of percpu_charge_mutex by moving it here.
Signed-off-by: Miaohe Lin <linmiaohe@...wei.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6580c2381a3e..a03e24e57cd9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2050,7 +2050,6 @@ struct memcg_stock_pcp {
#define FLUSHING_CACHED_CHARGE 0
};
static DEFINE_PER_CPU(struct memcg_stock_pcp, memcg_stock);
-static DEFINE_MUTEX(percpu_charge_mutex);
#ifdef CONFIG_MEMCG_KMEM
static void drain_obj_stock(struct obj_stock *stock);
@@ -2209,6 +2208,7 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages)
*/
static void drain_all_stock(struct mem_cgroup *root_memcg)
{
+ static DEFINE_MUTEX(percpu_charge_mutex);
int cpu, curcpu;
/* If someone's already draining, avoid adding running more workers. */
--
2.23.0
Powered by blists - more mailing lists