From patchwork Thu Mar 7 16:25:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 159885 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7628592jad; Thu, 7 Mar 2019 08:26:34 -0800 (PST) X-Google-Smtp-Source: APXvYqxM8j6PEohYFyUOsqYu2oCD6wSuI/IJpWdArAun2Wvbfdq+oyM4vxUUZhPi18znGlrt+gVi X-Received: by 2002:a17:902:a50a:: with SMTP id s10mr13427360plq.223.1551975994345; Thu, 07 Mar 2019 08:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551975994; cv=none; d=google.com; s=arc-20160816; b=hETOIbOvGhTV8MrjrTuHf8Mw67008Bk6ww0soj/Upj9ch3zzaJU+JMCPjKtBNVDugv saHvlxvqqMQEiz+cnKyHrk6RM5JoZV1otETpIqwYtxJ4hAI7qyzlfreIoefKZ0NxOPHT YHUa9x2XN1/eawMhFOGHQSOHAyoASfMfogmjqArY1NA/zN3CzZ7fiF0cFWybkeWaWmwV I0RYExwM8QqlIJno7ZqCLOkYFOppDZCLwcbxC3xSxsBGObtuFSCwoiSqInkuWFZbwV/k lFEkdYCqs6DsAOx7vIuxk7Pvl8nK6FUeDuu6Zt5Nc+s3DLd5RZb0GJON9Ovz3J//cAPV ysLA== 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 :dkim-signature; bh=rb+YsYLv5aeFW93p5pLsMf9umO1yuPDktu059+duwqc=; b=WrMibk6LhA8V1/3dIuT2cbnqIZi4yXwVaa39cM9km4wBM3gfk4iXIMKlwbdgUgOMOr AX2COapd+VYORYyXnU/L8ZAsHfDOZbI1J65YJVkT01IccqAGfOnW6zhYVo8kBD6/l9G0 b6VMct2IVbXnZMMG2aHwDUfkoBzgfVznOOy5NLywcj7wuAR9Bozxk5o0zfn5ViL6o5BM BfxhWBY/7ueFLe2hXwWLEoOnw7Clsxl4kWyuD29XHBgeGjWAzMdGbdsfGLY3PymER+yY 3GUG4IsqreKvJtglwezcn+uqwC18Xvw//Pq+GEAOaHVCNfEq5NbqkDGsoS87lWyCnTMP rY3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="WQ4/460q"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w190si4146952pgd.105.2019.03.07.08.26.34; Thu, 07 Mar 2019 08:26:34 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b="WQ4/460q"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726561AbfCGQ0c (ORCPT + 31 others); Thu, 7 Mar 2019 11:26:32 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38540 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726465AbfCGQ0X (ORCPT ); Thu, 7 Mar 2019 11:26:23 -0500 Received: by mail-wm1-f68.google.com with SMTP id a188so9790483wmf.3 for ; Thu, 07 Mar 2019 08:26:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rb+YsYLv5aeFW93p5pLsMf9umO1yuPDktu059+duwqc=; b=WQ4/460qM6FlUjNVkIEygVfdwtdGU0MVo3dAb9opKQ4YIY+njZ/t3bSyeLXDABk5Bm nabD9ZMJiJFyhcTjSRHDdvjJpzNmWPy1WmpctU3uppNVE3JMHQqfNuShfsyur5AqYxe0 HtKf0IZCMtqqJqF7sNB0rZ9yiO8n7Gy1fEK7JKQteAE97aNYyBwK62roCArXJ118L609 I3YJTpKmTs1imbEnclKCPdcIgMAD830znJpyFATC2ijZGG64rE3RcWWEI3w9VIwa4YdC GdGi4tUt4Voqynhw+88B2wyjZwVYXm3vTDix5O9xgG31dP+kOuX5mSykwsdzKW6ZcWrp bcCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rb+YsYLv5aeFW93p5pLsMf9umO1yuPDktu059+duwqc=; b=nBfVov2C+vBtdgk69k8lWzfLo3Ic9D7GNSgAAdq6X2BQFVBafTVGVjiWPhi02xyrvF 36F80et2glX9qP1y4JlsxC7ui/swC0Hg3DLu2S5CpsRK/qJvR0+VCj+8cv2XnF2P1mVZ LElUq/EnnOSB1FDxM9D7sVXoM9tHtlTWZzHQ3rdSvG5UCYMX336dFiR2Fv8SZvXLwJbY V6DM22eOW+KIZDq+14ySa6hWTMA8FlxyEctrsfqI52I8n0u/cFWgYneIB+bBxme+SSUP evCQFn5jJDF9pV7dpo3U1H0Y2CfTXqkMHHNW05iQ5pwCKvfK2I4F/2KPsdEF7nhsuwCr 9n6g== X-Gm-Message-State: APjAAAU+aYBP3VZqLcRp/ft4xkWDXZvhXeo2Y//F/sQ0fbr9GP8Vkam8 GL8arjmpqJO904hLjcGWC0yIhw== X-Received: by 2002:a1c:c644:: with SMTP id w65mr6170078wmf.19.1551975981462; Thu, 07 Mar 2019 08:26:21 -0800 (PST) Received: from localhost.localdomain (146-241-117-61.dyn.eolo.it. [146.241.117.61]) by smtp.gmail.com with ESMTPSA id o127sm5801797wmo.20.2019.03.07.08.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 08:26:20 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, linus.walleij@linaro.org, broonie@kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, fra.fra.800@gmail.com, Paolo Valente Subject: [PATCH BUGFIX IMPROVEMENT 8/8] block, bfq: save & resume weight on a queue merge/split Date: Thu, 7 Mar 2019 17:25:54 +0100 Message-Id: <20190307162554.77205-9-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190307162554.77205-1-paolo.valente@linaro.org> References: <20190307162554.77205-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Francesco Pollicino bfq saves the state of a queue each time a merge occurs, to be able to resume such a state when the queue is associated again with its original process, on a split. Unfortunately bfq does not save & restore also the weight of the queue. If the weight is not correctly resumed when the queue is recycled, then the weight of the recycled queue could differ from the weight of the original queue. This commit adds the missing save & resume of the weight. Signed-off-by: Francesco Pollicino Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 ++ block/bfq-iosched.h | 9 +++++++++ 2 files changed, 11 insertions(+) -- 2.20.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 7d95d9c01036..1712d12340c0 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1028,6 +1028,7 @@ bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_data *bfqd, else bfq_clear_bfqq_IO_bound(bfqq); + bfqq->entity.new_weight = bic->saved_weight; bfqq->ttime = bic->saved_ttime; bfqq->wr_coeff = bic->saved_wr_coeff; bfqq->wr_start_at_switch_to_srt = bic->saved_wr_start_at_switch_to_srt; @@ -2502,6 +2503,7 @@ static void bfq_bfqq_save_state(struct bfq_queue *bfqq) if (!bic) return; + bic->saved_weight = bfqq->entity.orig_weight; bic->saved_ttime = bfqq->ttime; bic->saved_has_short_ttime = bfq_bfqq_has_short_ttime(bfqq); bic->saved_IO_bound = bfq_bfqq_IO_bound(bfqq); diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 21ddb19cc322..18cc0e996abf 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -404,6 +404,15 @@ struct bfq_io_cq { */ bool was_in_burst_list; + /* + * Save the weight when a merge occurs, to be able + * to restore it in case of split. If the weight is not + * correctly resumed when the queue is recycled, + * then the weight of the recycled queue could differ + * from the weight of the original queue. + */ + unsigned int saved_weight; + /* * Similar to previous fields: save wr information. */