public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: lizetao <lizetao1@huawei.com>
To: Jens Axboe <axboe@kernel.dk>, Pavel Begunkov <asml.silence@gmail.com>
Cc: "io-uring@vger.kernel.org" <io-uring@vger.kernel.org>
Subject: RE: [PATCH 1/1] io_uring: clean up io_uring_register_get_file()
Date: Fri, 17 Jan 2025 01:40:23 +0000	[thread overview]
Message-ID: <2e706fca1404496aae045f599637bb5a@huawei.com> (raw)
In-Reply-To: <eb0fb2c4-bf88-4fa8-bbe3-4eca830606aa@kernel.dk>

Hi,

> -----Original Message-----
> From: Jens Axboe <axboe@kernel.dk>
> Sent: Thursday, January 16, 2025 10:10 PM
> To: lizetao <lizetao1@huawei.com>; Pavel Begunkov <asml.silence@gmail.com>
> Cc: io-uring@vger.kernel.org
> Subject: Re: [PATCH 1/1] io_uring: clean up io_uring_register_get_file()
> 
> On 1/16/25 6:09 AM, lizetao wrote:
> > Hi,
> >
> >> -----Original Message-----
> >> From: Pavel Begunkov <asml.silence@gmail.com>
> >> Sent: Thursday, January 16, 2025 10:53 AM
> >> To: io-uring@vger.kernel.org
> >> Cc: asml.silence@gmail.com
> >> Subject: [PATCH 1/1] io_uring: clean up io_uring_register_get_file()
> >>
> >> Make it always reference the returned file. It's safer, especially
> >> with unregistrations happening under it. And it makes the api cleaner
> >> with no conditional clean ups by the caller.
> >>
> >> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> >> ---
> >>  io_uring/register.c | 6 ++++--
> >>  io_uring/rsrc.c     | 4 ++--
> >>  2 files changed, 6 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/io_uring/register.c b/io_uring/register.c index
> >> 5e48413706ac..a93c979c2f38 100644
> >> --- a/io_uring/register.c
> >> +++ b/io_uring/register.c
> >> @@ -841,6 +841,8 @@ struct file *io_uring_register_get_file(unsigned
> >> int fd, bool registered)
> >>  			return ERR_PTR(-EINVAL);
> >>  		fd = array_index_nospec(fd, IO_RINGFD_REG_MAX);
> >>  		file = tctx->registered_rings[fd];
> >> +		if (file)
> >> +			get_file(file);
> >
> > Should performance be a priority here?
> 
> Performance only really matters for high frequency invocations, of which the
> register part is not. So no, should not matter at all.
Ok. I got it.

Tested-by: Li Zetao <lizetao1@huawei.com>
Reviewed-by: Li Zetao <lizetao1@huawei.com>
> 
> --
> Jens Axboe

---
Li Zetao

  reply	other threads:[~2025-01-17  1:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-16  2:53 [PATCH 1/1] io_uring: clean up io_uring_register_get_file() Pavel Begunkov
2025-01-16 13:09 ` lizetao
2025-01-16 14:10   ` Jens Axboe
2025-01-17  1:40     ` lizetao [this message]
2025-01-16 14:13 ` 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=2e706fca1404496aae045f599637bb5a@huawei.com \
    --to=lizetao1@huawei.com \
    --cc=asml.silence@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox