Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp5626846imm; Sat, 19 May 2018 06:14:10 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZfeKb/3sEtvY/DX6ElkMzEO8R5s6Rr7ve0nKWSUjHNX9jiNMAkWpiBTR83x9MttqTMMnH X-Received: by 2002:a17:902:76c1:: with SMTP id j1-v6mr13297508plt.284.1526735650151; Sat, 19 May 2018 06:14:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526735650; cv=none; d=google.com; s=arc-20160816; b=QA5pM5ItIIlFa600+xDQznl0UTejplhrd4sk8WZjXywdzjochsZTgnYyfVJBXycf4B /9plvZjaBDCVaXYNdgvoHpJd7qZLbJTYUYkvkTaGoxNroAe3fymMy/EluHeRjoVCbCRQ KfxxxqGbZYUsTEXfOwKkNHx7v1tEtwosL2gf1k2GskXgOF2HJL59Q9bkGuzyZjL9WSh/ 6AN18ZSFn5EZKUrF+NdRvh7RdOgFg0zr3/8aUiz+4wlL7l0qAuPwF7y4n3C3tmqlmM2C 8iPAdgJqp+AwIEPsHVgApnTbBeleax/9qCbJgh63XfgUWmHM+vQpMpUJbdmQCoXRdd5n 9RDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:arc-authentication-results; bh=KtH7eCQpjryhib8v+KzMCXZgLhH5Da+ElleRdFqucO4=; b=0NGEH3v/+aki2rPUqsY/PdbQUISEAGrib/1VI8NO+Jr/XHQ1XRgmyFojmUtfG0d9Y7 NI3DvFqSiEv02F7UNS6dRyTAfNu1qZb9XcDw4mYguGKg8iPtfnftthI3ZCzX8mh8gtFd qfO1P9LV/jdpZUoCNxBg/Grln7nSe1VcSlHi/MQJXu6SSkWjJ1dz3hHKe3zUlMszjKrB N8v+xYaRFYH9bT+Eoh4CIMn0hGCc3JrnRw9G9ypSuCsSWgzTWfgQfxm2e3OciwIHE7F9 dywDj2WRB09HCu4UPZoTaYwzyumZql92Y29mJ2FHOvfNf83vGk81573LEnAaBIdmmnU+ WXRw== 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 z3-v6si9078130pln.292.2018.05.19.06.13.14; Sat, 19 May 2018 06:14:10 -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 S1752265AbeESNM7 (ORCPT + 99 others); Sat, 19 May 2018 09:12:59 -0400 Received: from terminus.zytor.com ([198.137.202.136]:56955 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751994AbeESNM6 (ORCPT ); Sat, 19 May 2018 09:12:58 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id w4JDCntg2823934 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 19 May 2018 06:12:49 -0700 Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id w4JDCn8k2823931; Sat, 19 May 2018 06:12:49 -0700 Date: Sat, 19 May 2018 06:12:49 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Dou Liyang Message-ID: Cc: mingo@kernel.org, tglx@linutronix.de, hpa@zytor.com, linux-kernel@vger.kernel.org, douly.fnst@cn.fujitsu.com Reply-To: douly.fnst@cn.fujitsu.com, hpa@zytor.com, linux-kernel@vger.kernel.org, tglx@linutronix.de, mingo@kernel.org In-Reply-To: <20180511080956.6316-1-douly.fnst@cn.fujitsu.com> References: <20180511080956.6316-1-douly.fnst@cn.fujitsu.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/apic] x86/vector: Merge allocate_vector() into assign_vector_locked() Git-Commit-ID: 2773397171ac4b6e794ba0b3e34c06cbaf29897a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, T_DATE_IN_FUTURE_96_Q autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 2773397171ac4b6e794ba0b3e34c06cbaf29897a Gitweb: https://git.kernel.org/tip/2773397171ac4b6e794ba0b3e34c06cbaf29897a Author: Dou Liyang AuthorDate: Fri, 11 May 2018 16:09:56 +0800 Committer: Thomas Gleixner CommitDate: Sat, 19 May 2018 15:09:11 +0200 x86/vector: Merge allocate_vector() into assign_vector_locked() assign_vector_locked() calls allocate_vector() to get a real vector for an IRQ. If the current target CPU is online and in the new requested affinity mask, allocate_vector() will return 0 and nothing should be done. But, assign_vector_locked() calls apic_update_irq_cfg() even in that case which is pointless. allocate_vector() is not called from anything else, so the functions can be merged and in case of no change the apic_update_irq_cfg() can be avoided. [ tglx: Massaged changelog ] Signed-off-by: Dou Liyang Signed-off-by: Thomas Gleixner Cc: hpa@zytor.com Link: https://lkml.kernel.org/r/20180511080956.6316-1-douly.fnst@cn.fujitsu.com --- arch/x86/kernel/apic/vector.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/apic/vector.c b/arch/x86/kernel/apic/vector.c index bb6f7a2148d7..a75de0792942 100644 --- a/arch/x86/kernel/apic/vector.c +++ b/arch/x86/kernel/apic/vector.c @@ -218,7 +218,8 @@ static int reserve_irq_vector(struct irq_data *irqd) return 0; } -static int allocate_vector(struct irq_data *irqd, const struct cpumask *dest) +static int +assign_vector_locked(struct irq_data *irqd, const struct cpumask *dest) { struct apic_chip_data *apicd = apic_chip_data(irqd); bool resvd = apicd->has_reserved; @@ -236,22 +237,12 @@ static int allocate_vector(struct irq_data *irqd, const struct cpumask *dest) return 0; vector = irq_matrix_alloc(vector_matrix, dest, resvd, &cpu); - if (vector > 0) - apic_update_vector(irqd, vector, cpu); trace_vector_alloc(irqd->irq, vector, resvd, vector); - return vector; -} - -static int assign_vector_locked(struct irq_data *irqd, - const struct cpumask *dest) -{ - struct apic_chip_data *apicd = apic_chip_data(irqd); - int vector = allocate_vector(irqd, dest); - if (vector < 0) return vector; + apic_update_vector(irqd, vector, cpu); + apic_update_irq_cfg(irqd, vector, cpu); - apic_update_irq_cfg(irqd, apicd->vector, apicd->cpu); return 0; }