* [PATCH v2] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded()
@ 2020-10-12 13:16 Miaohe Lin
2020-10-12 13:58 ` Johannes Weiner
0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2020-10-12 13:16 UTC (permalink / raw)
To: akpm, hannes, mhocko, vdavydov.dev
Cc: cgroups, linux-mm, linux-kernel, linmiaohe
The mz->usage_in_excess >= mz_node->usage_in_excess check is exactly the
else case of mz->usage_in_excess < mz_node->usage_in_excess. So we could
replace else if (mz->usage_in_excess >= mz_node->usage_in_excess) with else
equally. Also drop the comment which doesn't really explain much.
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/memcontrol.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 2636f8bad908..b080a9434b9e 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -623,14 +623,9 @@ static void __mem_cgroup_insert_exceeded(struct mem_cgroup_per_node *mz,
if (mz->usage_in_excess < mz_node->usage_in_excess) {
p = &(*p)->rb_left;
rightmost = false;
- }
-
- /*
- * We can't avoid mem cgroups that are over their soft
- * limit by the same amount
- */
- else if (mz->usage_in_excess >= mz_node->usage_in_excess)
+ } else {
p = &(*p)->rb_right;
+ }
}
if (rightmost)
--
2.19.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded()
2020-10-12 13:16 [PATCH v2] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded() Miaohe Lin
@ 2020-10-12 13:58 ` Johannes Weiner
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Weiner @ 2020-10-12 13:58 UTC (permalink / raw)
To: Miaohe Lin; +Cc: akpm, mhocko, vdavydov.dev, cgroups, linux-mm, linux-kernel
On Mon, Oct 12, 2020 at 09:16:07AM -0400, Miaohe Lin wrote:
> The mz->usage_in_excess >= mz_node->usage_in_excess check is exactly the
> else case of mz->usage_in_excess < mz_node->usage_in_excess. So we could
> replace else if (mz->usage_in_excess >= mz_node->usage_in_excess) with else
> equally. Also drop the comment which doesn't really explain much.
>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Looks good to me.
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-10-12 14:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-12 13:16 [PATCH v2] mm: memcontrol: eliminate redundant check in __mem_cgroup_insert_exceeded() Miaohe Lin
2020-10-12 13:58 ` Johannes Weiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox