Re: [PATCH 1/2] x86/nmi: Optimize the check for being in the repeat_nmi code

From: Steven Rostedt
Date: Thu Mar 09 2017 - 22:50:12 EST




On March 9, 2017 9:42:57 PM EST, Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
>On Thu, Mar 9, 2017 at 2:42 PM, Steven Rostedt <rostedt@xxxxxxxxxxx>
>wrote:
>> From: "Steven Rostedt (Red Hat)" <rostedt@xxxxxxxxxxx>
>>
>> Linus mentioned that doing two compares can be replaced by a single
>> compare. That is, instead of:
>>
>> movq $repeat_nmi, %rdx
>> cmpq 8(%rsp), %rdx
>> ja not_in_region
>> movq $end_repeat_nmi, %rdx
>> cmpq 8(%rsp), %rdx
>> ja in_region
>>
>> we can replace that with:
>>
>> movq 8(%rsp), %rdx
>> subq $repeat_nmi, %rdx
>> cmpq $end_repeat_nmi-repeat_nmi, %rdx
>> jb in_region
>
>Seems reasonable to me. Good luck ever noticing the speedup :)
>

It had nothing to do with speedup. Linus said that the current code makes the assembly programmer in him die a little. I want to cure that.

-- Steve

>--Andy

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.