]> granicus.if.org Git - zfs/commitdiff
Disable direct reclaim in taskq worker threads on Linux 3.9+
authorRichard Yao <ryao@gentoo.org>
Mon, 7 Sep 2015 16:35:21 +0000 (12:35 -0400)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 9 Sep 2015 21:30:47 +0000 (14:30 -0700)
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 <ryao@gentoo.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#1274
Issue zfsonlinux/zfs#2390
Closes #474

module/spl/spl-taskq.c

index 82e71a38892ff0a53819f73a171391a81c4a306c..f6ef56251c63f38ea8575dcc1ffaad938cc70a8d 100644 (file)
@@ -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);