Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1726715

Re: [PATCH] Workqueue lockup: Circular dependency in threads

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] Workqueue lockup: Circular dependency in threads
Date 2017-09-05 15:30 +0200
Message-ID <umm5r-38R-3@gated-at.bofh.it> (permalink)
References <ukbHb-yr-3@gated-at.bofh.it> <ukxy2-65y-33@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hello,

On Thu, Aug 31, 2017 at 06:43:56PM +0530, Prateek Sood wrote:
> > 6) cpuset_mutex is acquired by task init:1 and is waiting for cpuhotplug lock.

Yeah, this is the problematic one.

> > We can reorder the sequence of locks as in the below diff to avoid this
> > deadlock. But I am looking for inputs/better solution to fix this deadlock.
> > 
> > ---
> > diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> >  /**
> >   * update_tasks_cpumask - Update the cpumasks of tasks in the cpuset.
> >   * @cs: the cpuset in which each task's cpus_allowed mask needs to be changed
> > @@ -930,7 +946,7 @@ static void update_cpumasks_hier(struct cpuset *cs, struct cpumask *new_cpus)
> >  	rcu_read_unlock();
> >  
> >  	if (need_rebuild_sched_domains)
> > -		rebuild_sched_domains_locked();
> > +		rebuild_sched_domains_unlocked()(without taking cpuhotplug.lock)
> >  }
> >  
> >  /**
> > @@ -1719,6 +1735,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
> > +	get_online_cpus();
> >  	mutex_lock(&cpuset_mutex);
> >  	if (!is_cpuset_online(cs))
> >  		goto out_unlock;
> > @@ -1744,6 +1761,7 @@ static ssize_t cpuset_write_resmask(struct kernfs_open_file *of,
> >  	mutex_unlock(&cpuset_mutex);
> > +	put_online_cpus();
> >  	kernfs_unbreak_active_protection(of->kn);
> >  	css_put(&cs->css);
> >  	flush_workqueue(cpuset_migrate_mm_wq);
> > 

And the patch looks good to me.  Can you please format the patch with
proper description and sob?

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] Workqueue lockup: Circular dependency in threads Prateek Sood <prsood@codeaurora.org> - 2017-08-30 16:00 +0200
  Re: [PATCH] Workqueue lockup: Circular dependency in threads Prateek Sood <prsood@codeaurora.org> - 2017-08-31 15:20 +0200
    Re: [PATCH] Workqueue lockup: Circular dependency in threads Tejun Heo <tj@kernel.org> - 2017-09-05 15:30 +0200
      Re: [PATCH] Workqueue lockup: Circular dependency in threads Prateek Sood <prsood@codeaurora.org> - 2017-09-06 13:20 +0200

csiph-web