Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2229851imd; Fri, 2 Nov 2018 08:03:21 -0700 (PDT) X-Google-Smtp-Source: AJdET5eQQjNvnbCuE5c8hRBTha7OwgqJ1izw9NUNojtQ3jffqPKTUv7hwuqEcso/aEdPa52doVen X-Received: by 2002:aa7:8252:: with SMTP id e18-v6mr12253877pfn.164.1541171001508; Fri, 02 Nov 2018 08:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541171001; cv=none; d=google.com; s=arc-20160816; b=tE7v9dAJIhkVIi2fAtCbCcY6PBkKhpLdfp3Tb5GxZAncEG1YeqniT2dSD32Pnvof90 9R8RZqiICMwdD69x15CivCgYEKk/sAyXPJwQjKMNbq3GTPEAIeoKUeRCj4FgdcGOPI1B fuzGaw3jPbBkYd1I8nxXaeL4sH05JUXR8krrYPjtTvjqDZayLPBuR2LpbkkMZ8kb/PJK aLXKIBXuSm3rEVZtmC6c+7TvqNxuFBZAJIBYrsri8K9QfW5NvB7htGLrFvjYH8h0T/xh HruyzEM31MlSa30V3qAkLRlnyoDSi5O7MZ+Z3GgENnrD/6yGkhffuiKjSerZ5MjCrZvK /VUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=iM90kwRuT+1tjvrB3sucisU5bMldst4ai1l+ofDmdoE=; b=NWFp5hkmqQtB6eZzdXY1cm8X6ERESVtDPsCYjAI5UOE/M0kksIhUGRURLIFJAiaU+d RrCT/kjcjEMT2tta5R5soEsAPY4eaETNXUlfZfkIy4jdfaJcCRYEdLFqVl9EK6zgWq1V IR2SM0R3XmZbpnfUbyxJmwvn3TvVGGMpYPFoqJc8VsGoXhQjs0XAAqZGQs2iCp3zcG6s 6X0EtGoArKVbrNpXNwpGdRbJSFo6XvFGBB9lXrq6WUV8gpPEbMp20WZGuIgEXiUXMXrQ fpCLq2Ov61sWVjEUD2WhIB6TsztaQYLbUQLrVs0wBa3LsfzCYvzyGEMAKNJK92tOgO64 4qHw== 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 12-v6si34256310pgq.337.2018.11.02.08.03.05; Fri, 02 Nov 2018 08:03:21 -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 S1728073AbeKCAIU (ORCPT + 99 others); Fri, 2 Nov 2018 20:08:20 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34952 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727676AbeKCAIU (ORCPT ); Fri, 2 Nov 2018 20:08:20 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6547F7F6A8; Fri, 2 Nov 2018 15:00:57 +0000 (UTC) Received: from localhost (ovpn-8-27.pek2.redhat.com [10.72.8.27]) by smtp.corp.redhat.com (Postfix) with ESMTP id A54805D9C9; Fri, 2 Nov 2018 15:00:56 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, Ming Lei , Thomas Gleixner , linux-kernel@vger.kernel.org, Hannes Reinecke , Keith Busch , Sagi Grimberg Subject: [PATCH 3/4] irq: pass first vector to __irq_build_affinity_masks Date: Fri, 2 Nov 2018 22:59:50 +0800 Message-Id: <20181102145951.31979-4-ming.lei@redhat.com> In-Reply-To: <20181102145951.31979-1-ming.lei@redhat.com> References: <20181102145951.31979-1-ming.lei@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 02 Nov 2018 15:00:57 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org No functional change, and prepare for the following patch to support allocating (and affinitizing) sets of IRQs, in which each set of IRQ needs whole 2-stage spread, and the 1st vector should point to the 1st one in this set. Cc: Thomas Gleixner Cc: linux-kernel@vger.kernel.org Cc: Hannes Reinecke Cc: Ming Lei Cc: Keith Busch Cc: Sagi Grimberg Signed-off-by: Ming Lei --- kernel/irq/affinity.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/kernel/irq/affinity.c b/kernel/irq/affinity.c index a16b601604aa..9c74f21ab10e 100644 --- a/kernel/irq/affinity.c +++ b/kernel/irq/affinity.c @@ -95,14 +95,14 @@ static int get_nodes_in_cpumask(cpumask_var_t *node_to_cpumask, } static int __irq_build_affinity_masks(const struct irq_affinity *affd, - int startvec, int numvecs, + int startvec, int numvecs, int firstvec, cpumask_var_t *node_to_cpumask, const struct cpumask *cpu_mask, struct cpumask *nmsk, struct cpumask *masks) { int n, nodes, cpus_per_vec, extra_vecs, done = 0; - int last_affv = affd->pre_vectors + numvecs; + int last_affv = firstvec + numvecs; int curvec = startvec; nodemask_t nodemsk = NODE_MASK_NONE; @@ -121,7 +121,7 @@ static int __irq_build_affinity_masks(const struct irq_affinity *affd, if (++done == numvecs) break; if (++curvec == last_affv) - curvec = affd->pre_vectors; + curvec = firstvec; } goto out; } @@ -130,7 +130,7 @@ static int __irq_build_affinity_masks(const struct irq_affinity *affd, int ncpus, v, vecs_to_assign, vecs_per_node; /* Spread the vectors per node */ - vecs_per_node = (numvecs - (curvec - affd->pre_vectors)) / nodes; + vecs_per_node = (numvecs - (curvec - firstvec)) / nodes; /* Get the cpus on this node which are in the mask */ cpumask_and(nmsk, cpu_mask, node_to_cpumask[n]); @@ -158,7 +158,7 @@ static int __irq_build_affinity_masks(const struct irq_affinity *affd, if (done >= numvecs) break; if (curvec >= last_affv) - curvec = affd->pre_vectors; + curvec = firstvec; --nodes; } @@ -191,8 +191,8 @@ static int irq_build_affinity_masks(const struct irq_affinity *affd, /* Spread on present CPUs starting from affd->pre_vectors */ usedvecs = __irq_build_affinity_masks(affd, curvec, numvecs, - node_to_cpumask, cpu_present_mask, - nmsk, masks); + affd->pre_vectors, node_to_cpumask, + cpu_present_mask, nmsk, masks); /* * Spread on non present CPUs starting from the next vector to be @@ -206,8 +206,8 @@ static int irq_build_affinity_masks(const struct irq_affinity *affd, curvec = affd->pre_vectors + usedvecs; cpumask_andnot(npresmsk, cpu_possible_mask, cpu_present_mask); usedvecs += __irq_build_affinity_masks(affd, curvec, numvecs, - node_to_cpumask, npresmsk, - nmsk, masks); + affd->pre_vectors, node_to_cpumask, npresmsk, + nmsk, masks); put_online_cpus(); free_cpumask_var(npresmsk); -- 2.9.5