Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1453163 > unrolled thread
| Started by | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| First post | 2016-08-01 14:00 +0200 |
| Last post | 2016-08-01 15:00 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [RFC PATCH 1/4] Minimally invasive deadline wrap-around bugfix for SCHED_DEADLINE cpu heap Juri Lelli <juri.lelli@arm.com> - 2016-08-01 14:00 +0200
Re: [RFC PATCH 1/4] Minimally invasive deadline wrap-around bugfix for SCHED_DEADLINE cpu heap Juri Lelli <juri.lelli@arm.com> - 2016-08-01 15:00 +0200
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2016-08-01 14:00 +0200 |
| Subject | Re: [RFC PATCH 1/4] Minimally invasive deadline wrap-around bugfix for SCHED_DEADLINE cpu heap |
| Message-ID | <s1k2Z-5PD-17@gated-at.bofh.it> |
Hi,
On 19/07/16 11:44, Tommaso Cucinotta wrote:
> Current code in cpudeadline.c has a bug in re-heapifying when adding a
> new element at the end of the heap, because a deadline value of 0 is
> temporarily set in the new elem, then cpudl_change_key() is called
> with the actual elem deadline as param. However, the function compares
> the new deadline to set with the one previously in the elem, which is
> 0. So, if current absolute deadlines grew so much to have negative
> values as s64, the comparison in cpudl_change_key() makes the wrong
> decision. Instead, as from dl_time_before(), the kernel should handle
> correctly abs deadlines wrap-arounds.
>
> This patch fixes the problem with a minimally invasive change that
> forces cpudl_change_key() to heapify up in this case.
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Juri Lelli <juri.lelli@arm.com>
> Cc: Luca Abeni <luca.abeni@unitn.it>
> Reviewed-by: Luca Abeni <luca.abeni@unitn.it>
> Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
> ---
> kernel/sched/cpudeadline.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> index 5be5882..d418449 100644
> --- a/kernel/sched/cpudeadline.c
> +++ b/kernel/sched/cpudeadline.c
> @@ -168,7 +168,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid)
>
> if (old_idx == IDX_INVALID) {
> cp->size++;
> - cp->elements[cp->size - 1].dl = 0;
> + cp->elements[cp->size - 1].dl = dl;
> cp->elements[cp->size - 1].cpu = cpu;
> cp->elements[cpu].idx = cp->size - 1;
> cpudl_change_key(cp, cp->size - 1, dl);
Looks good. I'd only change the subject to something like:
sched/deadline: Wrap-around bugfix for cpu heap
Best,
- Juri
[toc] | [next] | [standalone]
| From | Juri Lelli <juri.lelli@arm.com> |
|---|---|
| Date | 2016-08-01 15:00 +0200 |
| Message-ID | <s1kZ3-6qC-5@gated-at.bofh.it> |
| In reply to | #1453163 |
On 01/08/16 12:43, Juri Lelli wrote:
> Hi,
>
> On 19/07/16 11:44, Tommaso Cucinotta wrote:
> > Current code in cpudeadline.c has a bug in re-heapifying when adding a
> > new element at the end of the heap, because a deadline value of 0 is
> > temporarily set in the new elem, then cpudl_change_key() is called
> > with the actual elem deadline as param. However, the function compares
> > the new deadline to set with the one previously in the elem, which is
> > 0. So, if current absolute deadlines grew so much to have negative
> > values as s64, the comparison in cpudl_change_key() makes the wrong
> > decision. Instead, as from dl_time_before(), the kernel should handle
> > correctly abs deadlines wrap-arounds.
> >
> > This patch fixes the problem with a minimally invasive change that
> > forces cpudl_change_key() to heapify up in this case.
> >
> > Cc: Peter Zijlstra <peterz@infradead.org>
> > Cc: Juri Lelli <juri.lelli@arm.com>
> > Cc: Luca Abeni <luca.abeni@unitn.it>
> > Reviewed-by: Luca Abeni <luca.abeni@unitn.it>
> > Signed-off-by: Tommaso Cucinotta <tommaso.cucinotta@sssup.it>
> > ---
> > kernel/sched/cpudeadline.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
> > index 5be5882..d418449 100644
> > --- a/kernel/sched/cpudeadline.c
> > +++ b/kernel/sched/cpudeadline.c
> > @@ -168,7 +168,7 @@ void cpudl_set(struct cpudl *cp, int cpu, u64 dl, int is_valid)
> >
> > if (old_idx == IDX_INVALID) {
> > cp->size++;
> > - cp->elements[cp->size - 1].dl = 0;
> > + cp->elements[cp->size - 1].dl = dl;
> > cp->elements[cp->size - 1].cpu = cpu;
> > cp->elements[cpu].idx = cp->size - 1;
> > cpudl_change_key(cp, cp->size - 1, dl);
>
> Looks good. I'd only change the subject to something like:
>
> sched/deadline: Wrap-around bugfix for cpu heap
>
and please remove linux-dl mailing list from future postings. It's
subscribers only, and practically dead (AFAIK).
Thanks,
- Juri
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web