io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>,
	io-uring@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] io_uring: fix reassigning work.task_pid from io-wq
Date: Tue, 11 Feb 2020 13:59:23 -0700	[thread overview]
Message-ID: <82bef6dc-608e-6fde-44fb-58ee517d234d@kernel.dk> (raw)
In-Reply-To: <e60026f7-8e8f-7133-57e3-762a1d84269b@gmail.com>

On 2/11/20 1:57 PM, Pavel Begunkov wrote:
> On 11/02/2020 23:21, Jens Axboe wrote:
>> On 2/11/20 1:01 PM, Pavel Begunkov wrote:
>>> If a request got into io-wq context, io_prep_async_work() has already
>>> been called. Most of the stuff there is idempotent with an exception
>>> that it'll set work.task_pid to task_pid_vnr() of an io_wq worker thread
>>>
>>> Do only what's needed, that's io_prep_linked_timeout() and setting
>>> IO_WQ_WORK_UNBOUND.
>>
>> Rest of the series aside, I'm going to fix-up the pid addition to
>> only set if it's zero like the others.
> 
> IMO, io_req_work_grab_env() should never be called from io-wq. It'd do nothing
> good but open space for subtle bugs. And if that's enforced (as done in this
> patch), it's safe to set @pid multiple times.

I agree, it'd be an issue if we ever did the first iteration through the
worker. And it'd be nice to make the flow self explanatory in that
regard.

> Probably, it worth to add the check just to not go through task_pid_vnr()
> several times.

Good point, that is worth it on its own.

-- 
Jens Axboe


  reply	other threads:[~2020-02-11 20:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-11 20:01 [PATCH 0/5] async punting improvements for io_uring Pavel Begunkov
2020-02-11 20:01 ` [PATCH 1/5] io_uring: remove REQ_F_MUST_PUNT Pavel Begunkov
2020-02-11 20:01 ` [PATCH 2/5] io_uring: don't call work.func from sync ctx Pavel Begunkov
2020-02-11 20:01 ` [PATCH 3/5] io_uring: fix reassigning work.task_pid from io-wq Pavel Begunkov
2020-02-11 20:21   ` Jens Axboe
2020-02-11 20:57     ` Pavel Begunkov
2020-02-11 20:59       ` Jens Axboe [this message]
2020-02-11 20:01 ` [PATCH 4/5] io_uring: add missing io_req_cancelled() Pavel Begunkov
2020-02-11 20:01 ` [PATCH 5/5] io_uring: purge req->in_async Pavel Begunkov

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=82bef6dc-608e-6fde-44fb-58ee517d234d@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@gmail.com \
    --cc=io-uring@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).