Re: [PATCH 1/19] MUTEX: Introduce simple mutex implementation



On Fri, 2005-12-16 at 14:19 -0800, Linus Torvalds wrote:
>
> On Fri, 16 Dec 2005, Thomas Gleixner wrote:
> >
> > Well, in case of a semaphore it is a semantically correct use case. In
> > case of of a mutex it is not.
>
> I disagree.
>
> Think of "initialization" as a user. The system starts out initializing
> stuff, and as such the mutex should start out being held. It's that
> simple. It _is_ mutual exclusion, with one user being the early bootup
> state.

That's stretching it quite a bit. So you are saying that the owner is
the first swapper task, from the booting CPU? Well, you better have
that same process unlock that mutex, since a mutex has a owner and the
owner _must_ be the one to unlock it. And in lots of these cases, it's
some other thread that releases the lock.

With mutexs, the owner is not a state, but a task.

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • [PATCH] Document futex PI design
    ... +Unbounded Priority Inversion ... +to use a resource that a lower priority process has (a mutex for example), ... +waiter - A waiter is a struct that is stored on the stack of a blocked ... +The mutex structure contains a pointer to the owner of the mutex. ...
    (Linux-Kernel)
  • Re: [PATCH] Document futex PI design
    ... +Unbounded Priority Inversion ... +to use a resource that a lower priority process has (a mutex for example), ... +waiter - A waiter is a struct that is stored on the stack of a blocked ... +The mutex structure contains a pointer to the owner of the mutex. ...
    (Linux-Kernel)
  • Re: [PATCH -v9][RFC] mutex: implement adaptive spinning
    ... Change mutex contention behaviour such that it will sometimes busy wait on ... The key criteria for the busy wait is that the lock owner has to be running on ... +static inline int __sched ... return ret; ...
    (Linux-Kernel)
  • Re: [PATCH][RFC]: mutex: adaptive spin
    ... rfc, only to have Ingo reply, providing the changelog for you? ... the owner has the mutex here, ... The overall design intent seems very smart to me, ...
    (Linux-Kernel)
  • Re: [PATCH -v8][RFC] mutex: implement adaptive spinning
    ... The key criteria for the busy wait is that the lock owner has to be running on ... One thing that worries me here is that the spinners will spin on a memory location in struct mutex, which means that the cacheline holding the mutex will be continuously shared by the spinners, slowing the owner down when it needs to unshare it. ... Something similar might be done to spinlocks to reduce cacheline contention from spinners and the owner. ...
    (Linux-Kernel)