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

Nikita Danilov
2005-12-15T13:41:04Z

Andrew Morton writes:
> Mark Lord <lkml@rtr.ca> wrote:
> >
> > Leaving up()/down() as-is is really the most sensible option.
> >
>
> Absolutely.
>
> I must say that my interest in this stuff is down in
> needs-an-electron-microscope-to-locate territory. down() and up() work
> just fine and they're small, efficient, well-debugged and well-understood.
> We need a damn good reason for taking on tree-wide churn or incompatible
> renames or addition of risk. What's the damn good reason here?
>
> Please. Go fix some bugs. We're not short of them.

But this change is about fixing bugs: mutex assumes that

- only owner can unlock, and

- owner cannot lock (immediate self-deadlock).

This can be checked by the debugging code, and yes, these kinds of
errors do happen.

Not to say that by looking at

struct foo_bar_baz {
struct mutex fbb_mutex;
...
};

one can instantly infer that ->fbb_mutex is used to serialize something
rather than serves as some fancy signaling mechanism.

Nikita.