Received: by 10.192.165.156 with SMTP id m28csp307499imm; Wed, 18 Apr 2018 22:44:28 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/489tMhprVS3ugV58TKxe4S52wyX3qsiL6+O4gHslYazlIm4+5sm/bYUVO24WmlY1OPS7O X-Received: by 2002:a17:902:7684:: with SMTP id m4-v6mr170797pll.340.1524116668025; Wed, 18 Apr 2018 22:44:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524116667; cv=none; d=google.com; s=arc-20160816; b=TLx6VcgrQ9EkWwdpKP1F4Tr8S1N+Lq7PGlN59WyN0nwGyNKulqR8HkemlsyIOGeVNp JBDgnuSM4sEcj/6rluPgeRBytMoxDgifqSYiJiJTw981Ji1RCw13Uq67ltSf0tuTCGxZ bGgXHgmC6XHdMMkVomFKzxk67ws5stikTTJcBjIjWW+VNjsVD5+nToSAXhbHyw3VRL5j Tc0XHA82CLe7BW0RnMl96+30I9b2s4DvgogML+h4joQttDwLAI1QjmFTB78B5B37JoTd 62TZ11Mn75Tc8lZuCU8rkzivNIUNVrQDr+f+vaNABPYUWm7Y1lTzft50pSU+RFj8LBrn yptw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=5m8zNOazcZN1czv3WC2ADSVkrKw4jbKfMfPp5wDyfW4=; b=aJcxBQOU6q89YgJ+47Qk7JxK2FtOYrrD3H+9PsvHx6sE7X6COKhGeC2SigI37NcWay kGI+EhY8jAgyab+r+Rb14pWNRo8xJkLVwIMl4ttC8wmvuEWq+1NoFkKiaLx7O6h98chr E3r3/pdQaOikBGrQwpeQgR6bGlDe48GapPyEHQSs0kzWjjcSRfuU5ngF+VYzsHgYomu3 I3RQtISZ74FMdVQ2I01GY3/P3PbiUVVmJbxW0TDLyG2wd9AhH1+Iz2J0sVgTKPI5aj3+ fNqEowUY1dNWBA/p9IQw3WuQT8058ea3DVRKfQ3oX0G+6KHJlktVk6tUU44PWHBwAMj1 UPHw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si2677446plz.279.2018.04.18.22.44.13; Wed, 18 Apr 2018 22:44:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753187AbeDSFnH (ORCPT + 99 others); Thu, 19 Apr 2018 01:43:07 -0400 Received: from lgeamrelo11.lge.com ([156.147.23.51]:37228 "EHLO lgeamrelo11.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbeDSFnG (ORCPT ); Thu, 19 Apr 2018 01:43:06 -0400 Received: from unknown (HELO lgeamrelo01.lge.com) (156.147.1.125) by 156.147.23.51 with ESMTP; 19 Apr 2018 14:43:04 +0900 X-Original-SENDERIP: 156.147.1.125 X-Original-MAILFROM: namhyung@kernel.org Received: from unknown (HELO sejong) (10.177.227.17) by 156.147.1.125 with ESMTP; 19 Apr 2018 14:43:03 +0900 X-Original-SENDERIP: 10.177.227.17 X-Original-MAILFROM: namhyung@kernel.org Date: Thu, 19 Apr 2018 14:43:02 +0900 From: Namhyung Kim To: Masami Hiramatsu Cc: Joel Fernandes , linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, Steven Rostedt , Peter Zilstra , Ingo Molnar , Mathieu Desnoyers , Tom Zanussi , Thomas Glexiner , Boqun Feng , Paul McKenney , Frederic Weisbecker , Randy Dunlap , Fenguang Wu , Baohong Liu , Vedang Patel , kernel-team@lge.com Subject: Re: [RFC v4 3/4] irqflags: Avoid unnecessary calls to trace_ if you can Message-ID: <20180419054302.GD13370@sejong> References: <20180417040748.212236-1-joelaf@google.com> <20180417040748.212236-4-joelaf@google.com> <20180418180250.7b6038dddba46b37c94b796c@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180418180250.7b6038dddba46b37c94b796c@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 18, 2018 at 06:02:50PM +0900, Masami Hiramatsu wrote: > On Mon, 16 Apr 2018 21:07:47 -0700 > Joel Fernandes wrote: > > > With TRACE_IRQFLAGS, we call trace_ API too many times. We don't need > > to if local_irq_restore or local_irq_save didn't actually do anything. > > > > This gives around a 4% improvement in performance when doing the > > following command: "time find / > /dev/null" > > > > Also its best to avoid these calls where possible, since in this series, > > the RCU code in tracepoint.h seems to be call these quite a bit and I'd > > like to keep this overhead low. > > Can we assume that the "flags" has only 1 bit irq-disable flag? > Since it skips calling raw_local_irq_restore(flags); too, I don't know how many it impacts on performance but maybe we can have an arch-specific config option something like below? > if there is any state in the flags on any arch, it may change the > result. In that case, we can do it as below (just skipping trace_hardirqs_*) > > int disabled = irqs_disabled(); if (disabled == raw_irqs_disabled_flags(flags)) { #ifndef CONFIG_ARCH_CAN_SKIP_NESTED_IRQ_RESTORE raw_local_irq_restore(flags); #endif return; } > > if (!raw_irqs_disabled_flags(flags) && disabled) > trace_hardirqs_on(); > > raw_local_irq_restore(flags); > > if (raw_irqs_disabled_flags(flags) && !disabled) > trace_hardirqs_off(); Thanks, Namhyung