Commit 8d4198e6 authored by Davide Libenzi's avatar Davide Libenzi Committed by Linus Torvalds

[PATCH] Avoid unnecessary copy for EPOLL_CTL_DEL

Ulrich Drepper points out that EPOLL_CTL_DEL doesn't need to copy any of
the hash events.

Also, we should specify in the man pages that a NULL is allowed in
EPOLL_CTL_DEL.  Currently it does not say that. 

Also, starting from when epoll uses rbtrees instead of hashes, the
'size' hint passed to epoll_create(2) is no more used.  But since an API
change has clearly to be excluded, I guess it'll stay as is.
Signed-off-by: default avatarDavide Libenzi <davidel@xmailserver.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 28667920
......@@ -148,6 +148,9 @@
/* Get the "struct epitem" from an epoll queue wrapper */
#define EP_ITEM_FROM_EPQUEUE(p) (container_of(p, struct ep_pqueue, pt)->epi)
/* Tells if the epoll_ctl(2) operation needs an event copy from userspace */
#define EP_OP_HASH_EVENT(op) ((op) != EPOLL_CTL_DEL)
struct epoll_filefd {
struct file *file;
......@@ -531,7 +534,8 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
current, epfd, op, fd, event));
error = -EFAULT;
if (copy_from_user(&epds, event, sizeof(struct epoll_event)))
if (EP_OP_HASH_EVENT(op) &&
copy_from_user(&epds, event, sizeof(struct epoll_event)))
goto eexit_1;
/* Get the "struct file *" for the eventpoll file */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment