Mutex midpath question (mutex-design.rst , CONFIG_MUTEX_SPIN_ON_OWNER)

Richard richard_siegfried at systemli.org
Sat Oct 15 11:59:36 EDT 2022


Hi all,

I have a question regarding understanding mutex-design.rst. It is about 
the feature that mutexes also have spinlocks for the case where the 
current lock is occupied but by a task that is runnning and might end 
soon (optimistic spinning).

The top of the file says:
> 
> In its most basic form it also includes a
> wait-queue and a spinlock that serializes access to it. Furthermore,
> CONFIG_MUTEX_SPIN_ON_OWNER=y systems use a spinner MCS lock (->osq), described
> below in (ii).

What is not fully clear for me here is: is the optimistic spinning 
always accessible and MCS is just an optimisation. Or is optimistic 
spinning only accessible with CONFIG_MUTEX_SPIN_ON_OWNER.

The mentioning of the first spinlock in the first sentence confuses me.

Thanks,
-- Richard



More information about the Kernelnewbies mailing list