All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Jens Axboe <axboe@kernel.dk>
Cc: io-uring@vger.kernel.org
Subject: Re: [PATCH 1/2] io_uring: switch struct io_ring_ctx internal bitfields to flags
Date: Mon, 16 Mar 2026 16:34:15 -0400	[thread overview]
Message-ID: <87jyvbwm2g.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <af3311c8-21b0-4641-bce3-d9bc2e2367c5@kernel.dk> (Jens Axboe's message of "Sun, 15 Mar 2026 08:46:57 -0600")

Jens Axboe <axboe@kernel.dk> writes:

> On 3/14/26 9:16 PM, Gabriel Krisman Bertazi wrote:
>
>> Jens Axboe <axboe@kernel.dk> writes:
>> 
>>> Bitfields cannot be set and checked atomically, and this makes it more
>>> clear that these are indeed in shared storage and must be checked and
>>> set in a sane fashion. This is in preparation for annotating a few of
>>> the known racy, but harmless, flags checking.
>>>
>>> No intended functional changes in this patch.
>>>
>>> Signed-off-by: Jens Axboe <axboe@kernel.dk>
>>> ---
>>>  include/linux/io_uring_types.h | 32 +++++++------
>>>  io_uring/eventfd.c             |  4 +-
>>>  io_uring/io_uring.c            | 82 +++++++++++++++++-----------------
>>>  io_uring/io_uring.h            |  9 ++--
>>>  io_uring/msg_ring.c            |  2 +-
>>>  io_uring/register.c            |  8 ++--
>>>  io_uring/rsrc.c                |  8 ++--
>>>  io_uring/tctx.c                |  2 +-
>>>  io_uring/timeout.c             |  4 +-
>>>  io_uring/tw.c                  |  2 +-
>>>  10 files changed, 80 insertions(+), 73 deletions(-)
>>>
>>> diff --git a/include/linux/io_uring_types.h b/include/linux/io_uring_types.h
>>> index dd1420bfcb73..b84576374c7b 100644
>>> --- a/include/linux/io_uring_types.h
>>> +++ b/include/linux/io_uring_types.h
>>> @@ -268,24 +268,28 @@ struct io_alloc_cache {
>>>  	unsigned int		init_clear;
>>>  };
>>>  
>>> +enum {
>>> +	IO_RING_F_DRAIN_NEXT		= BIT(0),
>>> +	IO_RING_F_OP_RESTRICTED		= BIT(1),
>>> +	IO_RING_F_REG_RESTRICTED	= BIT(2),
>>> +	IO_RING_F_OFF_TIMEOUT_USED	= BIT(3),
>>> +	IO_RING_F_DRAIN_ACTIVE		= BIT(4),
>>> +	IO_RING_F_HAS_EVFD		= BIT(5),
>>> +	/* all CQEs should be posted only by the submitter task */
>>> +	IO_RING_F_TASK_COMPLETE		= BIT(6),
>>> +	IO_RING_F_LOCKLESS_CQ		= BIT(7),
>>> +	IO_RING_F_SYSCALL_IOPOLL	= BIT(8),
>>> +	IO_RING_F_POLL_ACTIVATED	= BIT(9),
>>> +	IO_RING_F_DRAIN_DISABLED	= BIT(10),
>>> +	IO_RING_F_COMPAT		= BIT(11),
>>> +	IO_RING_F_IOWQ_LIMITS_SET	= BIT(12),
>>> +};
>>> +
>>>  struct io_ring_ctx {
>>>  	/* const or read-mostly hot data */
>>>  	struct {
>>>  		unsigned int		flags;
>>> -		unsigned int		drain_next: 1;
>>> -		unsigned int		op_restricted: 1;
>>> -		unsigned int		reg_restricted: 1;
>>> -		unsigned int		off_timeout_used: 1;
>>> -		unsigned int		drain_active: 1;
>>> -		unsigned int		has_evfd: 1;
>>> -		/* all CQEs should be posted only by the submitter task */
>>> -		unsigned int		task_complete: 1;
>>> -		unsigned int		lockless_cq: 1;
>>> -		unsigned int		syscall_iopoll: 1;
>>> -		unsigned int		poll_activated: 1;
>>> -		unsigned int		drain_disabled: 1;
>>> -		unsigned int		compat: 1;
>>> -		unsigned int		iowq_limits_set : 1;
>>> +		unsigned int		int_flags;
>> 
>> Jens,
>> 
>> What does the int prefix means in this context?
>
> It's just short for 'internal'.

ack.  Perhaps a comment indicating this is internal would be
useful. Otherwise,

Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>


-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2026-03-16 20:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 14:58 [PATCHSET for-next 0/2] Replace io_ring_ctx bitfields with flags Jens Axboe
2026-03-14 14:58 ` [PATCH 1/2] io_uring: switch struct io_ring_ctx internal bitfields to flags Jens Axboe
2026-03-15  3:16   ` Gabriel Krisman Bertazi
2026-03-15 14:46     ` Jens Axboe
2026-03-16 20:34       ` Gabriel Krisman Bertazi [this message]
2026-03-16 21:33         ` Jens Axboe
2026-03-14 14:58 ` [PATCH 2/2] io_uring: mark known and harmless racy ctx->int_flags uses Jens Axboe

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=87jyvbwm2g.fsf@mailhost.krisman.be \
    --to=krisman@suse.de \
    --cc=axboe@kernel.dk \
    --cc=io-uring@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.