Re: [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression

From: Al Viro
Date: Thu Jan 07 2021 - 13:35:12 EST


On Thu, Jan 07, 2021 at 09:43:54AM -0800, Linus Torvalds wrote:

> Before, it would do the whole CLAC/STAC dance inside that loop for
> every entry (and with that commit d55564cfc22 it would be a function
> call, of course).
>
> Can you verify that this fixes the regression (and in fact I'd expect
> it to improve that test-case)?

I'm not sure it's the best approach, TBH. How about simply
for (walk = head; walk; ufds += walk->len, walk = walk->next) {
if (copy_to_user(ufds, walk->entries,
walk->len * sizeof(struct pollfd))
goto out_fds;
}
in there? It's both simpler (obviously matches the copyin side) and
might very well be faster...