lkml.org 
[lkml]   [2001]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] /dev/epoll update ...
On 2001.09.20 10:18 Davide Libenzi wrote:
> If you need to request the current status of a socket you've to
> f_ops->poll the fd.
> The cost of the extra read, done only for fds that are not "ready", is
> nothing
> compared to the cost of a linear scan with HUGE numbers of fds.
> You could implement a solution where the low level io functions goes
> directly to write
> inside the mmapped fd set where the data buffer is empty or the out
> buffer is full.
> This would be a way more intrusive patch whose perf gain won't match the
> cost.

But you missed the obvious optimization of doing an f_ops->poll when
the file is _added_. This means that you'll get an initial event when
there is data ready. This means you still never do a scan (only check
when an fd is added), but you don't have to do an empty read every time
you add an fd.

Before you argue that this does not save a system call, it will in
the typical case of:
<add fd>
<fail read>
<wait on events>
<successful read>

Note that it has the additional advantage of making the dispatch code
in the user application easier. You no longer have to do special code
to handle the speculative read after adding the fd.
-gordo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:03    [W:0.105 / U:2.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site