Messages in this thread | | | Date | Tue, 2 Jan 2024 10:49:32 +0100 | From | Ingo Molnar <> | Subject | Re: [PATCH next v2 2/5] locking/osq_lock: Optimise the vcpu_is_preempted() check. |
| |
* David Laight <David.Laight@ACULAB.COM> wrote:
> The vcpu_is_preempted() test stops osq_lock() spinning if a virtual > cpu is no longer running. > > Although patched out for bare-metal the code still needs the cpu number.
Comma missing.
> Reading this from 'prev->cpu' is a pretty much guaranteed have a cache miss > when osq_unlock() is waking up the next cpu. > > Instead save 'prev->cpu' in 'node->prev_cpu' and use that value instead. > Update in the osq_lock() 'unqueue' path when 'node->prev' is changed. > > This is simpler than checking for 'node->prev' changing and caching > 'prev->cpu'.
Throughout the series, in changelogs and comments, please do:
s/cpu /CPU
Please be more careful about changelog quality.
> struct optimistic_spin_node { > struct optimistic_spin_node *next, *prev; > - int locked; /* 1 if lock acquired */ > - int cpu; /* encoded CPU # + 1 value */ > + int locked; /* 1 if lock acquired */ > + int cpu; /* encoded CPU # + 1 value */ > + int prev_cpu; /* encoded CPU # + 1 value */ > };
s/ encoded CPU # + 1 value / encoded value: CPU+1
Thanks,
Ingo
| |