Re: [RFC] microoptimizing hlist_add_{before,behind}

2019-09-21 Thread Linus Torvalds
On Fri, Sep 20, 2019 at 8:11 PM Al Viro wrote: > > My apologies ;-/ Correct diff follows: This is similar to what we do for the regular list_add(), so I have no objections to the micro-optimization. Of course, for list_add() we do it by using a helper function and passing those prev/next

Re: [RFC] microoptimizing hlist_add_{before,behind}

2019-09-20 Thread Al Viro
On Sat, Sep 21, 2019 at 12:12:33AM +0100, Al Viro wrote: > Neither hlist_add_before() nor hlist_add_behind() should ever > be called with both arguments pointing to the same hlist_node. > However, gcc doesn't know that, so it ends up with pointless reloads. > AFAICS, the following generates

[RFC] microoptimizing hlist_add_{before,behind}

2019-09-20 Thread Al Viro
Neither hlist_add_before() nor hlist_add_behind() should ever be called with both arguments pointing to the same hlist_node. However, gcc doesn't know that, so it ends up with pointless reloads. AFAICS, the following generates better code, is obviously equivalent in case when arguments are