Re: [PATCH] selftests/mm: ksm_tests: skip when not run as root

From: SeongJae Park

Date: Sat Jan 10 2026 - 12:00:21 EST


On Sat, 10 Jan 2026 20:44:21 +0800 sun jian <sun.jian.kdev@xxxxxxxxx> wrote:

> On Sat, Jan 10, 2026 at 9:16 AM SeongJae Park <sj@xxxxxxxxxx> wrote:
> > What about using ksft_exit_skip() instead, like compaction_test.c does?
> ksm_tests is a legacy selftest binary and doesn't use kselftest harness/TAP
> APIs. It only includes kselftest.h for the KSFT_* exit codes.
>
> This patch is a minimal prerequisite fix. Returning KSFT_SKIP already
> provides the correct semantic to the runner, without pulling ksm_tests into the
> harness model, which would be a larger refactor.

I agree such refactoring would be unnecessary for this small change. But you
can use ksft_exit_skip() without such refactoring, isn't it? The function is
declared in kselftest.h, not kselftest_harness.h. ksm_functional_tests.c is
also using ksft_exit_skip() without the harness model.


Thanks,
SJ

[...]