lkml.org 
[lkml]   [2002]   [Jan]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch] [sched] exit-penalty fix, 2.5.3-pre5

the attached patch fixes the EXIT_WEIGHT code to only 'punish' tasks,
never reward them. (it would be a way too easy method to boost CPU hogs
unfairly via starting up bogus threads that exit() after a few seconds.)

Ingo

diff -rNu linux/kernel/exit.c linux/kernel/exit.c
--- linux/kernel/exit.c Mon Jan 28 15:23:50 2002
+++ linux/kernel/exit.c Mon Jan 28 15:24:43 2002
@@ -59,8 +59,9 @@
current->time_slice += p->time_slice;
if (current->time_slice > MAX_TIMESLICE)
current->time_slice = MAX_TIMESLICE;
- current->sleep_avg = (current->sleep_avg*EXIT_WEIGHT + p->sleep_avg) /
- (EXIT_WEIGHT + 1);
+ if (p->sleep_avg < current->sleep_avg)
+ current->sleep_avg = (current->sleep_avg * EXIT_WEIGHT +
+ p->sleep_avg) / (EXIT_WEIGHT + 1);
__restore_flags(flags);

p->pid = 0;
-
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 13:15    [W:0.135 / U:0.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site