lkml.org 
[lkml]   [2008]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] De-macro spin_trylock_irq, spin_trylock_irqsave, write_trylock_irqsave

* Alexey Dobriyan <adobriyan@gmail.com> wrote:

> 1) de-macro, remove ({ usages as side-effect,
> 2) change calling convention to not accept "flags" by value -- trylock
> functions can modify them, so by-value is misleading, and number of users
> is relatively low.
> 3) de-macro spin_trylock_irq() for a change.

> +++ b/kernel/sched.c
> @@ -1174,7 +1174,7 @@ static void resched_cpu(int cpu)
> struct rq *rq = cpu_rq(cpu);
> unsigned long flags;
>
> - if (!spin_trylock_irqsave(&rq->lock, flags))
> + if (!spin_trylock_irqsave(&rq->lock, &flags))
> return;

hm, i dont really like this assymetric calling convention to other
locking primitives that all take 'flags' as a value.
[spin_lock_irqsave(), etc.]

so what's the point really? It sure does not make actual usage more
readable. If we switched _all_ primitives to use flags as a pointer,
that might make sense, in theory. (but it would also be hugely invasive,
with not much upside with tons of downside like years of migration
fallout and having to rewrite hundreds of kernel hacking books ;-) )

Ingo


\
 
 \ /
  Last update: 2008-08-16 15:49    [from the cache]
©2003-2011 Jasper Spaans