From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754881AbdDNUhR (ORCPT ); Fri, 14 Apr 2017 16:37:17 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:43302 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751518AbdDNUhO (ORCPT ); Fri, 14 Apr 2017 16:37:14 -0400 Date: Fri, 14 Apr 2017 22:36:56 +0200 (CEST) From: Thomas Gleixner To: Chen Yu cc: Prarit Bhargava , Ingo Molnar , "H. Peter Anvin" , "Rafael J. Wysocki" , Len Brown , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/irq: Do not check available vectors if current CPU has no irq to migrate In-Reply-To: <20170410155151.GA9186@yu-desktop-1.sh.intel.com> Message-ID: References: <1491746031-31107-1-git-send-email-yu.c.chen@intel.com> <58EB6BE7.6020802@redhat.com> <20170410155151.GA9186@yu-desktop-1.sh.intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 10 Apr 2017, Chen Yu wrote: > I've just done a comparison of the function duration of > check_irq_vectors_for_cpu_disable() with/without the patch > (32 online CPUs) > before patch: > [001] d..1 264.017803: check_irq_vectors_for_cpu_disable <-native_cpu_disable > [001] d..1 264.017886: clear_local_APIC <-native_cpu_disable > after patch: > [001] d..1 862.011847: check_irq_vectors_for_cpu_disable <-native_cpu_disable > [001] d..1 862.011850: clear_local_APIC <-native_cpu_disable > About (83 - 17) = 66 microsecond. Not really impressive if you subtract the tracer overhead. Though, if you want to micro optimize that, then you should do it proper and also break the for_each_cpu_loop() when the count reaches the required vectors. Thanks, tglx --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -411,8 +411,10 @@ int check_irq_vectors_for_cpu_disable(vo for (vector = FIRST_EXTERNAL_VECTOR; vector < first_system_vector; vector++) { if (!test_bit(vector, used_vectors) && - IS_ERR_OR_NULL(per_cpu(vector_irq, cpu)[vector])) - count++; + IS_ERR_OR_NULL(per_cpu(vector_irq, cpu)[vector])) { + if (++count == this_count) + return 0; + } } }