lkml.org 
[lkml]   [2004]   [Sep]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subject"SMP" scheduler_tick confusion
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:06    [W:0.048 / U:1.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site