[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87wo22n5ez.fsf@dja-thinkpad.axtens.net>
Date: Thu, 13 Aug 2020 21:36:52 +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
Hi,
>> Seem like this could simply use a copy_to_user to further simplify
>> things?
>
> I'll benchmark it and find out.
I tried this:
for (walk = head; walk; walk = walk->next) {
- struct pollfd *fds = walk->entries;
- int j;
-
- for (j = 0; j < walk->len; j++, ufds++)
- if (__put_user(fds[j].revents, &ufds->revents))
- goto out_fds;
+ if (copy_to_user(ufds, walk->entries,
+ sizeof(struct pollfd) * walk->len))
+ goto out_fds;
+ ufds += walk->len;
}
With that approach, the poll2 microbenchmark (which polls 128 fds) is
about as fast as v1.
However, the poll1 microbenchmark, which polls just 1 fd, regresses a
touch (<1% - ~2%) compared to the current code, although it's largely
within the noise. Thoughts?
Kind regards,
Daniel
>> 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