From: Ingo Molnar <mingo@elte.hu>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: torvalds@osdl.org, akpm@osdl.org, linux-kernel@vger.kernel.org,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH] De-macro spin_trylock_irq, spin_trylock_irqsave, write_trylock_irqsave
Date: Sat, 16 Aug 2008 15:46:00 +0200 [thread overview]
Message-ID: <20080816134600.GC20652@elte.hu> (raw)
In-Reply-To: <20080816095951.GA19926@martell.zuzino.mipt.ru>
* 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
next prev parent reply other threads:[~2008-08-16 13:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-16 9:59 [PATCH] De-macro spin_trylock_irq, spin_trylock_irqsave, write_trylock_irqsave Alexey Dobriyan
2008-08-16 13:31 ` Jiri Slaby
2008-08-16 20:48 ` Alexey Dobriyan
2008-08-16 21:21 ` Linus Torvalds
2008-08-17 7:52 ` David Miller
2008-08-16 13:46 ` Ingo Molnar [this message]
2008-08-16 21:04 ` Alexey Dobriyan
2008-08-16 21:18 ` Johannes Weiner
2008-08-17 9:31 ` Ingo Molnar
2008-08-17 12:30 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080816134600.GC20652@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=adobriyan@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox