[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200813073220.GB15436@infradead.org>
Date: Thu, 13 Aug 2020 08:32:20 +0100
From: Christoph Hellwig <hch@...radead.org>
To: Daniel Axtens <dja@...ens.net>
Cc: viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [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@...ens.net>
Seem like this could simply use a copy_to_user to further simplify
things?
Also please don't pointlessly add overly long lines.
Powered by blists - more mailing lists