incoming
Subsystems (5)
Andrew Morton
maintainer4 patches, based on 56e337f2cf1326323844927a04e9dbce9a244835.
Subsystems affected by this patch series:
mm/swap
kconfig
ocfs2
selftests
Subsystem: mm/swap
Guo Ziliang <[email protected]>:
mm: swap: get rid of deadloop in swapin readahead
Subsystem: kconfig
Qian Cai <[email protected]>:
configs/debug: restore DEBUG_INFO=y for overriding
Subsystem: ocfs2
Joseph Qi <[email protected]>:
ocfs2: fix crash when initialize filecheck kobj fails
Subsystem: selftests
Yosry Ahmed <[email protected]>:
selftests: vm: fix clang build error multiple output files
fs/ocfs2/super.c | 22 +++++++++++----------- kernel/configs/debug.config | 1 + mm/swap_state.c | 2 +- tools/testing/selftests/vm/Makefile | 6 ++---- 4 files changed, 15 insertions(+), 16 deletions(-)
Andrew Morton
maintainerPATCH 1/4 mm: swap: get rid of deadloop in swapin readahead
From: Guo Ziliang <[email protected]>
Subject: mm: swap: get rid of deadloop in swapin readahead
In our testing, a deadloop task was found. Through sysrq printing, same stack was found every time, as follows:
__swap_duplicate+0x58/0x1a0 swapcache_prepare+0x24/0x30 __read_swap_cache_async+0xac/0x220 read_swap_cache_async+0x58/0xa0 swapin_readahead+0x24c/0x628 do_swap_page+0x374/0x8a0 __handle_mm_fault+0x598/0xd60 handle_mm_fault+0x114/0x200 do_page_fault+0x148/0x4d0 do_translation_fault+0xb0/0xd4 do_mem_abort+0x50/0xb0
The reason for the deadloop is that swapcache_prepare() always returns EEXIST, indicating that SWAP_HAS_CACHE has not been cleared, so that it cannot jump out of the loop. We suspect that the task that clears the SWAP_HAS_CACHE flag never gets a chance to run. We try to lower the priority of the task stuck in a deadloop so that the task that clears the SWAP_HAS_CACHE flag will run. The results show that the system returns to normal after the priority is lowered.
In our testing, multiple real-time tasks are bound to the same core, and the task in the deadloop is the highest priority task of the core, so the deadloop task cannot be preempted.
Although cond_resched() is used by __read_swap_cache_async, it is an empty function in the preemptive system and cannot achieve the purpose of releasing the CPU. A high-priority task cannot release the CPU unless preempted by a higher-priority task. But when this task is already the highest priority task on this core, other tasks will not be able to be scheduled. So we think we should replace cond_resched() with schedule_timeout_uninterruptible(1), schedule_timeout_interruptible will call set_current_state first to set the task state, so the task will be removed from the running queue, so as to achieve the purpose of giving up the CPU and prevent it from running in kernel mode for too long.
(akpm: ugly hack becomes uglier. But it fixes the issue in a backportable-to-stable fashion while we hopefully work on something better)
---
mm/swap_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swap_state.c renamed from mm/swap_state.c~mm-swap-get-rid-of-deadloop-in-swapin-readahead +1 -1
@@ -478,7 +478,7 @@ struct page *__read_swap_cache_async(swp* __read_swap_cache_async(), which has set SWAP_HAS_CACHE * in swap_map, but not yet added its page to swap cache. */ -cond_resched (); +schedule_timeout_uninterruptible (1 ); }/*
_
Andrew Morton
maintainerPATCH 2/4 configs/debug: restore DEBUG_INFO=y for overriding
In reply to Andrew MortonFrom: Qian Cai <[email protected]>
Subject: configs/debug: restore DEBUG_INFO=y for overriding
Previously, I failed to realize that Kees' patch [1] has not been merged into the mainline yet, and dropped DEBUG_INFO=y too eagerly from the mainline. As the results, "make debug.config" won't be able to flip DEBUG_INFO=n from the existing .config. This should close the gaps of a few weeks before Kees' patch is there, and work regardless of their merging status anyway.
[1] https://lore.kernel.org/all/[email protected]/
---
kernel/configs/debug.config | 1 + 1 file changed, 1 insertion(+)
kernel/configs/debug.config renamed from kernel/configs/debug.config~configs-debug-restore-debug_info=y-for-overriding +1 -0
@@ -16,6 +16,7 @@ CONFIG_SYMBOLIC_ERRNAME=y # # Compile-time checks and compiler options # +CONFIG_DEBUG_INFO=y CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_DEBUG_SECTION_MISMATCH=y CONFIG_FRAME_WARN=2048
_
Andrew Morton
maintainerPATCH 3/4 ocfs2: fix crash when initialize filecheck kobj fails
In reply to Andrew MortonFrom: Joseph Qi <[email protected]>
Subject: ocfs2: fix crash when initialize filecheck kobj fails
Once s_root is set, genric_shutdown_super() will be called if fill_super() fails. That means, we will call ocfs2_dismount_volume() twice in such case, which can lead to kernel crash. Fix this issue by initializing filecheck kobj before setting s_root.
---
fs/ocfs2/super.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/ocfs2/super.c renamed from fs/ocfs2/super.c~ocfs2-fix-crash-when-initialize-filecheck-kobj-fails +11 -11
@@ -1105,17 +1105,6 @@ static int ocfs2_fill_super(struct super goto read_super_error; } - root =d_make_root (inode); -if (!root) { - status = -ENOMEM ; -mlog_errno (status); - goto read_super_error; - } - - sb->s_root = root; - -ocfs2_complete_mount_recovery (osb); - osb->osb_dev_kset =kset_create_and_add (sb->s_id,NULL , &ocfs2_kset->kobj);if (!osb->osb_dev_kset) {
@@ -1133,6 +1122,17 @@ static int ocfs2_fill_super(struct super goto read_super_error; } + root =d_make_root (inode); +if (!root) { + status = -ENOMEM ; +mlog_errno (status); + goto read_super_error; + } + + sb->s_root = root; + +ocfs2_complete_mount_recovery (osb); +if (ocfs2_mount_local (osb))snprintf (nodestr,sizeof (nodestr),"local" );else
_
Andrew Morton
maintainerPATCH 4/4 selftests: vm: fix clang build error multiple output files
In reply to Andrew MortonFrom: Yosry Ahmed <[email protected]>
Subject: selftests: vm: fix clang build error multiple output files
When building the vm selftests using clang, some errors are seen due to having headers in the compilation command:
clang -Wall -I ../../../../usr/include -no-pie gup_test.c ../../../../mm/gup_test.h -lrt -lpthread -o .../tools/testing/selftests/vm/gup_test
clang: error: cannot specify -o when generating multiple output files make[1]: *** [../lib.mk:146: .../tools/testing/selftests/vm/gup_test] Error 1
Rework to add the header files to LOCAL_HDRS before including ../lib.mk, since the dependency is evaluated in '$(OUTPUT)/%:%.c $(LOCAL_HDRS)' in file lib.mk.
---
tools/testing/selftests/vm/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
tools/testing/selftests/vm/Makefile renamed from tools/testing/selftests/vm/Makefile~selftests-vm-fix-clang-build-error-multiple-output-files +2 -4
@@ -1,6 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for vm selftests +LOCAL_HDRS += $(selfdir)/vm/local_config.h $(top_srcdir)/mm/gup_test.h + include local_config.mk uname_M := $(shell uname -m 2>/dev/null || echo not)
@@ -140,10 +142,6 @@ endif $(OUTPUT)/mlock-random-test $(OUTPUT)/memfd_secret: LDLIBS += -lcap -$(OUTPUT)/gup_test: ../../../../mm/gup_test.h - -$(OUTPUT)/hmm-tests: local_config.h - # HMM_EXTRA_LIBS may get set in local_config.mk, or it may be left empty. $(OUTPUT)/hmm-tests: LDLIBS += $(HMM_EXTRA_LIBS)
_