io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
PATCH 1/1 io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
These are used to index aargument of IORING_REGISTER_IOWQ_MAX_WORKERS io_uring_register command, so they are to be exposed in UAPI.
--- fs/io-wq.c | 7 +------ include/uapi/linux/io_uring.h | 8 ++++++++ 2 files changed, 9 insertions(+), 6 deletions(-)
fs/io-wq.c +1 -6
@@ -14,6 +14,7 @@#include <linux/rculist_nulls.h> #include <linux/cpu.h> #include <linux/tracehook.h> +#include <uapi/linux/io_uring.h> #include "io-wq.h"
@@ -77,12 +78,6 @@ struct io_wqe_acct {unsigned long flags; }; -enum { -IO_WQ_ACCT_BOUND , -IO_WQ_ACCT_UNBOUND , -IO_WQ_ACCT_NR , -}; -/* * Per-node worker thread pool */
include/uapi/linux/io_uring.h +8 -0
@@ -324,6 +324,14 @@ enum {IORING_REGISTER_LAST }; +/* io-wq worker limit categories */ +enum { +IO_WQ_ACCT_BOUND , +IO_WQ_ACCT_UNBOUND , + +IO_WQ_ACCT_NR /* Non-UAPI */ +}; +/* deprecated, see struct io_uring_rsrc_update */ struct io_uring_files_update {__u32 offset;
Signature · 1 line
2.1.4
Jens Axboe
maintainerQuoted 2 lines · Eugene Syromiatnikov
These are used to index aargument of
IORING_REGISTER_IOWQ_MAX_WORKERSio_uring_registercommand, so they are to be exposed in UAPI.
Not sure that's necessary, as it's really just a boolean values - is the worker type bounded or not. That said, not against making it available for userspace, but definitely not IO_WQ_ACCT_NR. It should probably just go in liburing, I guess.
Signature · 1 line
Jens Axboe
Quoted 8 lines · Jens Axboe
Quoted 2 lines · Eugene Syromiatnikov
These are used to index aargument of
IORING_REGISTER_IOWQ_MAX_WORKERSio_uring_registercommand, so they are to be exposed in UAPI.Not sure that's necessary, as it's really just a boolean values - is the worker type bounded or not. That said, not against making it available for userspace, but definitely not
IO_WQ_ACCT_NR. It should probably just go in liburing, I guess.
If IO_WQ_ACCT_* were just boolean values, no enum would have been introduced in the first place. What's the benefit of hiding the API in the implementation, or burying it inside liburing?
Signature · 1 line
ldv
Jens Axboe
maintainerQuoted 5 lines · Dmitry V. Levin
Quoted 4 lines · Jens Axboe
Quoted 2 lines · Eugene Syromiatnikov
These are used to index aargument of
IORING_REGISTER_IOWQ_MAX_WORKERSio_uring_registercommand, so they are to be exposed in UAPI.
Quoted 8 lines
Quoted 4 lines
Not sure that's necessary, as it's really just a boolean values - is the worker type bounded or not. That said, not against making it available for userspace, but definitely not
IO_WQ_ACCT_NR. It should probably just go in liburing, I guess.If IO_WQ_ACCT_* were just boolean values, no enum would have been introduced in the first place. What's the benefit of hiding the API in the implementation, or burying it inside liburing?
Because it's easier to grok internally with an enum instead of using 0/1. And you could argue that's the case too for an app, and as I said, I'm not against making them exposed, but the _NR part is strictly internal.
Just add separate defines or an enum in io_uring.h:
enum {
IO_WQ_BOUND,
IO_WQ_UNBOUND,
};
and be done with it.
Signature · 1 line
Jens Axboe