Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Eric Dumazet and committed by
Linus Torvalds
1954c4f0 3b5d535c

+7 -4
+7 -4
include/linux/eventpoll.h
··· 82 82 epoll_put_uevent(__poll_t revents, __u64 data, 83 83 struct epoll_event __user *uevent) 84 84 { 85 - if (__put_user(revents, &uevent->events) || 86 - __put_user(data, &uevent->data)) 87 - return NULL; 88 - 85 + scoped_user_write_access_size(uevent, sizeof(*uevent), efault) { 86 + unsafe_put_user(revents, &uevent->events, efault); 87 + unsafe_put_user(data, &uevent->data, efault); 88 + } 89 89 return uevent+1; 90 + 91 + efault: 92 + return NULL; 90 93 } 91 94 #endif 92 95