lkml.org 
[lkml]   [2020]   [Aug]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] fs/select.c: batch user writes in do_sys_poll
On Thu, Aug 13, 2020 at 05:11:20PM +1000, Daniel Axtens wrote:
> When returning results to userspace, do_sys_poll repeatedly calls
> put_user() - once per fd that it's watching.
>
> This means that on architectures that support some form of
> kernel-to-userspace access protection, we end up enabling and disabling
> access once for each file descripter we're watching. This is inefficent
> and we can improve things by batching the accesses together.
>
> To make sure there's not too much happening in the window when user
> accesses are permitted, we don't walk the linked list with accesses on.
> This leads to some slightly messy code in the loop, unfortunately.
>
> Unscientific benchmarking with the poll2_threads microbenchmark from
> will-it-scale, run as `./poll2_threads -t 1 -s 15`:
>
> - Bare-metal Power9 with KUAP: ~48.8% speed-up
> - VM on amd64 laptop with SMAP: ~25.5% speed-up
>
> Signed-off-by: Daniel Axtens <dja@axtens.net>

Seem like this could simply use a copy_to_user to further simplify
things?

Also please don't pointlessly add overly long lines.

\
 
 \ /
  Last update: 2020-08-13 09:32    [W:0.038 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site