public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] memcg, oom: unmark under_oom after the oom killer is done
@ 2023-09-22  7:05 Haifeng Xu
       [not found] ` <20230922070529.362202-1-haifeng.xu-LL2PKPoSiP3QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 20+ messages in thread
From: Haifeng Xu @ 2023-09-22  7:05 UTC (permalink / raw)
  To: mhocko-DgEjT+Ai2ygdnm+yROfE0A
  Cc: hannes-druUgvl0LCNAfugRpC6u6w,
	roman.gushchin-fxUVXftIFDnyG1zEObXtfA,
	shakeelb-hpIqsD4AKlfQT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg, Haifeng Xu

When application in userland receives oom notification from kernel
and reads the oom_control file, it's confusing that under_oom is 0
though the omm killer hasn't finished. The reason is that under_oom
is cleared before invoking mem_cgroup_out_of_memory(), so move the
action that unmark under_oom after completing oom handling. Therefore,
the value of under_oom won't mislead users.

Signed-off-by: Haifeng Xu <haifeng.xu-LL2PKPoSiP3QT0dZR+AlfA@public.gmane.org>
---
 mm/memcontrol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index e8ca4bdcb03c..0b6ed63504ca 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1970,8 +1970,8 @@ static bool mem_cgroup_oom(struct mem_cgroup *memcg, gfp_t mask, int order)
 	if (locked)
 		mem_cgroup_oom_notify(memcg);
 
-	mem_cgroup_unmark_under_oom(memcg);
 	ret = mem_cgroup_out_of_memory(memcg, mask, order);
+	mem_cgroup_unmark_under_oom(memcg);
 
 	if (locked)
 		mem_cgroup_oom_unlock(memcg);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2023-10-25 21:48 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-22  7:05 [PATCH 1/2] memcg, oom: unmark under_oom after the oom killer is done Haifeng Xu
     [not found] ` <20230922070529.362202-1-haifeng.xu-LL2PKPoSiP3QT0dZR+AlfA@public.gmane.org>
2023-09-22 23:17   ` Roman Gushchin
     [not found]     ` <ZQ4giCbTqUpmKWAa-+xijCwNIfdoLQcUKs7qKB+WAnPUfkyWGUBSOeVevoDU@public.gmane.org>
2023-09-23  8:05       ` Haifeng Xu
2023-09-25  7:57   ` Michal Hocko
2023-09-25  7:57     ` Michal Hocko
     [not found]     ` <ZRE9fAf1dId2U4cu-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-25  9:03       ` Haifeng Xu
2023-09-25  9:03         ` Haifeng Xu
     [not found]         ` <6b7af68c-2cfb-b789-4239-204be7c8ad7e-LL2PKPoSiP3QT0dZR+AlfA@public.gmane.org>
2023-09-25 11:38           ` Michal Hocko
2023-09-25 11:38             ` Michal Hocko
     [not found]             ` <ZRFxLuJp1xqvp4EH-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-25 12:28               ` Haifeng Xu
2023-09-25 12:28                 ` Haifeng Xu
     [not found]                 ` <94b7ed1d-9ca8-7d34-a0f4-c46bc995a3d2-LL2PKPoSiP3QT0dZR+AlfA@public.gmane.org>
2023-09-25 12:37                   ` Michal Hocko
2023-09-25 12:37                     ` Michal Hocko
     [not found]                     ` <ZRF/CTk4MGPZY6Tc-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2023-09-26 14:39                       ` Haifeng Xu
2023-09-26 14:39                         ` Haifeng Xu
2023-09-27 13:36                         ` Michal Hocko
2023-09-28  3:03                           ` Haifeng Xu
2023-10-03  7:50                             ` Michal Hocko
2023-10-11  1:59                               ` Haifeng Xu
2023-10-25 21:48                                 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox