Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

io-wq: provide IO_WQ_* constants for IORING_REGISTER_IOWQ_MAX_WORKERS arg items

The items passed in the array pointed by the arg parameter
of IORING_REGISTER_IOWQ_MAX_WORKERS io_uring_register operation
carry certain semantics: they refer to different io-wq worker categories;
provide IO_WQ_* constants in the UAPI, so these categories can be referenced
in the user space code.

Suggested-by: Jens Axboe <axboe@kernel.dk>
Complements: 2e480058ddc21ec5 ("io-wq: provide a way to limit max number of workers")
Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
Link: https://lore.kernel.org/r/20210913154415.GA12890@asgard.redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Eugene Syromiatnikov and committed by
Jens Axboe
dd47c104 767a65e9

+12 -1
+5
fs/io-wq.c
··· 14 14 #include <linux/rculist_nulls.h> 15 15 #include <linux/cpu.h> 16 16 #include <linux/tracehook.h> 17 + #include <uapi/linux/io_uring.h> 17 18 18 19 #include "io-wq.h" 19 20 ··· 1281 1280 int io_wq_max_workers(struct io_wq *wq, int *new_count) 1282 1281 { 1283 1282 int i, node, prev = 0; 1283 + 1284 + BUILD_BUG_ON((int) IO_WQ_ACCT_BOUND != (int) IO_WQ_BOUND); 1285 + BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND); 1286 + BUILD_BUG_ON((int) IO_WQ_ACCT_NR != 2); 1284 1287 1285 1288 for (i = 0; i < 2; i++) { 1286 1289 if (new_count[i] > task_rlimit(current, RLIMIT_NPROC))
+7 -1
include/uapi/linux/io_uring.h
··· 317 317 IORING_REGISTER_IOWQ_AFF = 17, 318 318 IORING_UNREGISTER_IOWQ_AFF = 18, 319 319 320 - /* set/get max number of workers */ 320 + /* set/get max number of io-wq workers */ 321 321 IORING_REGISTER_IOWQ_MAX_WORKERS = 19, 322 322 323 323 /* this goes last */ 324 324 IORING_REGISTER_LAST 325 + }; 326 + 327 + /* io-wq worker categories */ 328 + enum { 329 + IO_WQ_BOUND, 330 + IO_WQ_UNBOUND, 325 331 }; 326 332 327 333 /* deprecated, see struct io_uring_rsrc_update */