Re: [PATCH v5 16/18] timer: Implement the hierarchical pull model

From: Peter Zijlstra
Date: Tue Mar 21 2023 - 11:41:15 EST


On Wed, Mar 01, 2023 at 03:17:42PM +0100, Anna-Maria Behnsen wrote:
> +static bool tmigr_requires_handle_remote_up(struct tmigr_group *group,
> + struct tmigr_group *child,
> + void *ptr)
> +{
> + struct tmigr_remote_data *data = ptr;
> + u32 childmask;
> +
> + childmask = data->childmask;
> +
> + /*
> + * Handle the group only if child is the migrator or if the group
> + * has no migrator. Otherwise the group is active and is handled by
> + * its own migrator.
> + */
> + if (!tmigr_check_migrator(group, childmask))
> + return true;
> +
> + /*
> + * Racy lockless check for next_expiry
> + */
> + if (data->now >= group->next_expiry) {

I'm not far enough along to tell; but on 32bit this can/will suffer from
split loads and basically turn into a random number generator. I'm
presuming the 'check = 1' thing here covers that case?

> + data->check = 1;
> + return true;
> + }
> +
> + /* Update of childmask for next level */
> + data->childmask = group->childmask;
> + return false;
> +}