public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Bob Liu <[email protected]>, [email protected]
Subject: Re: [PATCH v2] io_uring: provide fallback request for OOM situations
Date: Mon, 18 Nov 2019 07:32:22 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 11/17/19 11:57 PM, Bob Liu wrote:
> On 11/9/19 5:25 AM, Jens Axboe wrote:
>> One thing that really sucks for userspace APIs is if the kernel passes
>> back -ENOMEM/-EAGAIN for resource shortages. The application really has
>> no idea of what to do in those cases. Should it try and reap
>> completions? Probably a good idea. Will it solve the issue? Who knows.
>>
>> This patch adds a simple fallback mechanism if we fail to allocate
>> memory for a request. If we fail allocating memory from the slab for a
>> request, we punt to a pre-allocated request. There's just one of these
>> per io_ring_ctx, but the important part is if we ever return -EBUSY to
>> the application, the applications knows that it can wait for events and
>> make forward progress when events have completed. This is the important
>> part.
>>
> 
> I'm lost how -EBUSY will be returned if allocating from the pre-allocated request.
> Could you please explain a bit more?

The patch actually returns -EAGAIN, not -EBUSY... The last -EBUSY
mention in that commit message should be -EAGAIN.

But the point is that if you get a busy return back, then you know that
things are moving forward as we have a backup request. This is a similar
concept to the mempools we have in the kernel, have any kind of reserve
guarantees forward progress.

-- 
Jens Axboe


  reply	other threads:[~2019-11-18 14:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 21:25 [PATCH v2] io_uring: provide fallback request for OOM situations Jens Axboe
2019-11-18  6:57 ` Bob Liu
2019-11-18 14:32   ` Jens Axboe [this message]
2019-11-19  9:22     ` Bob Liu

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 \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /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