From: pmeda@akamai.com
To: akpm@osdl.org
Cc: linux-mm@kvack.org
Subject: [patch] poll: minor opts
Date: Tue, 11 Jan 2005 19:18:26 -0800 [thread overview]
Message-ID: <200501120318.TAA01328@allur.sanmateo.akamai.com> (raw)
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>
reply other threads:[~2005-01-12 3:15 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=200501120318.TAA01328@allur.sanmateo.akamai.com \
--to=pmeda@akamai.com \
--cc=akpm@osdl.org \
--cc=linux-mm@kvack.org \
/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