From patchwork Thu Aug 16 16:51:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 144432 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2306075ljj; Thu, 16 Aug 2018 09:52:20 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzEYN712B76E5DMs1HjDcmYBIjeT8eIi2qzd+tyPcui+mlDHKWj3wIMGE/olLcvnRGkOw7Y X-Received: by 2002:a17:902:70cc:: with SMTP id l12-v6mr29928537plt.132.1534438340154; Thu, 16 Aug 2018 09:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534438340; cv=none; d=google.com; s=arc-20160816; b=Nz/Ifip8WvaSM62Yf+CPORo5OnVjYXq1OF2x6oDn+GKgPlLG/Yr6rVHwPZsXzhKb0L VKdmUDGCmHFLiW6tSHXYEDuvXUUY02h/QXY1WfV0F0RwAGIx8L2rZf2OAZ++7VJJhjM2 ejBl+kslkO9jIXk8Tei32f0TM4eZPi5yRRgn22rRgbrCx6MpUWGIMrG8EveqqGDzHV3S I9PQ7Pvx3D1ntC4Yf0hjX3OvJ6r2PGDGSKm+k9i96EP+BI8er0YshCvTeOczAbytD7iP VM7ipFbkO/fae4+WygWCRAvJcCqhMk9RT8Jrs66InnewfE5z9/qMBFTESfHSk9VVqMLI igFg== 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:dkim-signature:arc-authentication-results; bh=gLZ7QU55IsLVhhisN3q0YJquTs5gtaPrOh82kVhuIcI=; b=P9brTCgANAmYufQAGPLRr9mg6cGgwfEhqjjvIdPJH7/ep71ydo6YKUM3oQYfaEoa8F /qkNtBGZTIa0Gxid9w6+I8D8BKFISvXbZ334DfZKCYyo2q1FWZx2KXKCgjAVimQdrJ0K ufYvOlFJwAJIwoOqakjewyckMvDJxwZtwG6B14c0Kue8S50eHZYtbHvHaN4mXmFBufAw aMtHiJfdqVLepT348LhxE1RwSJhsgnOhxHMbJUCtMX/+qy933/ObHqnj1NlcUJlCDdQF tdhmninc63A0aOTqTujf9/5jpfh35c05ocYtWWOxdZ/j2s+eo8i9uQvF1G/Ccm0MXkpG IadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Q9pA60Bv; 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 c17-v6si23533003pge.273.2018.08.16.09.52.19; Thu, 16 Aug 2018 09:52:20 -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=Q9pA60Bv; 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 S1731133AbeHPTvi (ORCPT + 32 others); Thu, 16 Aug 2018 15:51:38 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36092 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727745AbeHPTvg (ORCPT ); Thu, 16 Aug 2018 15:51:36 -0400 Received: by mail-wm0-f68.google.com with SMTP id w24-v6so4945740wmc.1 for ; Thu, 16 Aug 2018 09:51:57 -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; bh=gLZ7QU55IsLVhhisN3q0YJquTs5gtaPrOh82kVhuIcI=; b=Q9pA60BvtGVg5Qk9BZEC9RPwv6VE30CQG96npMXKKLFK687sa2wy5rmGfhusSXFe1y 6P4pAvKNB9K5o0+W9hW8qcfmjyx7QitMS0xwesCJ0X1vc960UZV3Rv2aPGzYPumCJQCc e9DKMRLroOeAn7gPZuXSrQ666mIhWcaGixrxk= 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; bh=gLZ7QU55IsLVhhisN3q0YJquTs5gtaPrOh82kVhuIcI=; b=USf56FvQ/fOCTnPANJ9jCK/kaE9QcvvJ3/W5rntLkNIxRVyN/uAz/1hsP8VxIjtEjT hYof6V/iWqB6FsU8iE1QyDIz+5RFWKQwUjopg4SAPlrp0HOxy4Zmh3P83MgTT5JBjFdF W1eY+vW9AfMLKJzqTe1fiaFSOEUXTVsovabyTH9P50vawGtm8UCDHs3cnIYfRmGa+/dc RVFpooDonVS9ZJKpeKtSQQC3+v7ynOQxV9O8q8EwEtmzzPkrSpjoSvQ268qfwf2xbZxl pwcNl1CRkIH5DBmBc2liUk8gkZxHG1pS2tyQkLfpoEV4skKXnjXNrclL7mdpbZFBMjGq O/BA== X-Gm-Message-State: AOUpUlGf1KM9t2pibvxXIXDeDv8VNFP10O940ItGd4s1tTuGG6eX+qE9 m63bN0A1MarpGGZ2knziiuTfmg== X-Received: by 2002:a1c:bb86:: with SMTP id l128-v6mr16316007wmf.26.1534438317067; Thu, 16 Aug 2018 09:51:57 -0700 (PDT) Received: from localhost.localdomain (146-241-5-103.dyn.eolo.it. [146.241.5.103]) by smtp.gmail.com with ESMTPSA id o3-v6sm30036180wrj.31.2018.08.16.09.51.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 16 Aug 2018 09:51:56 -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, Paolo Valente Subject: [PATCH BUGFIX/IMPROVEMENT 1/4] block, bfq: readd missing reset of parent-entity service Date: Thu, 16 Aug 2018 18:51:15 +0200 Message-Id: <20180816165118.17402-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180816165118.17402-1-paolo.valente@linaro.org> References: <20180816165118.17402-1-paolo.valente@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The received-service counter needs to be equal to 0 when an entity is set in service. Unfortunately, commit "block, bfq: fix service being wrongly set to zero in case of preemption" mistakenly removed the resetting of this counter for the parent entities of the bfq_queue being set in service. This commit fixes this issue by resetting service for parent entities, directly on the expiration of the in-service bfq_queue. Fixes: 9fae8dd59ff3 ("block, bfq: fix service being wrongly set to zero in case of preemption") Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.16.1 diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 41d9036b1822..62efc1b97afb 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -3298,6 +3298,27 @@ void bfq_bfqq_expire(struct bfq_data *bfqd, */ } else entity->service = 0; + + /* + * Reset the received-service counter for every parent entity. + * Differently from what happens with bfqq->entity.service, + * the resetting of this counter never needs to be postponed + * for parent entities. In fact, in case bfqq may have a + * chance to go on being served using the last, partially + * consumed budget, bfqq->entity.service needs to be kept, + * because if bfqq then actually goes on being served using + * the same budget, the last value of bfqq->entity.service is + * needed to properly decrement bfqq->entity.budget by the + * portion already consumed. In contrast, it is not necessary + * to keep entity->service for parent entities too, because + * the bubble up of the new value of bfqq->entity.budget will + * make sure that the budgets of parent entities are correct, + * even in case bfqq and thus parent entities go on receiving + * service with the same budget. + */ + entity = entity->parent; + for_each_entity(entity) + entity->service = 0; } /*