From: "Peter T. Breuer" <ptb@inv.it.uc3m.es>
To: Willy Tarreau <willy@w.ods.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: OOPS: 2.6.16-rc6 cpufreq_conservative
Date: Mon, 20 Mar 2006 09:22:08 +0100 [thread overview]
Message-ID: <200603200822.k2K8M8i29761@inv.it.uc3m.es> (raw)
In-Reply-To: <20060320061212.GG21493@w.ods.org>
In article <20060320061212.GG21493@w.ods.org> you wrote:
> 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.
> #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
While that's slightly wrong (needs a closing } supplied by the user), it
does inspire me to point out that one can put the skips in the ordinary
statement part of the for and use the if else idea to make sure that the
for needs just one statement following (i.e. no dangling } supplied by
the user)
#define for_each_cpu_mask(cpu, mask) \
for ((cpu) = 0; (cpu) < NR_CPUS; (cpu)++) \
if (!((mask).bits[0] >> (cpu)) { \
break; \
} else if (!((mask).bits[0] >> (cpu)) & 1) { \
continue; \
} else
I expect common subexpression optimization in the compiler to remove the
repetition here. If not, somebody else can think about it!
Peter
next prev parent reply other threads:[~2006-03-20 8:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-18 20:25 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
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 [this message]
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=200603200822.k2K8M8i29761@inv.it.uc3m.es \
--to=ptb@inv.it.uc3m.es \
--cc=linux-kernel@vger.kernel.org \
--cc=willy@w.ods.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
all inboxes | Powered by JetHome®