public inbox for [email protected]
 help / color / mirror / Atom feed
From: Josh Triplett <[email protected]>
To: Jens Axboe <[email protected]>, [email protected]
Subject: RFC: userspace-allocated file descriptors for "fixed files" for open?
Date: Tue, 11 Feb 2020 14:32:35 -0800	[thread overview]
Message-ID: <20200211223235.GA25104@localhost> (raw)

The X Window System had a solution that allowed an asynchronous batch of
"create thing, do stuff with thing": X allowed the client to allocate
XIDs, and just had an operation for "give me an additional batch of XIDs
I can allocate".

Could we do the same thing in io_uring, as a variant of the "fixed file"
concept? Suppose that we add a call to preallocate a large contiguous
range of file descriptors, and ensure that the kernel never allocates
those file descriptors for an application.  We could then allow
userspace to *tell* the kernel to use a specific preallocated file
descriptor in that range when it does an OPENAT or OPENAT2 operation,
and then go on to use that file descriptor in a subsequent
read/write/close/etc operation.

(If the open operation returns an error, it won't have allocated that
file descriptor, so subsequent operations will just fail quickly with
EBADF, which seems fine.)

This seems simple for userspace to deal with, and would work for many
use cases.

Thoughts?

- Josh Triplett

                 reply	other threads:[~2020-02-11 22:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20200211223235.GA25104@localhost \
    [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