lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z4gPblXp1HXrgL_I@tiehlicka>
Date: Wed, 15 Jan 2025 20:41:34 +0100
From: Michal Hocko <mhocko@...e.com>
To: Rik van Riel <riel@...riel.com>
Cc: Johannes Weiner <hannes@...xchg.org>,
	Yosry Ahmed <yosryahmed@...gle.com>,
	Balbir Singh <balbirs@...dia.com>,
	Roman Gushchin <roman.gushchin@...ux.dev>,
	hakeel Butt <shakeel.butt@...ux.dev>,
	Muchun Song <muchun.song@...ux.dev>,
	Andrew Morton <akpm@...ux-foundation.org>, cgroups@...r.kernel.org,
	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	kernel-team@...a.com, Nhat Pham <nphamcs@...il.com>
Subject: Re: [PATCH v2] memcg: allow exiting tasks to write back data to swap

On Wed 15-01-25 12:35:37, Rik van Riel wrote:
> On Tue, 2025-01-14 at 20:42 +0100, Michal Hocko wrote:
> > O
> > I do agreee that a memory deadlock is not really proper way to deal
> > with
> > the issue. I have to admit that my understanding was based on ENOMEM
> > being properly propagated out of in kernel user page faults. 
> 
> It looks like it kind of is.
> 
> In case of VM_FAULT_OOM, the page fault code calls
> kernelmode_fixup_or_oops(), which a few functions
> down calls ex_handler_default(), which advances
> regs->ip to the next instruction after the one
> that faulted.

OK, so we do not have the endless loop. Good. Sorry I didn't get to read
through the fixup tables maze. Thanks for confirming.

> Of course, if we have a copy_from_user loop, we
> could end up there a bunch of times :)

Yes, the robust list might have many elements and if each and every is
swapped out then this can take a lot of time if the reclaim path is
desperately retrying the whole reclaim. All that being said, does the
change (partial revert) suggested by Johannes

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7b3503d12aaf..9c30c442e3b0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1627,7 +1627,7 @@ static bool mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	 * A few threads which were not waiting at mutex_lock_killable() can
 	 * fail to bail out. Therefore, check again after holding oom_lock.
 	 */
-	ret = task_is_dying() || out_of_memory(&oc);
+	ret = out_of_memory(&oc);
 
 unlock:
 	mutex_unlock(&oom_lock);

Or is the exit still taking unbearably too long? If yes maybe we can
help to ENOMEM already killed and oom reaped tasks earlier?
-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ