--8323328-648550002-1011533344=:7972
Content-Type: TEXT/PLAIN; charset=US-ASCII
the attached, bigger patch cleans up a particular aspect of scheduler
initialization that is the source of two unclean pieces of code within the
timer interrupt:
in idle_tick():
if ((jiffies % IDLE_REBALANCE_TICK) ||
likely(this_rq()->curr == NULL))
return;
in scheduler_tick():
if (p == rq->idle || !rq->idle)
return idle_tick();
both the 'this_rq()->curr == NULL' and '!rq->idle' tests are only there to
fix a temporary bootup-only situation where the idle threads are not
initialized yet.
the source of the problem is that idle thread initialization on SMP is not
'atomic'. Eg., on x86 the idle threads first do timer calibration, for
which period of time it's possible for timer interrupts to arrive on that
(partly initialized) CPU.
the attached patch solves this problem by splitting up init_idle() into
two parts: init_idle() and idle_startup_done(). After init_idle() is
called, it's possible to receive timer interrupts on a CPU. But schedule()
can only be called after all idle threads have done idle_startup_done().
Ingo
--8323328-648550002-1011533344=:7972
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="idle-thread-fixes-2.5.3-pre2-A1"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.33.0201201429040.7972@localhost.localdomain>
Content-Description:
Content-Disposition: attachment; filename="idle-thread-fixes-2.5.3-pre2-A1"
LS0tIGxpbnV4L2luaXQvbWFpbi5jLm9yaWcJU3VuIEphbiAyMCAxMTozNjow
NSAyMDAyDQorKysgbGludXgvaW5pdC9tYWluLmMJU3VuIEphbiAyMCAxMToz
ODo1OSAyMDAyDQpAQCAtMjkwLDggKzI5MCw2IEBADQogZXh0ZXJuIHZvaWQg
c2V0dXBfYXJjaChjaGFyICoqKTsNCiBleHRlcm4gdm9pZCBjcHVfaWRsZSh2
b2lkKTsNCiANCi11bnNpZ25lZCBsb25nIHdhaXRfaW5pdF9pZGxlOw0KLQ0K
ICNpZm5kZWYgQ09ORklHX1NNUA0KIA0KICNpZmRlZiBDT05GSUdfWDg2X0xP
Q0FMX0FQSUMNCkBAIC0zMDUsNiArMzAzLDE2IEBADQogDQogI2Vsc2UNCiAN
CitzdGF0aW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t
NDcwLDggKzQ3MSw4IEBADQogCSAqIHRoZSBsb2NhbCBUTEJzIHRvby4NCiAJ
ICovDQogCWxvY2FsX2ZsdXNoX3RsYigpOw0KKwlpZGxlX3N0YXJ0dXBfZG9u
ZSgpOw0KIA0KLQlpbml0X2lkbGUoKTsNCiAJcmV0dXJuIGNwdV9pZGxlKCk7
DQogfQ0KIA0K
--8323328-648550002-1011533344=:7972--
-
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/