Re: [PATCH] sched: staircase deadline misc fixes

Con Kolivas
2007-04-03T02:38:12Z

[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]

On Thursday 29 March 2007 15:50, Mike Galbraith wrote:
> On Thu, 2007-03-29 at 09:44 +1000, Con Kolivas wrote:
> + * This contains a bitmap for each dynamic priority level with empty slots
> + * for the valid priorities each different nice level can have. It allows
> + * us to stagger the slots where differing priorities run in a way that
> + * keeps latency differences between different nice levels at a minimum.
> + * ie, where 0 means a slot for that priority, priority running from left
> to + * right:
> + * nice -20 0000000000000000000000000000000000000000
> + * nice -10 1001000100100010001001000100010010001000
> + * nice 0 0101010101010101010101010101010101010101
> + * nice 5 1101011010110101101011010110101101011011
> + * nice 10 0110111011011101110110111011101101110111
> + * nice 15 0111110111111011111101111101111110111111
> + * nice 19 1111111111111111111011111111111111111111

Try two instances of chew.c at _differing_ nice levels on one cpu on mainline,
and then SD. This is why you can't renice X on mainline.

> -Mike

--
-ck

[-- Attachment #2: chew.c --]
[-- Type: text/x-csrc, Size: 1027 bytes --]

/*
* orignal idea by Chris Friesen. Thanks.
*/

#include <stdio.h>
#include <sys/time.h>
#include <sys/resource.h>

#define THRESHOLD_USEC 2000

unsigned long long stamp()
{
struct timeval tv;
gettimeofday(&tv, 0);
return (unsigned long long) tv.tv_usec + ((unsigned long long) tv.tv_sec)*1000000;
}

int main()
{
unsigned long long thresh_ticks = THRESHOLD_USEC;
unsigned long long cur,last;
struct timespec ts;

sched_rr_get_interval(0, &ts);
printf("pid %d, prio %3d, interval of %d nsec\n", getpid(), getpriority(PRIO_PROCESS, 0), ts.tv_nsec);

last = stamp();
while(1) {
cur = stamp();
unsigned long long delta = cur-last;
if (delta > thresh_ticks) {
printf("pid %d, prio %3d, out for %4llu ms\n", getpid(), getpriority(PRIO_PROCESS, 0), delta/1000);
cur = stamp();
}
last = cur;
}

return 0;
}