public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
@ 2021-09-13 10:41 Eugene Syromiatnikov
  2021-09-13 13:28 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Eugene Syromiatnikov @ 2021-09-13 10:41 UTC (permalink / raw)
  To: Jens Axboe, Pavel Begunkov
  Cc: io-uring, linux-kernel, Dmitry V. Levin, linux-api

These are used to index elements in the argument
of IORING_REGISTER_IOWQ_MAX_WORKERS io_uring_register command,
so they are to be exposed in UAPI.

Complements: 2e480058ddc21ec5 ("io-wq: provide a way to limit max number of workers")
Signed-off-by: Eugene Syromiatnikov <[email protected]>
---
v2:
 - IO_WQ_ACCT_NR is no longer exposed directly in UAPI, per Jens Axboe's
   suggestion.

v1: https://lore.kernel.org/lkml/[email protected]/
---
 fs/io-wq.c                    | 5 ++---
 include/uapi/linux/io_uring.h | 8 ++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fs/io-wq.c b/fs/io-wq.c
index 6c55362..eb5162d 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -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"
 
@@ -78,9 +79,7 @@ struct io_wqe_acct {
 };
 
 enum {
-	IO_WQ_ACCT_BOUND,
-	IO_WQ_ACCT_UNBOUND,
-	IO_WQ_ACCT_NR,
+	IO_WQ_ACCT_NR = __IO_WQ_ACCT_MAX
 };
 
 /*
diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 59ef351..dae1841 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -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_MAX /* Non-UAPI */
+};
+
 /* deprecated, see struct io_uring_rsrc_update */
 struct io_uring_files_update {
 	__u32 offset;
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
  2021-09-13 10:41 [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI Eugene Syromiatnikov
@ 2021-09-13 13:28 ` Jens Axboe
  2021-09-13 15:52   ` Eugene Syromiatnikov
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2021-09-13 13:28 UTC (permalink / raw)
  To: Eugene Syromiatnikov, Pavel Begunkov
  Cc: io-uring, linux-kernel, Dmitry V. Levin, linux-api

On 9/13/21 4:41 AM, Eugene Syromiatnikov wrote:
> These are used to index elements in the argument
> of IORING_REGISTER_IOWQ_MAX_WORKERS io_uring_register command,
> so they are to be exposed in UAPI.
> 
> Complements: 2e480058ddc21ec5 ("io-wq: provide a way to limit max number of workers")
> Signed-off-by: Eugene Syromiatnikov <[email protected]>
> ---
> v2:
>  - IO_WQ_ACCT_NR is no longer exposed directly in UAPI, per Jens Axboe's
>    suggestion.
> 
> v1: https://lore.kernel.org/lkml/[email protected]/
> ---
>  fs/io-wq.c                    | 5 ++---
>  include/uapi/linux/io_uring.h | 8 ++++++++
>  2 files changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/io-wq.c b/fs/io-wq.c
> index 6c55362..eb5162d 100644
> --- a/fs/io-wq.c
> +++ b/fs/io-wq.c
> @@ -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"
>  
> @@ -78,9 +79,7 @@ struct io_wqe_acct {
>  };
>  
>  enum {
> -	IO_WQ_ACCT_BOUND,
> -	IO_WQ_ACCT_UNBOUND,
> -	IO_WQ_ACCT_NR,
> +	IO_WQ_ACCT_NR = __IO_WQ_ACCT_MAX
>  };
>  
>  /*
> diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
> index 59ef351..dae1841 100644
> --- a/include/uapi/linux/io_uring.h
> +++ b/include/uapi/linux/io_uring.h
> @@ -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_MAX /* Non-UAPI */
> +};

This is really the same thing as before, just the names have changed.
What I suggested was keeping the enum in io_uring, then just adding

enum {
	IO_WQ_BOUND,
	IO_WQ_UNBOUND,
};

to uapi header. The ACCT stuff is io-wq specific too, that kind of naming
shouldn't be propagated to userspace.

A BUILD_BUG_ON() could be added for them being different, but honestly
I don't think that's worth it.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
  2021-09-13 13:28 ` Jens Axboe
@ 2021-09-13 15:52   ` Eugene Syromiatnikov
  0 siblings, 0 replies; 3+ messages in thread
From: Eugene Syromiatnikov @ 2021-09-13 15:52 UTC (permalink / raw)
  To: Jens Axboe
  Cc: Pavel Begunkov, io-uring, linux-kernel, Dmitry V. Levin,
	linux-api

On Mon, Sep 13, 2021 at 07:28:11AM -0600, Jens Axboe wrote:
> This is really the same thing as before, just the names have changed.
> What I suggested was keeping the enum in io_uring, then just adding
> 
> enum {
> 	IO_WQ_BOUND,
> 	IO_WQ_UNBOUND,
> };
> 
> to uapi header. The ACCT stuff is io-wq specific too, that kind of naming
> shouldn't be propagated to userspace.

My apologies, I've overlooked the fact that the proposed names
are different.  Updated and resent[1].

[1] https://lore.kernel.org/lkml/[email protected]/

> A BUILD_BUG_ON() could be added for them being different, but honestly
> I don't think that's worth it.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-13 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-13 10:41 [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI Eugene Syromiatnikov
2021-09-13 13:28 ` Jens Axboe
2021-09-13 15:52   ` Eugene Syromiatnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox