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>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/os/taskq.c
          +++ new/usr/src/uts/common/os/taskq.c
↓ open down ↓ 18 lines elided ↑ open up ↑
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
  27   27   * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  28   28   * Copyright (c) 2017 by Delphix. All rights reserved.
       29 + * Copyright (c) 2017, Joyent, Inc.
  29   30   */
  30   31  
  31   32  /*
  32   33   * Kernel task queues: general-purpose asynchronous task scheduling.
  33   34   *
  34   35   * A common problem in kernel programming is the need to schedule tasks
  35   36   * to be performed later, by another thread. There are several reasons
  36   37   * you may want or need to do this:
  37   38   *
  38   39   * (1) The task isn't time-critical, but your current code path is.
↓ open down ↓ 1273 lines elided ↑ open up ↑
1312 1313          mutex_enter(&tq->tq_lock);
1313 1314  
1314 1315          if (flags & TQ_FRONT) {
1315 1316                  TQ_ENQUEUE_FRONT(tq, tqe, func, arg);
1316 1317          } else {
1317 1318                  TQ_ENQUEUE(tq, tqe, func, arg);
1318 1319          }
1319 1320          mutex_exit(&tq->tq_lock);
1320 1321  }
1321 1322  
     1323 +/*
     1324 + * Allow our caller to ask if there are tasks pending on the queue.
     1325 + */
     1326 +boolean_t
     1327 +taskq_empty(taskq_t *tq)
     1328 +{
     1329 +        boolean_t rv;
     1330 +
     1331 +        ASSERT3P(tq, !=, curthread->t_taskq);
     1332 +        mutex_enter(&tq->tq_lock);
     1333 +        rv = (tq->tq_task.tqent_next == &tq->tq_task) && (tq->tq_active == 0);
     1334 +        mutex_exit(&tq->tq_lock);
     1335 +
     1336 +        return (rv);
     1337 +}
     1338 +
1322 1339  /*
1323 1340   * Wait for all pending tasks to complete.
1324 1341   * Calling taskq_wait from a task will cause deadlock.
1325 1342   */
1326 1343  void
1327 1344  taskq_wait(taskq_t *tq)
1328 1345  {
1329 1346          ASSERT(tq != curthread->t_taskq);
1330 1347  
1331 1348          mutex_enter(&tq->tq_lock);
↓ open down ↓ 984 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX