Re: [PATCH 10/10] sched/fair: Implement an EEVDF like policy
From: Mike Galbraith
Date: Wed Mar 08 2023 - 08:39:30 EST
On Wed, 2023-03-08 at 09:39 +0100, Mike Galbraith wrote:
>
> Curiosity got the best of me...
Remember this little bugger, allegedly distilled from a real
application control thread starvation issue?
6.3.0.g8ca09d5-master
homer:/root # time taskset -c 3 starve
expecting to receive 10000000 signals
real 0m24.424s
user 0m4.468s
sys 0m18.957s
6.3.0.g8ca09d5-eevdf
homer:/root # time taskset -c 3 starve
expecting to receive 10000000 signals
zzzzzz
^C
real 15m24.115s
user 0m3.078s
sys 0m0.000s
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
volatile unsigned long loop;
void handler(int n)
{
if (loop > 0)
--loop;
}
static int child(void)
{
pid_t ppid = getppid();
sleep(1);
while (1)
kill(ppid, SIGUSR1);
return 0;
}
int main(int argc, char **argv)
{
pid_t child_pid;
int r;
loop = argc > 1 ? strtoul(argv[1], NULL, 10) : 10000000;
printf("expecting to receive %lu signals\n", loop);
if ((child_pid = fork()) == 0)
exit(child());
signal(SIGUSR1, handler);
while (loop)
sleep(1);
r = kill(child_pid, SIGTERM);
waitpid(child_pid, NULL, 0);
return 0;
}