linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue
       [not found]               ` <20160128101210.GC6357@twins.programming.kicks-ass.net>
@ 2016-01-29 11:09                 ` Tejun Heo
  2016-01-29 15:17                   ` Peter Zijlstra
  0 siblings, 1 reply; 3+ messages in thread
From: Tejun Heo @ 2016-01-29 11:09 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thierry Reding, Ulrich Obergfell, Ingo Molnar, Andrew Morton,
	linux-kernel, kernel-team, Jon Hunter, linux-tegra, rmk+kernel,
	Johannes Weiner, linux-mm

Hello, Peter.

On Thu, Jan 28, 2016 at 11:12:10AM +0100, Peter Zijlstra wrote:
> On Tue, Jan 26, 2016 at 06:38:43PM +0100, Thierry Reding wrote:
> > > Task or work item involved in memory reclaim trying to flush a
> > > non-WQ_MEM_RECLAIM workqueue or one of its work items can lead to
> > > deadlock.  Trigger WARN_ONCE() if such conditions are detected.
> > I've started noticing the following during boot on some of the devices I
> > work with:
> > 
> > [    4.723705] WARNING: CPU: 0 PID: 6 at kernel/workqueue.c:2361 check_flush_dependency+0x138/0x144()
> > [    4.736818] workqueue: WQ_MEM_RECLAIM deferwq:deferred_probe_work_func is flushing !WQ_MEM_RECLAIM events:lru_add_drain_per_cpu
...
> Right, also, I think it makes sense to do lru_add_drain_all() from a
> WQ_MEM_RECLAIM workqueue, it is, after all, aiding in getting memory
> freed.
> 
> Does something like the below cure things?
> 
> TJ does this make sense to you?

The problem here is that deferwq which has nothing to do with memory
reclaim is marked with WQ_MEM_RECLAIM because it was created the old
create_singlethread_workqueue() which doesn't distinguish workqueues
which may be used on mem reclaim path and thus has to mark all as
needing forward progress guarantee.  I posted a patch to disable
disable flush dependency checks on those workqueues and there's a
outreachy project to weed out the users of the old interface, so
hopefully this won't be an issue soon.

As for whether lru drain should have WQ_MEM_RECLAIM, I'm not sure.
Cc'ing linux-mm.  The rule here is that any workquee which is depended
upon during memory reclaim should have WQ_MEM_RECLAIM set.  IOW, if a
work item failing to start execution under memory pressure can prevent
memory from being reclaimed, it should be scheduled on a
WQ_MEM_RECLAIM workqueue.  Would this be the case for
lru_add_drain_per_cpu()?

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue
  2016-01-29 11:09                 ` [PATCH] workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue Tejun Heo
@ 2016-01-29 15:17                   ` Peter Zijlstra
  2016-01-29 18:28                     ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Zijlstra @ 2016-01-29 15:17 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Thierry Reding, Ulrich Obergfell, Ingo Molnar, Andrew Morton,
	linux-kernel, kernel-team, Jon Hunter, linux-tegra, rmk+kernel,
	Johannes Weiner, linux-mm

On Fri, Jan 29, 2016 at 06:09:41AM -0500, Tejun Heo wrote:
>  I posted a patch to disable
> disable flush dependency checks on those workqueues and there's a
> outreachy project to weed out the users of the old interface, so
> hopefully this won't be an issue soon.

Will that same project review all workqueue users for the strict per-cpu
stuff, so we can finally kill that weird stuff you do on hotplug?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue
  2016-01-29 15:17                   ` Peter Zijlstra
@ 2016-01-29 18:28                     ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2016-01-29 18:28 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Thierry Reding, Ulrich Obergfell, Ingo Molnar, Andrew Morton,
	linux-kernel, kernel-team, Jon Hunter, linux-tegra, rmk+kernel,
	Johannes Weiner, linux-mm

Hey, Peter.

On Fri, Jan 29, 2016 at 04:17:39PM +0100, Peter Zijlstra wrote:
> On Fri, Jan 29, 2016 at 06:09:41AM -0500, Tejun Heo wrote:
> >  I posted a patch to disable
> > disable flush dependency checks on those workqueues and there's a
> > outreachy project to weed out the users of the old interface, so
> > hopefully this won't be an issue soon.
> 
> Will that same project review all workqueue users for the strict per-cpu
> stuff, so we can finally kill that weird stuff you do on hotplug?

Unfortunately not.  We do want to distinguish cpu-affine for
correctness and as an optimization; however, making that distinction
is unlikely to make the dynamic worker affinity binding go away.  We
can't forcifully shut down workers which are executing work items
which are affine as an optimization when the CPU goes down.

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-29 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20151203002810.GJ19878@mtj.duckdns.org>
     [not found] ` <20151203093350.GP17308@twins.programming.kicks-ass.net>
     [not found]   ` <20151203100018.GO11639@twins.programming.kicks-ass.net>
     [not found]     ` <20151203144811.GA27463@mtj.duckdns.org>
     [not found]       ` <20151203150442.GR17308@twins.programming.kicks-ass.net>
     [not found]         ` <20151203150604.GC27463@mtj.duckdns.org>
     [not found]           ` <20151203192616.GJ27463@mtj.duckdns.org>
     [not found]             ` <20160126173843.GA11115@ulmo.nvidia.com>
     [not found]               ` <20160128101210.GC6357@twins.programming.kicks-ass.net>
2016-01-29 11:09                 ` [PATCH] workqueue: warn if memory reclaim tries to flush !WQ_MEM_RECLAIM workqueue Tejun Heo
2016-01-29 15:17                   ` Peter Zijlstra
2016-01-29 18:28                     ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).