From: Miaohe Lin <linmiaohe@huawei.com>
To: <hannes@cmpxchg.org>, <mhocko@kernel.org>,
<vdavydov.dev@gmail.com>, <akpm@linux-foundation.org>,
<shakeelb@google.com>, <guro@fb.com>, <songmuchun@bytedance.com>
Cc: <willy@infradead.org>, <alexs@kernel.org>,
<richard.weiyang@gmail.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <cgroups@vger.kernel.org>,
<linmiaohe@huawei.com>
Subject: [PATCH v2 2/3] mm, memcg: save some atomic ops when flush is already true
Date: Sat, 7 Aug 2021 16:28:34 +0800 [thread overview]
Message-ID: <20210807082835.61281-3-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210807082835.61281-1-linmiaohe@huawei.com>
Add 'else' to save some atomic ops in obj_stock_flush_required() when
flush is already true. No functional change intended here.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Roman Gushchin <guro@fb.com>
Acked-by: Michal Hocko <mhocko@suse.com>
---
mm/memcontrol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 6580c2381a3e..7fe242d92802 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2231,7 +2231,7 @@ static void drain_all_stock(struct mem_cgroup *root_memcg)
if (memcg && stock->nr_pages &&
mem_cgroup_is_descendant(memcg, root_memcg))
flush = true;
- if (obj_stock_flush_required(stock, root_memcg))
+ else if (obj_stock_flush_required(stock, root_memcg))
flush = true;
rcu_read_unlock();
--
2.23.0
next prev parent reply other threads:[~2021-08-07 8:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-07 8:28 [PATCH v2 0/3] Cleanups and fixup for memcontrol Miaohe Lin
2021-08-07 8:28 ` [PATCH v2 1/3] mm, memcg: remove unused functions Miaohe Lin
2021-08-07 8:28 ` Miaohe Lin [this message]
2021-08-07 8:28 ` [PATCH v2 3/3] mm, memcg: get rid of percpu_charge_mutex lock Miaohe Lin
2021-08-07 18:56 ` Andrew Morton
2021-08-09 1:56 ` Miaohe Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210807082835.61281-3-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alexs@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=richard.weiyang@gmail.com \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
--cc=vdavydov.dev@gmail.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox