From patchwork Wed Dec 2 18:27:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 11946697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F208BC64E7C for ; Wed, 2 Dec 2020 18:27:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6312A22248 for ; Wed, 2 Dec 2020 18:27:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6312A22248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AAD706B0068; Wed, 2 Dec 2020 13:27:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A860D6B006C; Wed, 2 Dec 2020 13:27:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 94F456B006E; Wed, 2 Dec 2020 13:27:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 7BB516B0068 for ; Wed, 2 Dec 2020 13:27:52 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 45958349B for ; Wed, 2 Dec 2020 18:27:52 +0000 (UTC) X-FDA: 77549175984.20.game57_2f0470c273b5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 21C83180C07AB for ; Wed, 2 Dec 2020 18:27:52 +0000 (UTC) X-HE-Tag: game57_2f0470c273b5 X-Filterd-Recvd-Size: 5161 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Dec 2020 18:27:51 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id b12so1445040pjl.0 for ; Wed, 02 Dec 2020 10:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L0EYVG9/JHZSwQKcdm/uLO/GzIIIcVeao0a1qNmlzMo=; b=GXcmtb/78TmgRjL90+9AKiKDg4mnBqNkTFZGUjNrkQyhPFWnxWHSVxs0DTYbJk6Phx TazQkZ9fOF7szRFViPIaI0ROE8eFgpvx9II8n3p38lZSVEjQ3dRqbbIMY3MVykotTJsl BNShLtVE/G84sNhuNL1LeF627T1FpxJ6SOdiwmWLT3yS5yTqHbSnYuid/xR5f77I54nR W0iyAUkHH4fT4u/nrsyR9xbgpZQiPCdF2WmENoSClFzMTLy0fdn0/lSSBI23C2/JJrw7 XLS1iN+WD0VnI0t67kf8JimWA2DEpqR+PKa9DNv1EyRWPwGphhTjcTHMHeI/cBf2652r xDnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L0EYVG9/JHZSwQKcdm/uLO/GzIIIcVeao0a1qNmlzMo=; b=HvYEqc2RS0zzzUCY73Nik6kz61QbenOHpXIYocrsowPj1wxcbUMlp4mcsMbu2NvQxS ce+hw2suwjulRKyw0vjQY8DbYAp3fODv49o8kEbKHXWWl8017Gew4lSmFmJZhMDFFF3q UTebJ92kMVYaqV0E5fORty702PCFDaLKFGqwc2A/J8VrAV4P7sZQlpcNoXAX1CUT96eS w4JNSrJqO2yVMy5vfpR/Yvxz+4rMxEg95pBcK1rvk9hMbcVw3jxJLORoMcOG+YJZmlEv wJUOtqSkHbByxkfQ2ErYzCnRWj0fmYS0lwNUhHTyCMLQMgGLUpHcwe0lL8L1y1UTZlYP ksrg== X-Gm-Message-State: AOAM530UijNKTZOKO6glz14Gwbsjw9UHMPhbr2Jamp5J69yg2Cf4Z3I2 2Pzc1GlveRHprcW5UbQcu/s= X-Google-Smtp-Source: ABdhPJz6Mh4mDqhuFxz84ELSR6dVfwNcpfWdx8Zo/0l4bcZNoiNkq6y2HGDqfzHOf/F2Rv9sAuVCLQ== X-Received: by 2002:a17:90a:4817:: with SMTP id a23mr1102425pjh.16.1606933670937; Wed, 02 Dec 2020 10:27:50 -0800 (PST) Received: from localhost.localdomain (c-73-93-239-127.hsd1.ca.comcast.net. [73.93.239.127]) by smtp.gmail.com with ESMTPSA id c6sm396906pgl.38.2020.12.02.10.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2020 10:27:49 -0800 (PST) From: Yang Shi To: guro@fb.com, ktkhai@virtuozzo.com, shakeelb@google.com, david@fromorbit.com, hannes@cmpxchg.org, mhocko@suse.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/9] mm: memcontrol: rename memcg_shrinker_map_mutex to memcg_shrinker_mutex Date: Wed, 2 Dec 2020 10:27:19 -0800 Message-Id: <20201202182725.265020-4-shy828301@gmail.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201202182725.265020-1-shy828301@gmail.com> References: <20201202182725.265020-1-shy828301@gmail.com> MIME-Version: 1.0 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 following patch will add memcg_shrinker_deferred which could be protected by the same mutex, rename it to a more common name. Signed-off-by: Yang Shi --- mm/memcontrol.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 29459a6ce1c7..19e41684c96b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -395,7 +395,7 @@ EXPORT_SYMBOL(memcg_kmem_enabled_key); #endif static int memcg_shrinker_map_size; -static DEFINE_MUTEX(memcg_shrinker_map_mutex); +static DEFINE_MUTEX(memcg_shrinker_mutex); static void memcg_free_shrinker_map_rcu(struct rcu_head *head) { @@ -408,7 +408,7 @@ static int memcg_expand_one_shrinker_map(struct mem_cgroup *memcg, struct memcg_shrinker_map *new, *old; int nid; - lockdep_assert_held(&memcg_shrinker_map_mutex); + lockdep_assert_held(&memcg_shrinker_mutex); for_each_node(nid) { old = rcu_dereference_protected( @@ -458,7 +458,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) if (mem_cgroup_is_root(memcg)) return 0; - mutex_lock(&memcg_shrinker_map_mutex); + mutex_lock(&memcg_shrinker_mutex); size = memcg_shrinker_map_size; for_each_node(nid) { map = kvzalloc_node(sizeof(*map) + size, GFP_KERNEL, nid); @@ -469,7 +469,7 @@ static int memcg_alloc_shrinker_maps(struct mem_cgroup *memcg) } rcu_assign_pointer(memcg->nodeinfo[nid]->shrinker_map, map); } - mutex_unlock(&memcg_shrinker_map_mutex); + mutex_unlock(&memcg_shrinker_mutex); return ret; } @@ -484,7 +484,7 @@ int memcg_expand_shrinker_maps(int new_id) if (size <= old_size) return 0; - mutex_lock(&memcg_shrinker_map_mutex); + mutex_lock(&memcg_shrinker_mutex); if (!root_mem_cgroup) goto unlock; @@ -500,7 +500,7 @@ int memcg_expand_shrinker_maps(int new_id) unlock: if (!ret) memcg_shrinker_map_size = size; - mutex_unlock(&memcg_shrinker_map_mutex); + mutex_unlock(&memcg_shrinker_mutex); return ret; }