From: Willy Tarreau <willy@w.ods.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>,
kernel-stuff@comcast.net, linux-kernel@vger.kernel.org,
alex-kernel@digriz.org.uk, jun.nakajima@intel.com,
davej@redhat.com, viro@ftp.linux.org.uk
Subject: Re: OOPS: 2.6.16-rc6 cpufreq_conservative
Date: Mon, 20 Mar 2006 07:12:13 +0100 [thread overview]
Message-ID: <20060320061212.GG21493@w.ods.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0603191125220.3826@g5.osdl.org>
On Sun, Mar 19, 2006 at 11:33:17AM -0800, Linus Torvalds wrote:
> Of course, I shouldn't say "works", since it is still totally untested. It
> _looks_ good, and that statement expression usage is just _so_ ugly it's
> cute.
>
> Linus
At least, you could have moved the macro closer to where it's used.
It's very uncommon to break a statement within an if condition, and
it's not expected that the macro you're calling does a break under
you. It took me several minutes to understand precisely how this
works. Now it seems trivial, but I guess that at 3am I would have
gone to bed instead.
One first enhancement would be to make it easier to understand
by putting it closer to its user :
#elif NR_CPUS > 1
#define check_for_each_cpu(cpu, mask) \
({ unsigned long __bits = (mask).bits[0] >> (cpu); if (!__bits) break; __bits & 1; })
#define for_each_cpu_mask(cpu, mask) \
for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) \
if (!check_for_each_cpu(cpu, mask)) \
continue; \
else
Now, does removing the macro completely change the output code ?
I think that if something written like this produces the same
code, it would be easier to read :
#define for_each_cpu_mask(cpu, mask) \
for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) { \
unsigned long __bits = (mask).bits[0] >> (cpu); \
if (!__bits) \
break; \
if (!__bits & 1) \
continue; \
else
Regards,
Willy
next prev parent reply other threads:[~2006-03-20 6:12 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-18 20:25 OOPS: 2.6.16-rc6 cpufreq_conservative Parag Warudkar
2006-03-18 21:40 ` Linus Torvalds
2006-03-18 22:09 ` Parag Warudkar
2006-03-18 23:12 ` Linus Torvalds
2006-03-18 22:26 ` Parag Warudkar
2006-03-19 0:53 ` Andrew Morton
2006-03-19 2:38 ` Linus Torvalds
2006-03-19 5:08 ` Paul Jackson
2006-03-19 17:43 ` Linus Torvalds
2006-03-19 18:46 ` Linus Torvalds
2006-03-19 19:02 ` Linus Torvalds
2006-03-19 19:33 ` Linus Torvalds
2006-03-19 19:40 ` Al Viro
2006-03-19 20:01 ` Linus Torvalds
2006-03-19 20:31 ` Linus Torvalds
2006-03-19 20:47 ` Andrew Morton
2006-03-19 22:18 ` Linus Torvalds
2006-03-19 22:35 ` Andrew Morton
2006-03-19 22:55 ` Linus Torvalds
2006-03-19 22:46 ` Linus Torvalds
2006-03-19 23:04 ` Andrew Morton
2006-03-19 20:57 ` Parag Warudkar
2006-03-20 6:12 ` Willy Tarreau [this message]
2006-03-20 6:26 ` Linus Torvalds
2006-03-20 7:18 ` Willy Tarreau
2006-03-21 6:32 ` Willy Tarreau
2006-03-20 8:22 ` Peter T. Breuer
2006-03-19 6:34 ` Parag Warudkar
2006-03-19 12:00 ` Alexander Clouter
2006-03-19 14:06 ` Parag Warudkar
2006-03-19 17:34 ` Alexander Clouter
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=20060320061212.GG21493@w.ods.org \
--to=willy@w.ods.org \
--cc=akpm@osdl.org \
--cc=alex-kernel@digriz.org.uk \
--cc=davej@redhat.com \
--cc=jun.nakajima@intel.com \
--cc=kernel-stuff@comcast.net \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.uk \
/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