Re: [PATCH v3] selftests: add swap() macro to kselftest.h

From: Sean Christopherson

Date: Thu Jul 09 2026 - 10:58:42 EST


On Thu, Jun 25, 2026, Piotr Zarycki wrote:
> Add swap() to tools/testing/selftests/kselftest.h with an #ifndef guard.
>
> Guard the local swap() definition in mm/uffd-stress.c with #ifndef to
> prevent a redefinition warning.
>
> Use swap() in hyperv_tlb_flush.c to replace the open-coded PTE swap and
> remove the TODO comment.
>
> Signed-off-by: Piotr Zarycki <piotr.zarycki@xxxxxxxxx>
> ---
> Changes in v3:
> - Add #ifndef guard to mm/uffd-stress.c to fix a redefinition warning;
> uffd-stress.c defines its own swap() without a guard, which conflicts
> when kselftest.h is included first via uffd-common.h.

Why not explicitly include kselftest.h in mm/uffd-stress.c and drop uffd-stress.c's
version of swap()?