| 1362 | #endif |
| 1363 | |
| 1364 | int |
| 1365 | spl_taskq_init(void) |
| 1366 | { |
| 1367 | init_rwsem(&tq_list_sem); |
| 1368 | tsd_create(&taskq_tsd, NULL); |
| 1369 | |
| 1370 | #ifdef HAVE_CPU_HOTPLUG |
| 1371 | spl_taskq_cpuhp_state = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN, |
| 1372 | "fs/spl_taskq:online", spl_taskq_expand, spl_taskq_prepare_down); |
| 1373 | #endif |
| 1374 | |
| 1375 | system_taskq = taskq_create("spl_system_taskq", MAX(boot_ncpus, 64), |
| 1376 | maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); |
| 1377 | if (system_taskq == NULL) |
| 1378 | return (1); |
| 1379 | |
| 1380 | system_delay_taskq = taskq_create("spl_delay_taskq", MAX(boot_ncpus, 4), |
| 1381 | maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE|TASKQ_DYNAMIC); |
| 1382 | if (system_delay_taskq == NULL) { |
| 1383 | #ifdef HAVE_CPU_HOTPLUG |
| 1384 | cpuhp_remove_multi_state(spl_taskq_cpuhp_state); |
| 1385 | #endif |
| 1386 | taskq_destroy(system_taskq); |
| 1387 | return (1); |
| 1388 | } |
| 1389 | |
| 1390 | dynamic_taskq = taskq_create("spl_dynamic_taskq", 1, |
| 1391 | maxclsyspri, boot_ncpus, INT_MAX, TASKQ_PREPOPULATE); |
| 1392 | if (dynamic_taskq == NULL) { |
| 1393 | #ifdef HAVE_CPU_HOTPLUG |
| 1394 | cpuhp_remove_multi_state(spl_taskq_cpuhp_state); |
| 1395 | #endif |
| 1396 | taskq_destroy(system_taskq); |
| 1397 | taskq_destroy(system_delay_taskq); |
| 1398 | return (1); |
| 1399 | } |
| 1400 | |
| 1401 | /* |
| 1402 | * This is used to annotate tq_lock, so |
| 1403 | * taskq_dispatch -> taskq_thread_spawn -> taskq_dispatch |
| 1404 | * does not trigger a lockdep warning re: possible recursive locking |
| 1405 | */ |
| 1406 | dynamic_taskq->tq_lock_class = TQ_LOCK_DYNAMIC; |
| 1407 | |
| 1408 | return (0); |
| 1409 | } |
| 1410 | |
| 1411 | void |
| 1412 | spl_taskq_fini(void) |
no test coverage detected