[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87zh6zlynh.fsf@dja-thinkpad.axtens.net>
Date: Thu, 13 Aug 2020 18:48:18 +1000
From: Daniel Axtens <dja@...ens.net>
To: Christoph Hellwig <hch@...radead.org>
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
Christoph Hellwig <hch@...radead.org> writes:
> 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?
I'll benchmark it and find out.
> Also please don't pointlessly add overly long lines.
Weird, I ran the commit through checkpatch and it didn't pick it
up. I'll check the next version more carefully.
Regards,
Daniel
Powered by blists - more mailing lists