From: Willy Tarreau <willy@w.ods.org>
To: Lahti Oy <rlahti@netikka.fi>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched.c
Date: Tue, 27 Aug 2002 20:33:19 +0200 [thread overview]
Message-ID: <20020827183319.GA28513@alpha.home.local> (raw)
In-Reply-To: <000b01c24df5$aacc7ed0$d20a5f0a@deldaran>
On Tue, Aug 27, 2002 at 09:15:03PM +0300, Lahti Oy wrote:
> - for (i = 0; i < NR_CPUS; i++)
> + for (i = NR_CPUS; i; i--)
> sum += cpu_rq(i)->nr_running;
you change isn't equivalent : previously, we called cpu_rq() for
0..NR_CPUS-1, and now you call it for 1..NR_CPUS.
You should have written :
+ for (i = NR_CPUS - 1; i>=0; i--)
which might still be a win towards the former version.
But of course, this is only valid if i is SIGNED, and it isn't here.
Another valid form which would work with unsigned int is :
+ for (i = NR_CPUS; i--; )
but I'm not sure it will save some cycles because increments/decrements
within conditions are not always well optimizable.
Same comments for other locations.
Cheers,
Willy
next prev parent reply other threads:[~2002-08-27 18:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-27 18:15 [PATCH] sched.c Lahti Oy
2002-08-27 18:33 ` Willy Tarreau [this message]
2002-08-27 18:35 ` Andrew Morton
2002-08-28 0:13 ` Daniel Phillips
2002-08-28 0:41 ` Andreas Dilger
2002-08-28 0:51 ` Daniel Phillips
2002-08-28 0:44 ` Stephen C. Biggs
2002-08-28 0:47 ` Daniel Phillips
2002-08-28 0:59 ` Stephen C. Biggs
2002-08-28 13:45 ` Thunder from the hill
2002-08-28 6:47 ` Rusty Russell
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=20020827183319.GA28513@alpha.home.local \
--to=willy@w.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rlahti@netikka.fi \
/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