linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Eugene Syromiatnikov <esyr@redhat.com>,
	Pavel Begunkov <asml.silence@gmail.com>
Cc: io-uring@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Dmitry V. Levin" <ldv@strace.io>,
	linux-api@vger.kernel.org
Subject: Re: [PATCH v2] io-wq: expose IO_WQ_ACCT_* enumeration items to UAPI
Date: Mon, 13 Sep 2021 07:28:11 -0600	[thread overview]
Message-ID: <872209f5-d11c-1b80-6146-5646206e22cb@kernel.dk> (raw)
In-Reply-To: <20210913104101.GA29616@asgard.redhat.com>

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 <esyr@redhat.com>
> ---
> v2:
>  - IO_WQ_ACCT_NR is no longer exposed directly in UAPI, per Jens Axboe's
>    suggestion.
> 
> v1: https://lore.kernel.org/lkml/20210912122411.GA27679@asgard.redhat.com/
> ---
>  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


  reply	other threads:[~2021-09-13 14:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-09-13 15:52   ` Eugene Syromiatnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=872209f5-d11c-1b80-6146-5646206e22cb@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=esyr@redhat.com \
    --cc=io-uring@vger.kernel.org \
    --cc=ldv@strace.io \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).