Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1456891 > unrolled thread
| Started by | Leo Yan <leo.yan@linaro.org> |
|---|---|
| First post | 2016-08-05 08:40 +0200 |
| Last post | 2016-08-05 10:40 +0200 |
| Articles | 4 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] sched/fair: refine maximum periods for decay_load Leo Yan <leo.yan@linaro.org> - 2016-08-05 08:40 +0200
Re: [PATCH] sched/fair: refine maximum periods for decay_load Vincent Guittot <vincent.guittot@linaro.org> - 2016-08-05 10:00 +0200
Re: [PATCH] sched/fair: refine maximum periods for decay_load Leo Yan <leo.yan@linaro.org> - 2016-08-05 10:20 +0200
Re: [PATCH] sched/fair: refine maximum periods for decay_load Vincent Guittot <vincent.guittot@linaro.org> - 2016-08-05 10:40 +0200
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Date | 2016-08-05 08:40 +0200 |
| Subject | [PATCH] sched/fair: refine maximum periods for decay_load |
| Message-ID | <s2GXv-3Uf-7@gated-at.bofh.it> |
In current code, decay_load() will consider to set load value to zero
after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0.
Kernel can support maximum number of processes and threads to 2^29 and
set task with highest priority with nice=-20 (weight = 88761). So in
worst case, one CPU may have maximum load value is:
max_load = 2^29 * 88761 < 2^46
In theory after pass 46 periods we can ensure load value will be decayed
to zero. So this patch is to change maximum periods from 64 to 48.
Signed-off-by: Leo Yan <leo.yan@linaro.org>
---
kernel/sched/fair.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e342159..55cb134 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n)
if (!n)
return val;
- else if (unlikely(n > LOAD_AVG_PERIOD * 63))
+ else if (unlikely(n > LOAD_AVG_PERIOD * 47))
return 0;
/* after bounds checking we can collapse to 32-bit */
--
1.9.1
[toc] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2016-08-05 10:00 +0200 |
| Message-ID | <s2IcV-4Ek-7@gated-at.bofh.it> |
| In reply to | #1456891 |
Hi Leo, On 5 August 2016 at 08:34, Leo Yan <leo.yan@linaro.org> wrote: > > In current code, decay_load() will consider to set load value to zero > after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0. > > Kernel can support maximum number of processes and threads to 2^29 and > set task with highest priority with nice=-20 (weight = 88761). So in > worst case, one CPU may have maximum load value is: > > max_load = 2^29 * 88761 < 2^46 > > In theory after pass 46 periods we can ensure load value will be decayed > to zero. So this patch is to change maximum periods from 64 to 48. > > Signed-off-by: Leo Yan <leo.yan@linaro.org> > --- > kernel/sched/fair.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index e342159..55cb134 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n) > > if (!n) > return val; > - else if (unlikely(n > LOAD_AVG_PERIOD * 63)) > + else if (unlikely(n > LOAD_AVG_PERIOD * 47)) In the equation above, you use 46 then you mentioned : "change maximum periods from 64 to 48." and finally you use 47. > return 0; > > /* after bounds checking we can collapse to 32-bit */ > -- > 1.9.1 >
[toc] | [prev] | [next] | [standalone]
| From | Leo Yan <leo.yan@linaro.org> |
|---|---|
| Date | 2016-08-05 10:20 +0200 |
| Message-ID | <s2Iwh-4ZL-5@gated-at.bofh.it> |
| In reply to | #1456923 |
Hi Vincent,
Thanks for review.
On Fri, Aug 05, 2016 at 09:56:46AM +0200, Vincent Guittot wrote:
> Hi Leo,
>
> On 5 August 2016 at 08:34, Leo Yan <leo.yan@linaro.org> wrote:
> >
> > In current code, decay_load() will consider to set load value to zero
> > after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0.
> >
> > Kernel can support maximum number of processes and threads to 2^29 and
> > set task with highest priority with nice=-20 (weight = 88761). So in
> > worst case, one CPU may have maximum load value is:
> >
> > max_load = 2^29 * 88761 < 2^46
> >
> > In theory after pass 46 periods we can ensure load value will be decayed
> > to zero. So this patch is to change maximum periods from 64 to 48.
> >
> > Signed-off-by: Leo Yan <leo.yan@linaro.org>
> > ---
> > kernel/sched/fair.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > index e342159..55cb134 100644
> > --- a/kernel/sched/fair.c
> > +++ b/kernel/sched/fair.c
> > @@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n)
> >
> > if (!n)
> > return val;
> > - else if (unlikely(n > LOAD_AVG_PERIOD * 63))
> > + else if (unlikely(n > LOAD_AVG_PERIOD * 47))
>
> In the equation above, you use 46 then you mentioned : "change maximum
> periods from 64 to 48." and finally you use 47.
Sorry introduce confusion. I want to align to 16 so choose maximum
periods to 48, and due to condition is (n > LOAD_AVG_PERIOD * 47) so
it equeals to (n >= LOAD_AVG_PERIOD * 48).
Precisely I think the code should be:
else if (unlikely(n >= LOAD_AVG_PERIOD * 46))
Do you think this is okay?
> > return 0;
> >
> > /* after bounds checking we can collapse to 32-bit */
> > --
> > 1.9.1
> >
[toc] | [prev] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2016-08-05 10:40 +0200 |
| Message-ID | <s2IPD-561-1@gated-at.bofh.it> |
| In reply to | #1456939 |
On 5 August 2016 at 10:17, Leo Yan <leo.yan@linaro.org> wrote: > Hi Vincent, > > Thanks for review. > > On Fri, Aug 05, 2016 at 09:56:46AM +0200, Vincent Guittot wrote: >> Hi Leo, >> >> On 5 August 2016 at 08:34, Leo Yan <leo.yan@linaro.org> wrote: >> > >> > In current code, decay_load() will consider to set load value to zero >> > after passing 32*64 ms. So this means max_load * (0.5^64) ~= 0. >> > >> > Kernel can support maximum number of processes and threads to 2^29 and >> > set task with highest priority with nice=-20 (weight = 88761). So in >> > worst case, one CPU may have maximum load value is: >> > >> > max_load = 2^29 * 88761 < 2^46 >> > >> > In theory after pass 46 periods we can ensure load value will be decayed >> > to zero. So this patch is to change maximum periods from 64 to 48. >> > >> > Signed-off-by: Leo Yan <leo.yan@linaro.org> >> > --- >> > kernel/sched/fair.c | 2 +- >> > 1 file changed, 1 insertion(+), 1 deletion(-) >> > >> > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> > index e342159..55cb134 100644 >> > --- a/kernel/sched/fair.c >> > +++ b/kernel/sched/fair.c >> > @@ -2622,7 +2622,7 @@ static __always_inline u64 decay_load(u64 val, u64 n) >> > >> > if (!n) >> > return val; >> > - else if (unlikely(n > LOAD_AVG_PERIOD * 63)) >> > + else if (unlikely(n > LOAD_AVG_PERIOD * 47)) >> >> In the equation above, you use 46 then you mentioned : "change maximum >> periods from 64 to 48." and finally you use 47. > > Sorry introduce confusion. I want to align to 16 so choose maximum > periods to 48, and due to condition is (n > LOAD_AVG_PERIOD * 47) so > it equeals to (n >= LOAD_AVG_PERIOD * 48). > > Precisely I think the code should be: > else if (unlikely(n >= LOAD_AVG_PERIOD * 46)) > > Do you think this is okay? yes, this looks okay > >> > return 0; >> > >> > /* after bounds checking we can collapse to 32-bit */ >> > -- >> > 1.9.1 >> >
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web