Messages in this thread | | | Subject | Re: [patch 00/62] sem2mutex: -V1 | From | Arjan van de Ven <> | Date | Fri, 13 Jan 2006 23:13:24 +0100 |
| |
On Fri, 2006-01-13 at 14:09 -0800, Junio C Hamano wrote: > Arjan van de Ven <arjan@infradead.org> writes: > > > On Fri, 2006-01-13 at 23:04 +0200, Matan Peled wrote: > >> Ingo Molnar wrote: > >> > Ingo Oeser wrote: > >> >> Could we get for each of these and a mutex: > >> >> > >> >> - description > >> >> - common use case > >> >> - small argument why this and nothing else should be used there > >> > > >> > like ... Documentation/mutex-design.txt? > >> > >> I think what he wanted was an explanation for the change of each and every > >> sem... Which is kind of hard with automated tools. > > ` > > it's also HIGHLY repetitive. > > 1) The process is : Look at semaphore and it's uses. > > 2) Decide it's a mutex > > 3) Run script to convert to mutex > > 4) Run script to validate the conversion > > 5) build+boot test > > > > I can't think of a way to describe that uniquely different for each > > one ;0 > > I do not read Ingo Oeser's request as such, but if somebody does > 1) and 2), ideally, the knowledge obtained during that process, > i.e. what is being protected and what the invariants are, and > the reasoning why it is a mutex, could serve as a good > documentation for people who want to further work on that code > being converted to use mutex.
Again that is almost a generic answer, the *vast* majority of mutex-semaphores is used in such a way that the down() and up() are always in the same function, eg the pattern is
down(semaphore); do_stuff(); up(semaphore);
all the time. That's then a mutex... and the most basic use pattern. Sure this isn't always the case but it's very common.
(there have been 2 cases that accidentally did
up(semaphore); do_stuff(); down(semaphore);
.. which is legal with semaphores but not what was intended ;)
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |