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
43 * kernel to perform significant amounts of CPU-intensive work. One
44 * example of such a workload is ZFS's transaction group sync processing.
45 * Each sync operation generates a large batch of I/Os, and each I/O
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 }
|
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 * Copyright (c) 2012 by Delphix. All rights reserved.
27 */
28
29 /*
30 * The System Duty Cycle (SDC) scheduling class
31 * --------------------------------------------
32 *
33 * Background
34 *
35 * Kernel threads in Solaris have traditionally not been large consumers
36 * of CPU time. They typically wake up, perform a small amount of
37 * work, then go back to sleep waiting for either a timeout or another
38 * signal. On the assumption that the small amount of work that they do
39 * is important for the behavior of the whole system, these threads are
40 * treated kindly by the dispatcher and the SYS scheduling class: they run
41 * without preemption from anything other than real-time and interrupt
42 * threads; when preempted, they are put at the front of the queue, so they
43 * generally do not migrate between CPUs; and they are allowed to stay
44 * running until they voluntarily give up the CPU.
45 *
46 * As Solaris has evolved, new workloads have emerged which require the
47 * kernel to perform significant amounts of CPU-intensive work. One
48 * example of such a workload is ZFS's transaction group sync processing.
49 * Each sync operation generates a large batch of I/Os, and each I/O
1292 }
1293
1294 /* --- consolidation-private interfaces --- */
1295 void
1296 sysdc_thread_enter(kthread_t *t, uint_t dc, uint_t flags)
1297 {
1298 void *buf = NULL;
1299 sysdc_params_t sdp;
1300
1301 SYSDC_INC_STAT(sysdc_thread_enter_enter);
1302
1303 ASSERT(sysdc_param_init);
1304 ASSERT(sysdccid >= 0);
1305
1306 ASSERT((flags & ~SYSDC_THREAD_BATCH) == 0);
1307
1308 sdp.sdp_minpri = sysdc_minpri;
1309 sdp.sdp_maxpri = sysdc_maxpri;
1310 sdp.sdp_DC = MAX(MIN(dc, sysdc_maxDC), sysdc_minDC);
1311
1312 VERIFY0(CL_ALLOC(&buf, sysdccid, KM_SLEEP));
1313
1314 ASSERT(t->t_lwp != NULL);
1315 ASSERT(t->t_cid == syscid);
1316 ASSERT(t->t_cldata == NULL);
1317 VERIFY0(CL_CANEXIT(t, NULL));
1318 VERIFY0(CL_ENTERCLASS(t, sysdccid, &sdp, kcred, buf));
1319 CL_EXITCLASS(syscid, NULL);
1320 }
|