All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz at gmail.com>
To: ell at lists.01.org
Subject: Re: AIO support
Date: Sun, 19 Sep 2021 16:11:09 -0500	[thread overview]
Message-ID: <7c57da7d-6ac9-6a63-62fd-42453f7bedf9@gmail.com> (raw)
In-Reply-To: 4eac85e0-0529-4dcc-5e7b-31101d2dae71@maurer.systems

[-- Attachment #1: Type: text/plain, Size: 1221 bytes --]

Hi Simon,

>> Can you elaborate?  I always thought
>> fcntl(fd, F_SETFL, O_NONBLOCK);
>>
>> would enable non-blocking behavior on files just fine?  Or is this an issue 
>> with a particular driver?
>>
> 
> I tested it and never got EAGAIN. I found this in the man page of open for the 
> flag O_NONBLOCK or O_NDELAY:
> 
> "Note  that this flag has no effect for regular files and block devices; that 
> is, I/O operations will (briefly) block when device activity is required, 
> regardless of whether O_NONBLOCK is set.  Since O_NONBLOCK semantics might 
> eventually be implemented, applications should not depend  upon  blocking  
> behavior  when specifying this flag for regular files and block devices."
> 

Ah, indeed.  I think I even knew that, sorry for the noise.

> An alternative could be preadv2 with the flag RWF_NOWAIT. But it is only 
> available since linux 4.14 and we are using an older kernel. Also epoll doesn't 
> wait for preadv2.

Right, epoll will just simply return immediately on regular files.  Have you 
tried using a timer or l_idle to drive the reading?  Is there ioctl(fd, 
FIONREAD, ...) or equivalent that could be used not to block?

Regards,
-Denis

             reply	other threads:[~2021-09-19 21:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-19 21:11 Denis Kenzior [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-09-25 17:37 AIO support Simon Maurer
2021-09-24 14:21 Denis Kenzior
2021-09-24  8:36 Simon Maurer
2021-09-22 11:46 Simon Maurer
2021-09-21 21:43 Denis Kenzior
2021-09-20 20:05 Simon Maurer
2021-09-20 16:52 Simon Maurer
2021-09-20 16:31 Denis Kenzior
2021-09-20 16:00 Simon Maurer
2021-09-20 15:29 Denis Kenzior
2021-09-20 15:23 Simon Maurer
2021-09-20 10:22 Simon Maurer
2021-09-20  9:20 Marcel Holtmann
2021-09-20  9:14 Simon Maurer
2021-09-20  8:15 Simon Maurer
2021-09-19 19:59 Marcel Holtmann
2021-09-19 19:43 Simon Maurer
2021-09-19 18:00 Denis Kenzior
2021-09-19 17:12 Simon Maurer

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=7c57da7d-6ac9-6a63-62fd-42453f7bedf9@gmail.com \
    --to=unknown@example.com \
    /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.