[PATCH 30/33] kthread: Add API to update preferred affinity on kthread runtime

Simon Horman horms at kernel.org
Tue Oct 14 05:35:43 PDT 2025


On Mon, Oct 13, 2025 at 10:31:43PM +0200, Frederic Weisbecker wrote:

...

> @@ -900,6 +899,46 @@ int kthread_affine_preferred(struct task_struct *p, const struct cpumask *mask)
>  }
>  EXPORT_SYMBOL_GPL(kthread_affine_preferred);
>  
> +/**
> + * kthread_affine_preferred_update - update a kthread's preferred affinity
> + * @p: thread created by kthread_create().
> + * @cpumask: new mask of CPUs (might not be online, must be possible) for @k
> + *           to run on.

nit: @mask: ...

Likewise for the documentation of kthread_affine_preferred()
in a subsequent patch in this series.

> + *
> + * Update the cpumask of the desired kthread's affinity that was passed by
> + * a previous call to kthread_affine_preferred(). This can be called either
> + * before or after the first wakeup of the kthread.
> + *
> + * Returns 0 if the affinity has been applied.
> + */
> +int kthread_affine_preferred_update(struct task_struct *p,
> +				    const struct cpumask *mask)

...



More information about the linux-arm-kernel mailing list