Re: [PATCH 00/15] sched: EEVDF and latency-nice and/or slice-attr

From: Peter Zijlstra
Date: Thu Oct 05 2023 - 11:16:07 EST


On Thu, Oct 05, 2023 at 04:14:08PM +0200, Peter Zijlstra wrote:

> --- eevdf.c.orig 2023-10-05 16:11:35.821114320 +0200
> +++ eevdf.c 2023-10-05 16:08:38.387080327 +0200
> @@ -7,6 +7,7 @@
> #include <sys/param.h>
>
> bool eligible = true;
> +bool bias = false;
> unsigned long V_lim = 20;
>
> struct entity {
> @@ -79,16 +80,17 @@
>
> struct entity *pick_entity(int nr, struct entity *es)
> {
> - unsigned long W = 0, V = 0;
> + unsigned long W = 0, V = 0, R = 0;
> struct entity *e = NULL;
>
> for (int i = 0; i < nr; i++) {
> V += es[i].weight * es[i].vruntime;
> + R += es[i].request;

* 1024

Also, average seems too much, one large value lifts it too easily.

Need to come up with something better :/

> W += es[i].weight;
> }
>
> for (int i = 0; i < nr; i++) {
> - if (eligible && W*es[i].vruntime > V)
> + if (eligible && W*es[i].vruntime > V + (bias * R))
> continue;
>
> if (!e || es[i].vdeadline < e->vdeadline)
> @@ -169,10 +171,14 @@
>
> const int N = sizeof(es) / sizeof(es[0]);
>
> - while ((opt = getopt(argc, argv, "nv:e:")) != -1) {
> + while ((opt = getopt(argc, argv, "bnv:e:")) != -1) {
> unsigned int v,w,r;
>
> switch (opt) {
> + case 'b':
> + bias = true;
> + break;
> +
> case 'n':
> eligible = false;
> break;