From patchwork Tue Mar 12 08:59:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 160076 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp12860935jad; Tue, 12 Mar 2019 02:00:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqylIPZHT08O5yib9qJftRO7dgQE4iKrelHVqu4qKXVWaLr52dWO6lmw2/vPktFWwUneEb/a X-Received: by 2002:a62:f517:: with SMTP id n23mr37741101pfh.209.1552381232069; Tue, 12 Mar 2019 02:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552381232; cv=none; d=google.com; s=arc-20160816; b=MX1Xyrob1Ai3AavO4MqnxVzC4zLd1sKiELfNRLJ9aUdHBXBgCpVwWpk8PhU+s49lb+ Ti6SQSTofHp/lTT3T++K8Igwdv/d2S+vadvJx0z7pwJyIuRcw0NWuICPF99SFI+R4ZeJ bth/DAgE2JDXjx4W2ckEZwJHB7HEajVI3TRZtdYXhn4+ly/h3tKGIImKGcZDkdT6oevX rZOt37v1HN7oRk7Pcd1xhIzVjeenJukDawGLsl+LOxuKaP923sNQ8lEWHmdSEdn2gAfd DWRKpMAD4AyLGcnt49XpAKSpJoZRXBeKGAafQNzetuV7zAMmhr0Au4IA4t36Cct/iDLu hGqQ== 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=uB6F8nkcc+jXPBDeIaz78K4jgn2LvnmUlQ+OCREpF+E=; b=LsGNborscMUGTRXrGbl26eCIXyJJ0n2Ar97nQrN4GuDeV06m+xnM/KRfrbjdQFXT7d PrCaX37v7I7cn2FR7s90+cL8FHwTIaKYrmL9OK28KnEPH7An40mTcBpHbmI8CzHaRh9C UaVtvAPKTNprJ4LMm7SIUO9UmUzVOSq1SKk3uVmismmwmQGW3TmvVUlOpQT0uoTYU1vL LG7RgwRJv+pFAEbrhk1QiL08hXo0AphWvwJkLsUSzXC8YL4c9GfagpHXTqaCc0HkKbvN XUpfk6NPMsv+fPct3MSXsyi8QIQRL2vhc5DrYuGFaauFl9OzVBRgXBRluYous6qmybYI PWDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rrDaoIOH; 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 a7si7552516plm.420.2019.03.12.02.00.31; Tue, 12 Mar 2019 02:00:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=rrDaoIOH; 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 S1727766AbfCLJA3 (ORCPT + 31 others); Tue, 12 Mar 2019 05:00:29 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:37018 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727726AbfCLJAS (ORCPT ); Tue, 12 Mar 2019 05:00:18 -0400 Received: by mail-wr1-f67.google.com with SMTP id y15so1751187wro.4 for ; Tue, 12 Mar 2019 02:00:17 -0700 (PDT) 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=uB6F8nkcc+jXPBDeIaz78K4jgn2LvnmUlQ+OCREpF+E=; b=rrDaoIOHvvi1Hid8Z/1X9MJv6gwLoS8LoXZbdj6oUdt7UFvECfEJ4m+nd7XmpWb3YE lXm+YDALDH3MtZ+vzNGBMFG0m2ZY8j8uDlf+jmxHpp0Nr9AOXi2P2uy3+wn83FrcedIz 3H/7SMt8j3yGMXKQBns/Oan2hMEiW4J+A8jZiH78kvm+zaHdUZG/OVDPEG/eaQC6ct88 N9iPEdgAYVjW0D/wWQ3bH83ieHgR4LbYBtq+zEiGn2XCozM68fPT9c3zL9JwC90l5j+Z MjKJfOWGV//Oepcv8HhCU+H1rhg98ZqtVBhc/vLWO/DN/YlMYOP5kIQyK8pjJwQJaR73 mu9g== 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=uB6F8nkcc+jXPBDeIaz78K4jgn2LvnmUlQ+OCREpF+E=; b=oJeQYQMXMyPMqsIn+vNdaoh+/q3nNz4AK3kXXH0ZHBMWC3+M/lbXn8hpg8bwRlXtAj oLg+Dq0MH4rj6SXrKOan2QjU3h+QsxKJCLh0t0L5zV8UgaVU4PQ+/eVDaZwyMW6N1nAl IMiaV3n8D1E5DeSc/RmPVKo8sohndMRYFwJu78ncbIBNDmu+TNfYxxaoMN2RgOwt1NOX Cxro5AG4wEtQTYyBIOFGHyFqbQc2P4zNXGy3gDe3EGDv7ocftH9Uz6Q3P46RQf0uzUYD gGsrUDMAWS8i0VLFqKjOO4qaJAo5ECwkd+1jq2ZVh0Bdf4fWvrjuysBYFdfb3GlbzxKj T94A== X-Gm-Message-State: APjAAAWR2rbyP7dM+0Eud4FTtDgq973EkjHybdqYYALtg4g4LMrsuTul wNWgGb4VTuLxCt5talx7O5W1VQ== X-Received: by 2002:adf:dfd2:: with SMTP id q18mr2267713wrn.259.1552381216921; Tue, 12 Mar 2019 02:00:16 -0700 (PDT) Received: from localhost.localdomain ([84.33.65.66]) by smtp.gmail.com with ESMTPSA id y20sm3953043wmi.34.2019.03.12.02.00.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 02:00:16 -0700 (PDT) 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, alessio.masola@gmail.com, holger@applied-asynchrony.com, Paolo Valente Subject: [PATCH BUGFIX IMPROVEMENT V3 8/9] block, bfq: save & resume weight on a queue merge/split Date: Tue, 12 Mar 2019 09:59:34 +0100 Message-Id: <20190312085935.11340-9-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190312085935.11340-1-paolo.valente@linaro.org> References: <20190312085935.11340-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. Tested-by: Holger Hoffstätte Tested-by: Oleksandr Natalenko 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 67e63c276c7a..60c148728cc5 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. */