* [patch] poll: minor opts
@ 2005-01-12 3:18 pmeda
0 siblings, 0 replies; only message in thread
From: pmeda @ 2005-01-12 3:18 UTC (permalink / raw)
To: akpm; +Cc: linux-mm
poll mini optimisations:
When poll returns error, we do not need to copy out the the revents.
When poll returns succeess, we can copy pollfds in units of pages, since
there is no harm in copying fds and events back.
Signed-off-by: Prasanna Meda <pmeda@akamai.com>
--- a/fs/select.c Wed Jan 12 01:59:08 2005
+++ b/fs/select.c Wed Jan 12 02:31:45 2005
@@ -501,24 +501,24 @@
}
i -= pp->len;
}
- fdcount = do_poll(nfds, head, &table, timeout);
+
+ err = fdcount = do_poll(nfds, head, &table, timeout);
+ if (!fdcount && signal_pending(current))
+ err = -EINTR;
+ if (err < 0)
+ goto out_fds;
/* OK, now copy the revents fields back to user space. */
walk = head;
err = -EFAULT;
while(walk != NULL) {
struct pollfd *fds = walk->entries;
- int j;
-
- for (j=0; j < walk->len; j++, ufds++) {
- if(__put_user(fds[j].revents, &ufds->revents))
- goto out_fds;
- }
+ if (copy_to_user(ufds, fds, sizeof(struct pollfd) * walk->len))
+ goto out_fds;
+ ufds += walk->len;
walk = walk->next;
}
err = fdcount;
- if (!fdcount && signal_pending(current))
- err = -EINTR;
out_fds:
walk = head;
while(walk!=NULL) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-12 3:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-12 3:18 [patch] poll: minor opts pmeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox