Re: [PATCH v3] mm: memory-failure: use rcu lock instead of tasklist_lock when collect_procs()

From: Tong Tiangen
Date: Tue Sep 05 2023 - 12:42:16 EST




在 2023/9/4 7:41, Andrew Morton 写道:
On Mon, 28 Aug 2023 10:25:27 +0800 Tong Tiangen <tongtiangen@xxxxxxxxxx> wrote:

We found a softlock issue in our test, analyzed the logs, and found that
the relevant CPU call trace as follows:

...

By removing the use of tasklist_lock in task list iteration, we can break
the softlock chain above.


So I assume we'd like to backport this fix into -stable kernels?

If so, are we able to identify a suitble Fixes: target?
.

After checking the git logs of these functions, the lock-related code
line is available when the functions are first introduced, as follows:

copy_process(): kernel/fork.c
commit 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (tag: v2.6.12-rc2)
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
Date: Sat Apr 16 15:20:36 2005 -0700

Linux-2.6.12-rc2

wp_page_copy(): mm/memory.c
commit 2f38ab2c3c7fef04dca0313fd89d91f142ca9281
Author: Shachar Raindel <raindel@xxxxxxxxxxxx>
Date: Tue Apr 14 15:46:32 2015 -0700

mm: refactor do_wp_page, extract the page copy flow

pte_offset_map_lock: include/linux/mm.hq
commit c74df32c724a1652ad8399b4891bb02c9d43743a
Author: Hugh Dickins <hugh@xxxxxxxxxxx>
Date: Sat Oct 29 18:16:23 2005 -0700

[PATCH] mm: ptd_alloc take ptlock

collect_procs_anon(): mm/memory-failure.c
commit 6a46079cf57a7f7758e8b926980a4f852f89b34d
Author: Andi Kleen <andi@xxxxxxxxxxxxxx>
Date: Wed Sep 16 11:50:15 2009 +0200
HWPOISON: The high level memory error handler in the VM v7

Is it appropriate to use the commit of the last introduction function(wp_page_copy())?
Fixes: 2f38ab2c3c7f ("refactor do_wp_page, extract the page copy flow")

Or use the commit introduced by the error reporting function(collect_procs_anon())?
Fixes: 6a46079cf57a ("HWPOISON: The high level memory error handler in the VM v7")