]> git.proxmox.com Git - mirror_spl.git/commit
Subclass tq_lock to eliminate a lockdep warning
authorOlaf Faaland <faaland1@llnl.gov>
Tue, 13 Oct 2015 23:56:51 +0000 (16:56 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 12 Dec 2015 00:19:56 +0000 (16:19 -0800)
commit326172d8549e0a34a8e4ef4665d8bdfcf7aeda6e
treea2f510e287126a137fa81d24c2c4f926a4f28740
parent628fc52137fc14377eba46c66b57d8d094e88507
Subclass tq_lock to eliminate a lockdep warning

When taskq_dispatch() calls taskq_thread_spawn() to create a new thread
for a taskq, linux lockdep warns of possible recursive locking.  This is
a false positive.

One such call chain is as follows, when a taskq needs more threads:
taskq_dispatch->taskq_thread_spawn->taskq_dispatch

The initial taskq_dispatch() holds tq_lock on the taskq that needed more
worker threads.  The later call into taskq_dispatch() takes
dynamic_taskq->tq_lock.  Without subclassing, lockdep believes these
could potentially be the same lock and complains.  A similar case occurs
when taskq_dispatch() then calls task_alloc().

This patch uses spin_lock_irqsave_nested() when taking tq_lock, with one
of two new lock subclasses:

subclass              taskq
TQ_LOCK_DYNAMIC       dynamic_taskq
TQ_LOCK_GENERAL       any other

Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #480
include/sys/taskq.h
module/spl/spl-taskq.c