Re: [patch 00/62] sem2mutex: -V1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Arjan van de Ven <[email protected]> wrote:

> That case is the simple (and most common) case. Since it uses down() 
> only, it can't be irq context. (trylock could be a sign of irq context 
> use), and all up()'s are 1) not in irq context either because they're 
> in the same function as the down() which isn;t and 2) perfectly 
> matched to the down(), eg each down gets one up ---> perfect 
> semaphore.

one of the most frequent exceptions to the 'up in a separate function' 
rule are seqfile implementations, which all have start(), mid(), stop() 
methods, where start() does the down(), stop() does the up(). These can 
still be converted to mutexes (and i converted a couple of them), after 
manual review.

> The other case on the other side of the spectrum is a down in one 
> function and an up in an irq function. Which is a pretty good sign of 
> a completion.... (same is true for a specific scenario where kernel 
> thread creation is involved and the up() is done in the just created 
> thread).

another good sign of completion type of semaphores is the use of 
DECLARE_MUTEX_LOCKED(), init_MUTEX_LOCKED(), or sema_init(&sem, 0). In 
95% of these cases these signal semaphores used as completions. That is 
one reason why i did not add DEFINE_MUTEX_LOCKED(), nor 
mutex_init_locked() to the mutex APIs.

the 'struct work' conversion is rare, i've only seen it in XFS so far.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux