Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754434AbdCJCnU (ORCPT ); Thu, 9 Mar 2017 21:43:20 -0500 Received: from mail-ua0-f182.google.com ([209.85.217.182]:35150 "EHLO mail-ua0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750816AbdCJCnT (ORCPT ); Thu, 9 Mar 2017 21:43:19 -0500 MIME-Version: 1.0 In-Reply-To: <20170309224447.678652367@goodmis.org> References: <20170309224204.066497548@goodmis.org> <20170309224447.678652367@goodmis.org> From: Andy Lutomirski Date: Thu, 9 Mar 2017 18:42: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: 605 Lines: 23 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 :) --Andy