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


Groups > linux.kernel > #1728045

Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock

From Boqun Feng <boqun.feng@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock
Date 2017-09-07 11:00 +0200
Message-ID <un0Pf-61N-3@gated-at.bofh.it> (permalink)
References <umYaK-4pA-33@gated-at.bofh.it> <umZq9-5em-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Sep 07, 2017 at 09:28:48AM +0200, Peter Zijlstra wrote:
> On Thu, Sep 07, 2017 at 11:34:12AM +0530, Prateek Sood wrote:
> > Remove circular dependency deadlock in a scenario where hotplug of CPU is
> > being done while there is updation in cgroup and cpuset triggered from
> > userspace.
> > 
> > Example scenario:
> > kworker/0:0 => kthreadd => init:729 => init:1 => kworker/0:0
> > 
> > kworker/0:0 - percpu_down_write(&cpu_hotplug_lock)  [held]
> >               flush(work)   [no high prio workqueue available on CPU]
> >               wait_for_completion()

Hi Prateek,

so this is:

	_cpu_down():
	  cpus_write_lock(); // percpu_down_write(&cpu_hotlug_lock)
	  cpuhp_invoke_callbacks():
	    workqueue_offine_cpu():
	      wq_update_unbound_numa():
	        alloc_unbound_pool():
	          get_unbound_pool():
		    create_worker():
		      kthread_create_on_node():
		        wake_up_process(kthreadd_task);
		        wait_for_completion(); // create->done

, right?

Wonder running in a kworker is necessary to trigger this, I mean running
a cpu_down() in a normal process context could also trigger this, no?
Just ask out of curiosity.

Regards,
Boqun

> > 
> > kthreadd    - percpu_down_read(cgroup_threadgroup_rwsem)  [waiting]
> > 
> > init:729    - percpu_down_write(cgroup_threadgroup_rwsem)   [held]
> >               lock(cpuset_mutex)   [waiting]
> > 
> > init:1      - lock(cpuset_mutex)   [held]
> >               percpu_down_read(&cpu_hotplug_lock)   [waiting]
> 
> That's both unreadable and useless :/ You want to tell what code paths
> that were, not which random tasks happened to run them.
> 
> 
[...]

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


Thread

[PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 08:10 +0200
  Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Peter Zijlstra <peterz@infradead.org> - 2017-09-07 09:30 +0200
    Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Boqun Feng <boqun.feng@gmail.com> - 2017-09-07 11:00 +0200
      Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 11:10 +0200
    Re: [PATCH] cgroup/cpuset: remove circular dependency deadlock Prateek Sood <prsood@codeaurora.org> - 2017-09-07 11:10 +0200

csiph-web