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: 10567879 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4C3DB913 for ; Thu, 16 Aug 2018 16:52:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4D22B47F for ; Thu, 16 Aug 2018 16:52:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 30BFC2B4A8; Thu, 16 Aug 2018 16:52:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D064F2B47F for ; Thu, 16 Aug 2018 16:52:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725895AbeHPTwJ (ORCPT ); Thu, 16 Aug 2018 15:52:09 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:32925 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727590AbeHPTvg (ORCPT ); Thu, 16 Aug 2018 15:51:36 -0400 Received: by mail-wm0-f68.google.com with SMTP id i134-v6so8769017wmf.0 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=ly8XXa8TUiP3tYzHFPlnz0HoGNdljN6IUGsdb1QklmtEiUqlTG+Wsm97VM/FqPerAz IUWzj9Gc75O2+3xfpo/AlrD0HPtFBRv7H2dSFl0qRvp0IWqPCQEarVNtZKZICQTWS/A4 RZ/cylzOJc8ii7FyTS4bynnG+aX7FsUemU6hLAl53xc7a8HgmOXhzLWPf11ZrX5xB7Fm 1tws0UvhG8T3knKdnbq/Cl8kyOP/G3/FTO4/+CQng3D13IXZQKmqFMMQdm7unuoyln0m hqEkO2u0C/l6aZkiWXuLNojCH1jWaq0d8OODFhl7o/pzzjfKWNwVOmrk8kA1W3w3JKbz T5sA== X-Gm-Message-State: AOUpUlGHDzGgmojbqzIifHt7WFnohTKUEjb+66V7u7gssnmcTRE/0bGX eC3F7T3HozlKykV1o5frmHoMcA== X-Google-Smtp-Source: AA+uWPyQc/QmVFufHKF653DtcznVIl+PWJw7XwfaujV607gnewQr09bbFnhCJOQ9rPBbffEGh0fXsA== 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-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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; } /*