[PATCH] mm/memcg: Skip high limit check in root memcg

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The high limit checks the memory usage from given memcg to root memcg.
However, there is no limit in root memcg. So this check makes no sense
and we can ignore it.

Signed-off-by: Haifeng Xu <haifeng.xu@xxxxxxxxxx>
---
 mm/memcontrol.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 73afff8062f9..a31a56598f29 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2780,6 +2780,10 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	do {
 		bool mem_high, swap_high;
 
+		/* There is no need for root memcg to check high limit */
+		if (mem_cgroup_is_root(memcg))
+			break;
+
 		mem_high = page_counter_read(&memcg->memory) >
 			READ_ONCE(memcg->memory.high);
 		swap_high = page_counter_read(&memcg->swap) >
-- 
2.25.1





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux