mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-21 23:16:50 +08:00
eventpoll: Convert epoll_put_uevent() to scoped user access
Saves two function calls, and one stac/clac pair. stac/clac is rather expensive on older cpus like Zen 2. A synthetic network stress test gives a ~1.5% increase of pps on AMD Zen 2. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Dave Hansen <dave.hansen@intel.com> Cc: Kuniyuki Iwashima <kuniyu@google.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
3b5d535c63
commit
1954c4f012
@@ -82,11 +82,14 @@ static inline struct epoll_event __user *
|
||||
epoll_put_uevent(__poll_t revents, __u64 data,
|
||||
struct epoll_event __user *uevent)
|
||||
{
|
||||
if (__put_user(revents, &uevent->events) ||
|
||||
__put_user(data, &uevent->data))
|
||||
return NULL;
|
||||
|
||||
scoped_user_write_access_size(uevent, sizeof(*uevent), efault) {
|
||||
unsafe_put_user(revents, &uevent->events, efault);
|
||||
unsafe_put_user(data, &uevent->data, efault);
|
||||
}
|
||||
return uevent+1;
|
||||
|
||||
efault:
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user