Skip to content

Commit

Permalink
Disable direct reclaim in taskq worker threads on Linux 3.9+
Browse files Browse the repository at this point in the history
Illumos does not have direct reclaim and code run inside taskq worker
threads is not designed to deal with it. Allowing direct reclaim inside
a worker thread can therefore deadlock. We set PF_MEMALLOC_NOIO through
memalloc_noio_save() to indicate to the kernel's reclaim code that we
are inside a context where memory allocations cannot be allowed to block
on filesystem activity.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#1274
Issue openzfs#2390
Closes openzfs#474
  • Loading branch information
ryao authored and behlendorf committed Sep 9, 2015
1 parent 4fa4cab commit d4bf6d8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions module/spl/spl-taskq.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,10 @@ taskq_thread(void *args)
tq = tqt->tqt_tq;
current->flags |= PF_NOFREEZE;

#if defined(PF_MEMALLOC_NOIO)
(void) memalloc_noio_save();
#endif

sigfillset(&blocked);
sigprocmask(SIG_BLOCK, &blocked, NULL);
flush_signals(current);
Expand Down

0 comments on commit d4bf6d8

Please sign in to comment.