Skip to content

Commit dd47c10

Browse files
esyr-rhaxboe
authored andcommitted
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 <[email protected]> Complements: 2e48005 ("io-wq: provide a way to limit max number of workers") Signed-off-by: Eugene Syromiatnikov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 767a65e commit dd47c10

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

fs/io-wq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/rculist_nulls.h>
1515
#include <linux/cpu.h>
1616
#include <linux/tracehook.h>
17+
#include <uapi/linux/io_uring.h>
1718

1819
#include "io-wq.h"
1920

@@ -1281,6 +1282,10 @@ int io_wq_max_workers(struct io_wq *wq, int *new_count)
12811282
{
12821283
int i, node, prev = 0;
12831284

1285+
BUILD_BUG_ON((int) IO_WQ_ACCT_BOUND != (int) IO_WQ_BOUND);
1286+
BUILD_BUG_ON((int) IO_WQ_ACCT_UNBOUND != (int) IO_WQ_UNBOUND);
1287+
BUILD_BUG_ON((int) IO_WQ_ACCT_NR != 2);
1288+
12841289
for (i = 0; i < 2; i++) {
12851290
if (new_count[i] > task_rlimit(current, RLIMIT_NPROC))
12861291
new_count[i] = task_rlimit(current, RLIMIT_NPROC);

include/uapi/linux/io_uring.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,19 @@ enum {
317317
IORING_REGISTER_IOWQ_AFF = 17,
318318
IORING_UNREGISTER_IOWQ_AFF = 18,
319319

320-
/* set/get max number of workers */
320+
/* set/get max number of io-wq workers */
321321
IORING_REGISTER_IOWQ_MAX_WORKERS = 19,
322322

323323
/* this goes last */
324324
IORING_REGISTER_LAST
325325
};
326326

327+
/* io-wq worker categories */
328+
enum {
329+
IO_WQ_BOUND,
330+
IO_WQ_UNBOUND,
331+
};
332+
327333
/* deprecated, see struct io_uring_rsrc_update */
328334
struct io_uring_files_update {
329335
__u32 offset;

0 commit comments

Comments
 (0)