LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Eric Dumazet <dada1@cosmosbay.com>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [patch] epoll reduced (to 1) number of passes over the ready set ...
Date: Tue, 27 Feb 2007 10:15:33 +0100	[thread overview]
Message-ID: <200702271015.33123.dada1@cosmosbay.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0702261819250.4949@alien.or.mcafeemobile.com>

On Tuesday 27 February 2007 03:32, Davide Libenzi wrote:
> Epoll is doing multiple passes over the ready set at the moment, because
> of the constraints over the f_op->poll() call. Looking at the code again,
> I noticed that we already hold the epoll semaphore in read, and this
> (together with other locking conditions that hold while doing an
> epoll_wait()) can lead to a smarter way to "ship" events to userspace (in
> a single pass). I added more (even) more comments to the code to explain
> the conditions why certain operations are safe.
> This is a stress application that can be used to test the new code. It
> spwans multiple thread and call epoll_wait() and epoll_ctl() from many
> threads. Stress tested on my dual Opteron 254 w/out any problems.

Davide,

This is really cool, because the size of epitem would fit now in 128 bytes 
instead of 192 (on x86_64 platforms). So we also reduce memory usage.

I have one comment :

>  	 */
> -	list_for_each(lnk, txlist) {
> -		epi = list_entry(lnk, struct epitem, txlink);
> +	for (eventcnt = 0; !list_empty(txlist) && eventcnt < maxevents;) {
> +		epi = list_entry(txlist->next, struct epitem, rdllink);

Now that we scan the rdllist list once, it may be usefull to use a prefetch() 
hint. 

list_for_each() has one prefetch(pos->next) automatically included, but not 
your open coded loop.

I suggest adding after epi = list_entry(txlist->next, struct epitem, rdllink);
prefetch(epi->rdllink.next);

Thank you

  parent reply	other threads:[~2007-02-27  9:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-27  2:32 Davide Libenzi
2007-02-27  4:00 ` Linus Torvalds
2007-02-27  4:14   ` Davide Libenzi
2007-02-27  9:15 ` Eric Dumazet [this message]
2007-02-27 16:03   ` Davide Libenzi
2007-02-28 11:13     ` Eric Dumazet
2007-02-28 15:29       ` Davide Libenzi

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=200702271015.33123.dada1@cosmosbay.com \
    --to=dada1@cosmosbay.com \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --subject='Re: [patch] epoll reduced (to 1) number of passes over the ready set ...' \
    /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

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).