Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753846AbdCJDvU (ORCPT ); Thu, 9 Mar 2017 22:51:20 -0500 Received: from mail-ua0-f177.google.com ([209.85.217.177]:34349 "EHLO mail-ua0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbdCJDvT (ORCPT ); Thu, 9 Mar 2017 22:51:19 -0500 MIME-Version: 1.0 In-Reply-To: References: <20170309224204.066497548@goodmis.org> <20170309224447.678652367@goodmis.org> From: Andy Lutomirski Date: Thu, 9 Mar 2017 19:50:57 -0800 Message-ID: Subject: Re: [PATCH 1/2] x86/nmi: Optimize the check for being in the repeat_nmi code To: Steven Rostedt Cc: "linux-kernel@vger.kernel.org" , Linus Torvalds , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andy Lutomirski , Andrew Morton Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1063 Lines: 33 On Thu, Mar 9, 2017 at 7:49 PM, Steven Rostedt wrote: > > > On March 9, 2017 9:42:57 PM EST, Andy Lutomirski wrote: >>On Thu, Mar 9, 2017 at 2:42 PM, Steven Rostedt >>wrote: >>> From: "Steven Rostedt (Red Hat)" >>> >>> 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. > One might argue that the world would be a better place if the assembly programmer in some people died a little.