Re: [RFC PATCH v4 4/6] mm/migrate: add copy offload registration infrastructure

Gregory Price
2026-03-09T17:54:27Z

On Mon, Mar 09, 2026 at 12:07:29PM +0000, Shivank Garg wrote:
... snip ...
>
> Only one migrator can be active a time. A second registration returns
> -EBUSY, and only the active migrator can stop itself. The static_call
> dispatch is under SRCU so synchronize_srcu() in stop path guarantees
> no in-flight copy before the module reference is dropped.
>
... snip ...

> @@ -1820,11 +1833,18 @@ static int migrate_pages_batch(struct list_head *from,
>
> +#ifdef CONFIG_MIGRATION_COPY_OFFLOAD
> + /* Check if the offload driver wants to batch for this reason */
> + if (static_branch_unlikely(&migrate_offload_enabled))
> + do_batch = static_call(migrate_should_batch)(reason);
> +#endif
> +

should the migrate_should_batch call also be done under srcu?

In theory it's an incredibly small window, but there is a race window.

~Gregory