diff options
| author | Song Hu <husong@kylinos.cn> | 2026-08-25 16:57:56 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-10-06 17:38:53 -0700 |
| commit | c0f106b5183e9614bd44bca3ffaea1b428532994 (patch) | |
| tree | 79b8c76e90e588637354d63a505edb8702a95024 /kernel | |
| parent | fb2f274a79c7e6ba91c111ed6d92fe128f6b5772 (diff) | |
selftests/mm: restore enable_soft_offline in hugetlb-soft-offline
hugetlb-soft-offline toggles /proc/sys/vm/enable_soft_offline between 1
and 0 (test_soft_offline_common(1) then (0)) and leaves it at 0 when it
finishes, silently disabling soft offlining for the whole system after the
run.
Save the original value before the test and restore it from an atexit()
handler, as hugepage_restore_settings_atexit() in hugepage_settings.c
already does. Use read_num()/write_num() from vm_util instead of
hand-rolled popen()/fopen() helpers.
The restore handler must not call write_num(): on failure it re-enters
exit() through ksft_exit_fail_msg(), which is undefined behavior from
inside an atexit handler. A non-root run hits it directly - the restore
write fails the same way the write that triggered the exit did. Restore
with plain open()/write(), best effort.
Link: https://lore.kernel.org/20260825085756.63030-4-husong@kylinos.cn
Signed-off-by: Song Hu <husong@kylinos.cn>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@arm.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes (ARM) <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Peter Xu <peterx@redhat.com>
Cc: Sarthak Sharma <sarthak.sharma@arm.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions
