From: Alfred Rossi <alfredr@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: "SMP" scheduler_tick confusion
Date: Mon, 13 Sep 2004 11:26:04 -0400 [thread overview]
Message-ID: <3e3b490d040913082648bcaf3@mail.gmail.com> (raw)
Since scheduler_tick handles time-slice maintenance in the kernel, I
was under the impression that with HZ (asm/param.h) frequency each cpu
in an SMP scenario should run scheduler_tick shortly after the timer
interrupt fires. I believe this should be the case since each cpu
could simultaneously be executing a separate task, each task would
need to have it's time slices adjusted. This does not appear to be
what actually happens. I looked around the source for a bit, and
couldn't find anything to convince me that each cpu runs
scheduler_tick independently, so I decided to perform a little
experiment. It's ugly, I know, but I placed a printk in scheduler tick
with the cpu's id. sampled the output from scheduler_tick for 1
second, and then analyzed the remaining file. With a HZ of 1000 and 2
Cpu's I expected to at least have very close to 2000 characters, with
a near equal number of 1's and 0's. Since the timer interrupt was
generated by the same timer for both cpu's I also expected to see a
regular pattern with an even distribution of 1's and 0's. Instead what
I found is that I had 996 characters (close enough to HZ, wish my
timing was better), and a random pattern of 1's and 0's, each
composing roughly half of the overall file. Which gives me the
impression that the first available cpu is handling the interrupt.
Wouldn't that throw off the intended functioning of scheduler_tick?
The machine this was tested on, I must note, was not a true SMP but a
P4 with HT enabled. Could someone shed some light on this? What am I
missing?
Kind Regards,
Alfred Rossi
reply other threads:[~2004-09-13 15:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=3e3b490d040913082648bcaf3@mail.gmail.com \
--to=alfredr@gmail.com \
--cc=linux-kernel@vger.kernel.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