Received: by 10.192.165.156 with SMTP id m28csp286203imm; Tue, 17 Apr 2018 10:06:18 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/XSXOS9CqXiVrUFvFqOmzn2rJD137oe0qKgyOfh7x++xV1k8TBO//oonq9pC2LYqChNrbB X-Received: by 10.98.201.137 with SMTP id l9mr2629655pfk.221.1523984778497; Tue, 17 Apr 2018 10:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523984778; cv=none; d=google.com; s=arc-20160816; b=qASNE4YVatBWabqxMKqWXjA3OMcLv7Bm+VmLx9wzY1oM6R4TdsiYqxDXj9zogf3VZr ztkIZ6XacpdaO+HfUPd5S8dfJir2xNDnSZqzhD4bKTtYpCqyRukYX2XBZTnWebhElOGA pxFrO3j7Tud9Q/uGY/c6gFKKSJ3+D5mE6zneVsJPaAKVWgfgKeQqWfFO737Hx8FIx9JS 7C49UaTajHpv0uKkh4+z8xDQFpSMgD0Rw7KKsq/dQttxph8kzgzVIclusncuEIpXmI0L OL2PZl4YoWzbBLsREGxNKA9Ajlv42Utn4cT6E4KwiarM5xDaRpi9KCm7/8ZrYiTkBZRF vfuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=rVs1uqfQX0BF7kn3xdi4fK6HXfgUfy5Rni5v2Qm22s8=; b=Ntv3EFBc8xJo2nAhfe+UnqX6Agi7/gVeEygC8+3C0lEKAT8zlzZFs3KXy4cYnN8tNI QfoicBQGWaJNpciI+8GOcKaOKjbPz8vokbd+TG91f7ziq2d/1XbO50m2nznWmUn5DfCB zz7Nh/tJLFYqt5V0BSSiWGjnGHca8EECVSbuUM6347fS0Ibz14QwCkBwk/WIDdW8wnoi NwbJ9Goobn7U/XiopfaxASj6tRup1vTKID6roHutAxZRvwzrP83APw094XlxrEqx95ic KUiNo1E/GNc4Ujf5v7TXZ9UymwIUoq5Ush3vHgAlBbNbk9NRKNqXb9WtsW5IFGOPxrDb B40w== 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 y13si1610643pge.491.2018.04.17.10.06.03; Tue, 17 Apr 2018 10:06:18 -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 S1753805AbeDQQBh (ORCPT + 99 others); Tue, 17 Apr 2018 12:01:37 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60490 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753760AbeDQQBc (ORCPT ); Tue, 17 Apr 2018 12:01:32 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 42E7EDF3; Tue, 17 Apr 2018 16:01:31 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Christian Borntraeger , Christoph Hellwig , Sagi Grimberg , Ming Lei , Jens Axboe Subject: [PATCH 4.16 42/68] blk-mq: make sure that correct hctx->next_cpu is set Date: Tue, 17 Apr 2018 17:57:55 +0200 Message-Id: <20180417155751.044663858@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155749.341779147@linuxfoundation.org> References: <20180417155749.341779147@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ming Lei commit a1c735fb790745f94a359df45c11df4a69760389 upstream. >From commit 20e4d81393196 (blk-mq: simplify queue mapping & schedule with each possisble CPU), one hctx can be mapped from all offline CPUs, then hctx->next_cpu can be set as wrong. This patch fixes this issue by making hctx->next_cpu pointing to the first CPU in hctx->cpumask if all CPUs in hctx->cpumask are offline. Cc: Stefan Haberland Tested-by: Christian Borntraeger Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Fixes: 20e4d81393196 ("blk-mq: simplify queue mapping & schedule with each possisble CPU") Cc: stable@vger.kernel.org Signed-off-by: Ming Lei Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-mq.c | 2 ++ 1 file changed, 2 insertions(+) --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -2439,6 +2439,8 @@ static void blk_mq_map_swqueue(struct re */ hctx->next_cpu = cpumask_first_and(hctx->cpumask, cpu_online_mask); + if (hctx->next_cpu >= nr_cpu_ids) + hctx->next_cpu = cpumask_first(hctx->cpumask); hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH; } }