Re: recvfrom/recvmsg performance and CONFIG_HARDENED_USERCOPY

From: Eric Dumazet
Date: Fri Dec 06 2019 - 11:19:11 EST




On 12/6/19 8:09 AM, Paolo Abeni wrote:

> Oh, nice! I though the compiler was smart enough to avoid the indirect
> call with the current code, but it looks like that least gcc 9.2.1 is
> not.
>
> Thanks for pointing that out!
>
> In this specific scenario I think the code you propose above is better
> than INDIRECT_CALL.
>
> Would you submit the patch formally?

Certainly, although I am not sure this will be enough to close
the gap between recvmsg() and recvfrom() :)

Also I was wondering if a likely() or unlikely() clause would
make sense.

This could prevent an over zealous compiler optimizer
to put back the indirect call that we tried to avoid.