[sched] [patch] interactiveness-improvements-2.5.3-pre2-A0

Ingo Molnar (mingo@elte.hu)
Sun, 20 Jan 2002 14:51:41 +0100 (CET)


This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
Send mail to mime@docserver.cac.washington.edu for more info.

--8323328-1042897886-1011534701=:7972
Content-Type: TEXT/PLAIN; charset=US-ASCII

the attached patch cleans up and improves the interactiveness code in
2.5.3-pre2 further. It's the interactiveness code from -J2 that got good
interactiveness feedback.

the patch changes three aspects of interactiveness:

1) the bonus/penalty of SCHED_OTHER tasks has been reduced by 10%, from
[-20 ... +20] to [ -18 ... +19 ]. The reason is two-fold:

- protect nice -20 interactive tasks from default-nicelevel
interactive tasks. This improves audio playback quality, making
nice -20 a more protected priority domain.

- protect default-nicelevel CPU hogs from nice +19 CPU hogs. This
means that nice +19 SETI jobs will not distrupt the timeslices
of normal kernel compilation jobs.

2) improve the definition of TASK_INTERACTIVE:

- the bottom 25% of the priority range is for 'unconditionally
interactive tasks'.

- the top 25% of the priority range is for 'unconditionally CPU-hog
tasks'

- the middle 50% is for 'conditionally interactive' tasks.
Interactivity depends on whether a task has 'won' at least 3
priority levels due to being interactive, relative to its default
priority level.

this change has the following effect: tasks with negative nice values it's
easier to be interactive, and harder to become rated as CPU hogs. For
tasks with positive nice values it's much harder to become rated as
interactive, and easy to be rated as CPU hogs. Tasks on the default
nice-level have none of the 'prejudice' ratings, it depends on its actual
bonus whether it's rated as interactive or not.

3) newly forked children lose 20% of their parent's priority and sleep
average.

this change has a positive effect on starting xterms during high-load
situations. The process that starts the xterm is usually a heavily
interactive task. But the first xterm process often fork()s a second
process, which was penalized too heavily in the previous fork_wakeup code,
causing that process to get into the 'CPU-bound hell', causing massive
delays of xterm startups. This rule is a purely experimental value, but it
expresses the basic concept correctly as well: we want children to get
some of the benefits of their parents, but we also want them to not get
*all* of the benefits, and work to achieve their own bonuses.

Ingo

--8323328-1042897886-1011534701=:7972
Content-Type: TEXT/PLAIN; charset=US-ASCII; name="interactiveness-improvements-2.5.3-pre2-A0"
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.33.0201201451410.7972@localhost.localdomain>
Content-Description:
Content-Disposition: attachment; filename="interactiveness-improvements-2.5.3-pre2-A0"

LS0tIGxpbnV4L2tlcm5lbC9zY2hlZC5jLm9yaWcJU3VuIEphbiAyMCAxMToz
OTo0MSAyMDAyDQorKysgbGludXgva2VybmVsL3NjaGVkLmMJU3VuIEphbiAy
MCAxMTozOTo1NyAyMDAyDQpAQCAtOTUsMjEgKzk1LDI2IEBADQogfQ0KIA0K
IC8qDQotICogQSB0YXNrIGlzICdoZWF2aWx5IGludGVyYWN0aXZlJyBpZiBp
dCBoYXMgcmVhY2hlZCB0aGUNCi0gKiBib3R0b20gMjUlIG9mIHRoZSBTQ0hF
RF9PVEhFUiBwcmlvcml0eSByYW5nZSAtIGluIHRoaXMNCisgKiBBIHRhc2sg
aXMgJ2hlYXZpbHkgaW50ZXJhY3RpdmUnIGlmIGl0IGVpdGhlciBoYXMgcmVh
Y2hlZCB0aGUNCisgKiBib3R0b20gMjUlIG9mIHRoZSBTQ0hFRF9PVEhFUiBw
cmlvcml0eSByYW5nZSwgb3IgaWYgaXQgaXMgYmVsb3cNCisgKiBpdHMgZGVm
YXVsdCBwcmlvcml0eSBieSBhdCBsZWFzdCAzIHByaW9yaXR5IGxldmVscy4g
SW4gdGhpcw0KICAqIGNhc2Ugd2UgZmF2b3IgaXQgYnkgcmVpbnNlcnRpbmcg
aXQgb24gdGhlIGFjdGl2ZSBhcnJheSwNCiAgKiBldmVuIGFmdGVyIGl0IGV4
cGlyZWQgaXRzIGN1cnJlbnQgdGltZXNsaWNlLg0KICAqDQorICogQSB0YXNr
IGlzIGEgJ0NQVSBob2cnIGlmIGl0J3MgZWl0aGVyIGluIHRoZSB1cHBlciAy
NSUgb2YgdGhlDQorICogU0NIRURfT1RIRVIgcHJpb3JpdHkgcmFuZ2UsIG9y
IGlmJ3Mgbm90IGFu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c7DQogCWlmICgh
cnRfdGFzayhwKSkgew0KLQkJcC0+cHJpbyArPSBNQVhfVVNFUl9QUklPLzEw
Ow0KLQkJaWYgKHAtPnByaW8gPiBNQVhfUFJJTy0xKQ0KLQkJCXAtPnByaW8g
PSBNQVhfUFJJTy0xOw0KKwkJcC0+c2xlZXBfYXZnID0gKHAtPnNsZWVwX2F2
ZyAqIDQpIC8gNTsNCisJCXAtPnByaW8gPSBlZmZlY3RpdmVfcHJpbyhwKTsN
CiAJfQ0KIAlzcGluX2xvY2tfaXJxKCZycS0+bG9jayk7DQogCWFjdGl2YXRl
X3Rhc2socCwgcnEpOw0K
--8323328-1042897886-1011534701=: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/