mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ken Chen" <kenchen@google.com>
To: "Zach Brown" <zach.brown@oracle.com>
Cc: akpm@linux-foundation.org, linux-aio@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] convert aio event reap to use atomic-op instead of spin_lock
Date: Wed, 11 Apr 2007 12:28:26 -0700	[thread overview]
Message-ID: <b040c32a0704111228t5065253en9249ff88db5b1384@mail.gmail.com> (raw)
In-Reply-To: <20070411180038.GN28322@mami.zabbo.net>

On 4/11/07, Zach Brown <zach.brown@oracle.com> wrote:
> First, I'll NAK this and all AIO patches until the patch description
> says that it's been run through the regression tests that we've started
> collecting in autotest.  They're trivial to run, never fear:

OK.  I will run those regression tests.


> > Resurrect an old patch that uses atomic operation to update ring buffer
> > index on AIO event queue.  This work allows futher application/libaio
> > optimization to run fast path io_getevents in user space.
>
> I have mixed feelings.  I think the userspace getevents support was
> poorly designed and the simple fact that we've gone this long without it
> says just how desperately the feature isn't needed.

I kept on getting requests from application developers who want that
feature.  My initial patch was dated back May 2004.


> We're allocating more ring elements
> than userspace asked for and than were accounted for in aio_max_nr.
> That cost, however teeny, will be measured against the benefit.

I noticed that while writing the patch.  We have the same bug right
now that nr_events is enlarged to consume the entire mmap'ed ring
buffer pages.  But yet, we don't account those in aio_max_nr.  I
didn't fix that up in this patch because I was going to do a separate
patch on that.


> > -     /* Compensate for the ring buffer's head/tail overlap entry */
> > -     nr_events += 2; /* 1 is required, 2 for good luck */
> > +     /* round nr_event to next power of 2 */
> > +     nr_events = roundup_pow_of_two(nr_events);
>
> Is that buggy?  How will the code tell if head == tail means a full ring
> or an empty ring?  The old code added that extra event to let it tell
> the ring was full before head == tail and it would think it's empty
> again, I think.  I'm guessing roundup(nr_events + 1) is needed.

I don't think it's a bug.  akpm taught me the trick: we don't wrap the
index around the ring size in this scheme, so the extra space is not
needed.


> The ring page, which is mmaped to userspace at some weird address, was
> just written through a kmap.  Do we need a flush_dcache_page()?  This
> isn't this patch's problem, but it'd need to be addressed if we're using
> the ring from userspace.

I will look into this aside from this patch.

- Ken

  parent reply	other threads:[~2007-04-11 19:29 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 23:53 Ken Chen
2007-04-11  5:18 ` Andrew Morton
2007-04-11 16:54   ` Ken Chen
2007-04-11 18:15     ` Zach Brown
2007-04-11 18:29       ` Ken Chen
2007-04-11 18:00 ` Zach Brown
2007-04-11 19:11   ` Andrew Morton
2007-04-11 19:34     ` Zach Brown
2007-04-11 19:28   ` Ken Chen [this message]
2007-04-11 19:44     ` Zach Brown
2007-04-11 19:45     ` Benjamin LaHaise
2007-04-11 19:52       ` Zach Brown
2007-04-11 20:03         ` Benjamin LaHaise
2007-04-12  7:29     ` Ken Chen
2007-04-12 12:06       ` Jeff Moyer
2007-04-13  0:57         ` Ken Chen
2007-04-13  1:08           ` Ken Chen
2007-04-12  7:50   ` Ken Chen
2007-04-12 14:31     ` Benjamin LaHaise
2007-04-12 15:13       ` Benjamin LaHaise

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=b040c32a0704111228t5065253en9249ff88db5b1384@mail.gmail.com \
    --to=kenchen@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-aio@kvack.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zach.brown@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®