Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5268144ybl; Tue, 27 Aug 2019 01:56:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwgeWXh/zvvdUbyR9gnLyN2xp9wBc9wuSeD+iAYDFh30cXxz/FoAsPibsHYKhx4/rtXKQkw X-Received: by 2002:a17:902:2b81:: with SMTP id l1mr23236565plb.107.1566896168202; Tue, 27 Aug 2019 01:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566896168; cv=none; d=google.com; s=arc-20160816; b=XX70eRF8VABBXWMdyMFnwWoPY1qaCRRFo3fmzSLC8+z7kxu9wP/vm2rZzxR4yQtXo3 Pn/TK0cITYfJUkktzIoUpMETiEKDiI8pj6hwnDfGgYjXEDreEGYQwYk3MK4LtcR0iufz lIPKyY1N98tNFP9F7l+aucB5e3fPFuM1AHYeq7wPMc51xHt/ivg8zioASAYFv7bU88Wb w74mkdVayNTRzf/t53amoFTsokoNhlPhZSpqHtiJU4Lv0QYf0E9Bp0RY5MbpfeoyGaCQ 26VDjO6+ojYiDTGxdNcIAFWkulKj8HLt5mfUZFx1O9euMWyaNwlvy3UCKFkSUrrh/pCy q2Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=+EzKbVzXkFwRy5G4KMdSPhGk55M9fnRFNcJ7a4/M38Q=; b=OmKwlHfkjFk6hdXqk7aSoNy+xB3IG3p0/ISkkciXla3Sl4kkQibhW/2l21sIu54V05 lSteMfJdT2qfqpk2rO3JgbfZYlfQuIQWX5o/f1/SwLXlemNhc4e5GpIylmyFYk2sVpty I+MRjObum5/Yd+LLt8cagKwKqJpYs66pzWdCGGam0wx1TfqktQaIi++vBf7izZhN0ozw ckxNin78w7XkJ2VSZ2K9mVYpzGAaNPIsIxmLdfspEIrpWs+K5A/NrRxepkEFexlqOHkK k9YbFomcauqqkAc9LqnKEgT6H5AnmP2lZ3RveSPteG4Z60iKbwDhwsJsMlOb0IbPVNoA It0w== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si2075100pjy.34.2019.08.27.01.55.52; Tue, 27 Aug 2019 01:56:08 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729933AbfH0Iy1 (ORCPT + 99 others); Tue, 27 Aug 2019 04:54:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48684 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729895AbfH0IyZ (ORCPT ); Tue, 27 Aug 2019 04:54:25 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D729C308339B; Tue, 27 Aug 2019 08:54:24 +0000 (UTC) Received: from localhost (ovpn-8-27.pek2.redhat.com [10.72.8.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id E74585D71C; Tue, 27 Aug 2019 08:54:21 +0000 (UTC) From: Ming Lei To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, Ming Lei , Long Li , Ingo Molnar , Peter Zijlstra , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , John Garry , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org Subject: [PATCH 4/4] genirq: use irq's affinity for threaded irq with IRQF_RESCUE_THREAD Date: Tue, 27 Aug 2019 16:53:44 +0800 Message-Id: <20190827085344.30799-5-ming.lei@redhat.com> In-Reply-To: <20190827085344.30799-1-ming.lei@redhat.com> References: <20190827085344.30799-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 27 Aug 2019 08:54:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case of IRQF_RESCUE_THREAD, the threaded handler is only used to handle interrupt when IRQ flood comes, use irq's affinity for this thread so that scheduler may select other not too busy CPUs for handling the interrupt. Cc: Long Li Cc: Ingo Molnar , Cc: Peter Zijlstra Cc: Keith Busch Cc: Jens Axboe Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: John Garry Cc: Thomas Gleixner Cc: Hannes Reinecke Cc: linux-nvme@lists.infradead.org Cc: linux-scsi@vger.kernel.org Signed-off-by: Ming Lei --- kernel/irq/manage.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 1566abbf50e8..03bc041348b7 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -968,7 +968,18 @@ irq_thread_check_affinity(struct irq_desc *desc, struct irqaction *action) if (cpumask_available(desc->irq_common_data.affinity)) { const struct cpumask *m; - m = irq_data_get_effective_affinity_mask(&desc->irq_data); + /* + * Managed IRQ's affinity is setup gracefull on MUNA locality, + * also if IRQF_RESCUE_THREAD is set, interrupt flood has been + * triggered, so ask scheduler to run the thread on CPUs + * specified by this interrupt's affinity. + */ + if ((action->flags & IRQF_RESCUE_THREAD) && + irqd_affinity_is_managed(&desc->irq_data)) + m = desc->irq_common_data.affinity; + else + m = irq_data_get_effective_affinity_mask( + &desc->irq_data); cpumask_copy(mask, m); } else { valid = false; -- 2.20.1