Print this page
OS-6363 system went to dark side of moon for ~467 seconds OS-6404 ARC reclaim should throttle its calls to arc_kmem_reap_now() Reviewed by: Bryan Cantrill <bryan@joyent.com> Reviewed by: Dan McDonald <danmcd@joyent.com>
        
@@ -24,10 +24,11 @@
  */
 
 /*
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2017, Joyent, Inc.
  */
 
 /*
  * Kernel task queues: general-purpose asynchronous task scheduling.
  *
@@ -1317,10 +1318,26 @@
                 TQ_ENQUEUE(tq, tqe, func, arg);
         }
         mutex_exit(&tq->tq_lock);
 }
 
+/*
+ * Allow our caller to ask if there are tasks pending on the queue.
+ */
+boolean_t
+taskq_empty(taskq_t *tq)
+{
+        boolean_t rv;
+
+        ASSERT3P(tq, !=, curthread->t_taskq);
+        mutex_enter(&tq->tq_lock);
+        rv = (tq->tq_task.tqent_next == &tq->tq_task) && (tq->tq_active == 0);
+        mutex_exit(&tq->tq_lock);
+
+        return (rv);
+}
+
 /*
  * Wait for all pending tasks to complete.
  * Calling taskq_wait from a task will cause deadlock.
  */
 void