Re: [PATCH v3 10/14] mm, swap: refactor swapoff and add xswap_destroy
From: Chris Li
Date: Mon Sep 28 2026 - 01:59:00 EST
On Sun, Sep 27, 2026 at 7:40 PM Chris Li <chrisl@xxxxxxxxxx> wrote:
>
> Here you relocate the swapoff function and causing a lot of diff
> context due to the code movement.
>
> I move your swapoff code back, right after
> flush_percpu_swap_cluster(). Then the diff is much cleaner around
> swapoff.
>
> For example, here is what the new diff showed:
I am sorry I messed up. Please ignore my last email comment for this
part. It is still benificial to have the swapoff function move after
flush_percpu_swap_cluster() from the diff point of view. II messed up
my patch by relocating the `pweroff` function in the wrong patch.
> SYSCALL_DEFINE1(swapoff, const char __user *, specialfile)
> {
> struct swap_info_struct *p = NULL;
> @@ -3391,6 +3393,11 @@ SYSCALL_DEFINE1(swapoff, const char __us
> spin_unlock(&p->lock);
> spin_unlock(&swap_lock);
>
> +#ifdef CONFIG_XSWAP
> + if (p->flags & SWP_XSWAP)
> + cancel_work_sync(&p->xswap_shrink_work);
> +#endif
> +
> wait_for_allocation(p);
>
> set_current_oom_origin();
>
> It means we will need some swap_ops->swapoff() for handling the async
> workqueue canceling.
Never mind the above comment.
Chris