Print this page
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument is zero


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.

  23  */
  24 
  25 /*
  26  * The System Duty Cycle (SDC) scheduling class
  27  * --------------------------------------------
  28  *
  29  * Background
  30  *
  31  * Kernel threads in Solaris have traditionally not been large consumers
  32  * of CPU time.  They typically wake up, perform a small amount of
  33  * work, then go back to sleep waiting for either a timeout or another
  34  * signal.  On the assumption that the small amount of work that they do
  35  * is important for the behavior of the whole system, these threads are
  36  * treated kindly by the dispatcher and the SYS scheduling class: they run
  37  * without preemption from anything other than real-time and interrupt
  38  * threads; when preempted, they are put at the front of the queue, so they
  39  * generally do not migrate between CPUs; and they are allowed to stay
  40  * running until they voluntarily give up the CPU.
  41  *
  42  * As Solaris has evolved, new workloads have emerged which require the


1288 }
1289 
1290 /* --- consolidation-private interfaces --- */
1291 void
1292 sysdc_thread_enter(kthread_t *t, uint_t dc, uint_t flags)
1293 {
1294         void *buf = NULL;
1295         sysdc_params_t sdp;
1296 
1297         SYSDC_INC_STAT(sysdc_thread_enter_enter);
1298 
1299         ASSERT(sysdc_param_init);
1300         ASSERT(sysdccid >= 0);
1301 
1302         ASSERT((flags & ~SYSDC_THREAD_BATCH) == 0);
1303 
1304         sdp.sdp_minpri = sysdc_minpri;
1305         sdp.sdp_maxpri = sysdc_maxpri;
1306         sdp.sdp_DC = MAX(MIN(dc, sysdc_maxDC), sysdc_minDC);
1307 
1308         VERIFY3U(CL_ALLOC(&buf, sysdccid, KM_SLEEP), ==, 0);
1309 
1310         ASSERT(t->t_lwp != NULL);
1311         ASSERT(t->t_cid == syscid);
1312         ASSERT(t->t_cldata == NULL);
1313         VERIFY3U(CL_CANEXIT(t, NULL), ==, 0);
1314         VERIFY3U(CL_ENTERCLASS(t, sysdccid, &sdp, kcred, buf), ==, 0);
1315         CL_EXITCLASS(syscid, NULL);
1316 }


   3  *
   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  */
  25 
  26 /*
  27  * The System Duty Cycle (SDC) scheduling class
  28  * --------------------------------------------
  29  *
  30  * Background
  31  *
  32  * Kernel threads in Solaris have traditionally not been large consumers
  33  * of CPU time.  They typically wake up, perform a small amount of
  34  * work, then go back to sleep waiting for either a timeout or another
  35  * signal.  On the assumption that the small amount of work that they do
  36  * is important for the behavior of the whole system, these threads are
  37  * treated kindly by the dispatcher and the SYS scheduling class: they run
  38  * without preemption from anything other than real-time and interrupt
  39  * threads; when preempted, they are put at the front of the queue, so they
  40  * generally do not migrate between CPUs; and they are allowed to stay
  41  * running until they voluntarily give up the CPU.
  42  *
  43  * As Solaris has evolved, new workloads have emerged which require the


1289 }
1290 
1291 /* --- consolidation-private interfaces --- */
1292 void
1293 sysdc_thread_enter(kthread_t *t, uint_t dc, uint_t flags)
1294 {
1295         void *buf = NULL;
1296         sysdc_params_t sdp;
1297 
1298         SYSDC_INC_STAT(sysdc_thread_enter_enter);
1299 
1300         ASSERT(sysdc_param_init);
1301         ASSERT(sysdccid >= 0);
1302 
1303         ASSERT((flags & ~SYSDC_THREAD_BATCH) == 0);
1304 
1305         sdp.sdp_minpri = sysdc_minpri;
1306         sdp.sdp_maxpri = sysdc_maxpri;
1307         sdp.sdp_DC = MAX(MIN(dc, sysdc_maxDC), sysdc_minDC);
1308 
1309         VERIFY0(CL_ALLOC(&buf, sysdccid, KM_SLEEP));
1310 
1311         ASSERT(t->t_lwp != NULL);
1312         ASSERT(t->t_cid == syscid);
1313         ASSERT(t->t_cldata == NULL);
1314         VERIFY0(CL_CANEXIT(t, NULL));
1315         VERIFY0(CL_ENTERCLASS(t, sysdccid, &sdp, kcred, buf));
1316         CL_EXITCLASS(syscid, NULL);
1317 }