Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5039368pxb; Mon, 15 Feb 2021 08:01:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyFt0sPH+Xc16HM/Y8PX7kma+yDq/JEnOWGaCAnzMuZAUiG7UQv0XQ66cPc3AV+OtvEswp0 X-Received: by 2002:aa7:c545:: with SMTP id s5mr3278245edr.362.1613404890926; Mon, 15 Feb 2021 08:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404890; cv=none; d=google.com; s=arc-20160816; b=atn9NWHMwjb/4BYPPplE5SvRnotJQhodMFGgGmkXF4U/qRZzoFIEgib/WrqlgaYG71 JKhieDPaH3d6wdbW78AmJ4UmDWkH9WxpCAZGyslSEVl5XTjfr6ws+Me0XUe79eQ9uTdh g+52brCNR3BYM5iT3F+MdARIb23eqmb/0R2uLchQVPDSuYi3hBsUjYb0VJIsaTV9N9wr QguE7g3SMzXFS8Kp0XSjcTMghzgIIHj034MTlbUOpJbD/GtsXBh4oA1GCrhXnAycumlY GF+3e8pVabzeU7maZCXNGvCj4BkIlkmj0NzDJ/z48H7UMXD2SFjGGrO5uBODSL+ZubYd UXXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bEa9SnK4A+Q1slzgTXFFcGOVADi8llziMzCSwKFaPTk=; b=AgXWm0mYEihEQnq/o708LPs9q6eaQr53RDTBKZKR0+qMwJkZ5QIC3OMdcl/2losmK6 WH5ALeFprXSFHjEvKsop7zEYZ+7f71DB7jGT5yHQBcar+QOECLQy0iYoayGYyZDGMVXG paw22m6kVQAdW0JAh6lh8RanuVM25ZRduOw209U+Mgaj854UAmnVBFSMiGPh79SZHSD5 ZszRBOQDhqFBMgOKJD8CLWnXbtNwApAKRuaEjXKorZdx+L65kd1MxVbJf+axbV76f6R/ 8PAM8K5jtxzBvpbqnLqzIoTCqjTt9s5hQ63L0OG+TGDKPhdWvw8XnH98I0N1lS5AJDkp 6mJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fWoTXTyE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u19si14764935edo.338.2021.02.15.08.01.07; Mon, 15 Feb 2021 08:01:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fWoTXTyE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbhBOP6j (ORCPT + 99 others); Mon, 15 Feb 2021 10:58:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:46702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231348AbhBOPc5 (ORCPT ); Mon, 15 Feb 2021 10:32:57 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1C21764EAB; Mon, 15 Feb 2021 15:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403014; bh=nubV/1ygv6kqsM4aIbnBzomM+6P/DuLH9iUpEwabiJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fWoTXTyEOlibPVOe1vLzkD3IEd7nSEBg67FeyqsISVN1JJTXOR8vif73Jmj64Pngf +6k+JtlFL6NZdywntFS+csxqSl9kAShXAdTkR3FqevykAhkzuVGKHFw7mUpBtp+fU6 wPC/NcQ/CtvUkrb+VU9r7cVNVCMv5TM2rl4L9ykw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Feng , Jan Kara , Jens Axboe , Sasha Levin Subject: [PATCH 5.4 20/60] bfq-iosched: Revert "bfq: Fix computation of shallow depth" Date: Mon, 15 Feb 2021 16:27:08 +0100 Message-Id: <20210215152716.012942558@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lin Feng [ Upstream commit 388c705b95f23f317fa43e6abf9ff07b583b721a ] This reverts commit 6d4d273588378c65915acaf7b2ee74e9dd9c130a. bfq.limit_depth passes word_depths[] as shallow_depth down to sbitmap core sbitmap_get_shallow, which uses just the number to limit the scan depth of each bitmap word, formula: scan_percentage_for_each_word = shallow_depth / (1 << sbimap->shift) * 100% That means the comments's percentiles 50%, 75%, 18%, 37% of bfq are correct. But after commit patch 'bfq: Fix computation of shallow depth', we use sbitmap.depth instead, as a example in following case: sbitmap.depth = 256, map_nr = 4, shift = 6; sbitmap_word.depth = 64. The resulsts of computed bfqd->word_depths[] are {128, 192, 48, 96}, and three of the numbers exceed core dirver's 'sbitmap_word.depth=64' limit nothing. Signed-off-by: Lin Feng Reviewed-by: Jan Kara Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- block/bfq-iosched.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 7d19aae015aeb..ba32adaeefdd0 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -6320,13 +6320,13 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd, * limit 'something'. */ /* no more than 50% of tags for async I/O */ - bfqd->word_depths[0][0] = max(bt->sb.depth >> 1, 1U); + bfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U); /* * no more than 75% of tags for sync writes (25% extra tags * w.r.t. async I/O, to prevent async I/O from starving sync * writes) */ - bfqd->word_depths[0][1] = max((bt->sb.depth * 3) >> 2, 1U); + bfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U); /* * In-word depths in case some bfq_queue is being weight- @@ -6336,9 +6336,9 @@ static unsigned int bfq_update_depths(struct bfq_data *bfqd, * shortage. */ /* no more than ~18% of tags for async I/O */ - bfqd->word_depths[1][0] = max((bt->sb.depth * 3) >> 4, 1U); + bfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U); /* no more than ~37% of tags for sync writes (~20% extra tags) */ - bfqd->word_depths[1][1] = max((bt->sb.depth * 6) >> 4, 1U); + bfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U); for (i = 0; i < 2; i++) for (j = 0; j < 2; j++) -- 2.27.0