lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 9 Jul 2015 08:15:49 +0200
From:	Stefan Ekenberg <stefan.ekenberg@...s.com>
To:	Yuyang Du <yuyang.du@...el.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Rabin Vincent <rabinv@...s.com>,
	Mike Galbraith <umgwanakikbuti@...il.com>,
	"mingo@...hat.com" <mingo@...hat.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Paul Turner <pjt@...gle.com>, Ben Segall <bsegall@...gle.com>,
	Morten Rasmussen <morten.rasmussen@....com>
Subject: Re: [PATCH?] Livelock in pick_next_task_fair() / idle_balance()

Hi,

I tested the patch on a setup with 7 devices, all running the same troublesome use-case in parallel (same use-case as we used to produce the crash dumps). This use-case was previously able to reproduce the problem about 21 times during 24 hours. After including the patch the setup ran perfectly for 48 hours. So to summarize, patch tested OK.

Tested-by: Stefan Ekenberg <stefan.ekenberg@...s.com>

On Mon, Jul 06, 2015 at 12:11:51AM +0200, Yuyang Du wrote:
> On Fri, Jul 03, 2015 at 06:39:28PM +0200, Peter Zijlstra wrote:
> > On Thu, Jul 02, 2015 at 07:25:11AM +0800, Yuyang Du wrote:
> > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> > > index 40a7fcb..f7cc1ef 100644
> > > --- a/kernel/sched/fair.c
> > > +++ b/kernel/sched/fair.c
> > > @@ -5898,6 +5898,10 @@ static int detach_tasks(struct lb_env *env)
> > >             return 0;
> > >
> > >     while (!list_empty(tasks)) {
> > > +
> > > +           if (env->idle == CPU_NEWLY_IDLE && env->src_rq->nr_running <= 1)
> >
> > Should we make that ->idle != CPU_NOT_IDLE ?
> 
> I think including CPU_IDLE is good.
> 
> --
> Subject: [PATCH] sched: Avoid pulling all tasks in idle balancing
> 
> In idle balancing where a CPU going idle pulls tasks from another CPU,
> a livelock may happen if the CPU pulls all tasks from another, makes
> it idle, and this iterates. So just avoid this.
> 
> Reported-by: Rabin Vincent <rabin.vincent@...s.com>
> Signed-off-by: Yuyang Du <yuyang.du@...el.com>
> ---
>  kernel/sched/fair.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 40a7fcb..769d591 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -5898,6 +5898,13 @@ static int detach_tasks(struct lb_env *env)
>                 return 0;
> 
>         while (!list_empty(tasks)) {
> +               /*
> +                * We don't want to steal all, otherwise we may be treated likewise,
> +                * which could at worst lead to a livelock crash.
> +                */
> +               if (env->idle != CPU_NOT_IDLE && env->src_rq->nr_running <= 1)
> +                       break;
> +
>                 p = list_first_entry(tasks, struct task_struct, se.group_node);
> 
>                 env->loop++;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists