From patchwork Mon Feb 3 10:40:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362377 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F214D138D for ; Mon, 3 Feb 2020 10:41:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF6C620838 for ; Mon, 3 Feb 2020 10:41:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="fpRDQwIu" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727334AbgBCKlT (ORCPT ); Mon, 3 Feb 2020 05:41:19 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:54424 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727239AbgBCKlS (ORCPT ); Mon, 3 Feb 2020 05:41:18 -0500 Received: by mail-wm1-f65.google.com with SMTP id g1so15222657wmh.4 for ; Mon, 03 Feb 2020 02:41:17 -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=wqMailTmZiDzGAaQzZRxkipnoj+fRUU9PJ6V3DKETq8=; b=fpRDQwIuTnnsEyXB2ySM/p4PTDa0o6mNCWb97yzJoMIxm1hOjOzyJyl9xYG18z2uPT +jjhRpUSiO5EEmKc8XND/iIKh/C8Sid5YDykNK8GeUaFBNaeFqu440ubfjfPwErQFY5B Mdc5VNe4/Q3wSBv0XE/og6Ag1FH1RZcXJEgt4cN20kVrJN+4JkBYfeQolvG8+EzaAK0c kgyMnqnPWWGke+XbsIrlZR+VcsFrioLHzE0ZWlgXCXXfYoEM+79cz7DN/avZ3RlPmf90 /ZzHsLINcogFG4EytfuVjKt5Qf/J8ELSjr/Iz3h/StandjtsbMtxWa9y45V6Ch1YExbq dNnQ== 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=wqMailTmZiDzGAaQzZRxkipnoj+fRUU9PJ6V3DKETq8=; b=CCIXJlGga8rRGyBc+kEMZiDVwmpzlfMGsXk0Fui7lzF4HLTqsUhh4EEJnpdkL8YlBJ KNqecVdTD6AgQA/7fozhyL/H378V6nKWRZDdBjbHyu6i+1t83WywH+UTzIVyjqGbLitN Ibtt45Aoad9QLazJceYEBuT/zKNfdw5Lgq2CNI+msfCLyVzq4uXRnCytg8Jg6c3jRgFJ lenvJkLy44iCB779Nf0c7T9jpTuNFC52kkaZMHpxwhVIobJos23lfws8UbWoe7hw4Csx V1ElsN+uOx07puFqwvrFZOr62mJ8Cocsr4ENl1J2BZbUo/xJ8CxDjqu23Ktbq2tgf7Vg +FDw== X-Gm-Message-State: APjAAAXYAq0feZbC/Kbk+3twG3BNuKnB2jDF0wm0/nnTnfpb19kK/9M0 cHCb5nUR8kAScodhyC3uRIliFw== X-Google-Smtp-Source: APXvYqyqDixFhZw5tU0O0/JrbBtxhUTUGNteo4ruPRhRyMasg9wLTEjyyUN0NQFTSelH+2sWXvkRyg== X-Received: by 2002:a05:600c:d7:: with SMTP id u23mr29183580wmm.145.1580726476193; Mon, 03 Feb 2020 02:41:16 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:15 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 1/7] block, bfq: do not plug I/O for bfq_queues with no proc refs Date: Mon, 3 Feb 2020 11:40:54 +0100 Message-Id: <20200203104100.16965-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Commit 478de3380c1c ("block, bfq: deschedule empty bfq_queues not referred by any process") fixed commit 3726112ec731 ("block, bfq: re-schedule empty queues if they deserve I/O plugging") by descheduling an empty bfq_queue when it remains with not process reference. Yet, this still left a case uncovered: an empty bfq_queue with not process reference that remains in service. This happens for an in-service sync bfq_queue that is deemed to deserve I/O-dispatch plugging when it remains empty. Yet no new requests will arrive for such a bfq_queue if no process sends requests to it any longer. Even worse, the bfq_queue may happen to be prematurely freed while still in service (because there may remain no reference to it any longer). This commit solves this problem by preventing I/O dispatch from being plugged for the in-service bfq_queue, if the latter has no process reference (the bfq_queue is then prevented from remaining in service). Fixes: 3726112ec731 ("block, bfq: re-schedule empty queues if they deserve I/O plugging") Reported-by: Patrick Dung Tested-by: Patrick Dung Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 4686b68b48b4..55d4328e7c12 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -3443,6 +3443,10 @@ static void bfq_dispatch_remove(struct request_queue *q, struct request *rq) static bool idling_needed_for_service_guarantees(struct bfq_data *bfqd, struct bfq_queue *bfqq) { + /* No point in idling for bfqq if it won't get requests any longer */ + if (unlikely(!bfqq_process_refs(bfqq))) + return false; + return (bfqq->wr_coeff > 1 && (bfqd->wr_busy_queues < bfq_tot_busy_queues(bfqd) || @@ -4076,6 +4080,10 @@ static bool idling_boosts_thr_without_issues(struct bfq_data *bfqd, bfqq_sequential_and_IO_bound, idling_boosts_thr; + /* No point in idling for bfqq if it won't get requests any longer */ + if (unlikely(!bfqq_process_refs(bfqq))) + return false; + bfqq_sequential_and_IO_bound = !BFQQ_SEEKY(bfqq) && bfq_bfqq_IO_bound(bfqq) && bfq_bfqq_has_short_ttime(bfqq); @@ -4169,6 +4177,10 @@ static bool bfq_better_to_idle(struct bfq_queue *bfqq) struct bfq_data *bfqd = bfqq->bfqd; bool idling_boosts_thr_with_no_issue, idling_needed_for_service_guar; + /* No point in idling for bfqq if it won't get requests any longer */ + if (unlikely(!bfqq_process_refs(bfqq))) + return false; + if (unlikely(bfqd->strict_guarantees)) return true; From patchwork Mon Feb 3 10:40:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362389 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BA721924 for ; Mon, 3 Feb 2020 10:41:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9817520661 for ; Mon, 3 Feb 2020 10:41:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Aj3T4ug+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727501AbgBCKlV (ORCPT ); Mon, 3 Feb 2020 05:41:21 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33819 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727389AbgBCKlV (ORCPT ); Mon, 3 Feb 2020 05:41:21 -0500 Received: by mail-wr1-f65.google.com with SMTP id t2so17349543wrr.1 for ; Mon, 03 Feb 2020 02:41:18 -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=+Kno0Ufwl1kAKmD9m5umt2SU5mWhcoh+53Gn8TLVtdo=; b=Aj3T4ug+aflZfA/nndr2kZEys0nIS/FJXZ8B6qlk35IFcTzljTYx6rmI5QEEhLD+Gd z+2z2Yb2mvCpr6Dn0wLKBte7hgXAKtBEv82KTJAtWF1yJ04mOmDAxNx4lxS+pnRQXNgV 9gmWmIqGPY2SGzr/8QdcBBZ2QzDFBDZIvEI1S3S3oV0rPj3cXeI+aJUf/knug3VO2LEl NeqO0tTCRjLcPuZTNl2ddKgY9z8jP7Lact1HeVd5XqAmlgS4qW8GmRq6iY89BJZDEp46 QmjlXmGSvXMAudYWe2CC7+rtIfO/eMvwij1zB042iFmRS9mruEPACM93nWtlJnyCxy7/ f2Jg== 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=+Kno0Ufwl1kAKmD9m5umt2SU5mWhcoh+53Gn8TLVtdo=; b=CViLOacwEw2/Eh4NKPn0IN1C1BhoquwkdSBW1unPeGLgF654Ot8B9e4apIIt713FT+ bzjILVVqWNvAnyEPZwXCFP800KwxtdmOG9cWdtpv4lhf+QOp6YrCYyV0uTUqabuijB7X k4/6X8j6YSo4QkxwbaZ6f5ZVC1SMdqkrUsAOHch11/jR1kWmWfZCFclQNtdLIgIyH/Og +3mh24sxmVpNlPj30Q9qLbZsUn/SNDFXU37PDZWM3XYa610bN8C8Zsh3VQaFfIpUBbBu TSjTcTJgTWDDujescJ3Pv+20BjP0MnbKj05zrExeE3fyQVAmy8vE6eGmkIH03vqfdYzJ 389Q== X-Gm-Message-State: APjAAAWuITsp+JkSzJz1DF+5PkgQXIQH0joxJ8m9oO/VjWHvBtZ2SUxd s3trE6eSMOTitRC4moZI74FecA== X-Google-Smtp-Source: APXvYqwIl74eQZRgLB7TI/l05Ru0I7oZFprd4/KtPiEfF8w3nM7Yw7E+rPva3hmYBIIB+ZBpL9YVuQ== X-Received: by 2002:adf:82ce:: with SMTP id 72mr14690299wrc.14.1580726477470; Mon, 03 Feb 2020 02:41:17 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:17 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 2/7] block, bfq: do not insert oom queue into position tree Date: Mon, 3 Feb 2020 11:40:55 +0100 Message-Id: <20200203104100.16965-3-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org BFQ maintains an ordered list, implemented with an RB tree, of head-request positions of non-empty bfq_queues. This position tree, inherited from CFQ, is used to find bfq_queues that contain I/O close to each other. BFQ merges these bfq_queues into a single shared queue, if this boosts throughput on the device at hand. There is however a special-purpose bfq_queue that does not participate in queue merging, the oom bfq_queue. Yet, also this bfq_queue could be wrongly added to the position tree. So bfqq_find_close() could return the oom bfq_queue, which is a source of further troubles in an out-of-memory situation. This commit prevents the oom bfq_queue from being inserted into the position tree. Tested-by: Patrick Dung Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 55d4328e7c12..15dfb0844644 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -613,6 +613,10 @@ bfq_pos_tree_add_move(struct bfq_data *bfqd, struct bfq_queue *bfqq) bfqq->pos_root = NULL; } + /* oom_bfqq does not participate in queue merging */ + if (bfqq == &bfqd->oom_bfqq) + return; + /* * bfqq cannot be merged any longer (see comments in * bfq_setup_cooperator): no point in adding bfqq into the From patchwork Mon Feb 3 10:40:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362387 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DC7B138D for ; Mon, 3 Feb 2020 10:41:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3BD132080D for ; Mon, 3 Feb 2020 10:41:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="mfpBpPqm" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727536AbgBCKlW (ORCPT ); Mon, 3 Feb 2020 05:41:22 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:38670 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727435AbgBCKlW (ORCPT ); Mon, 3 Feb 2020 05:41:22 -0500 Received: by mail-wr1-f67.google.com with SMTP id y17so17335369wrh.5 for ; Mon, 03 Feb 2020 02:41:19 -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=9S9BwHx5UyCKJX2JPPBf1rlNAUg9PfPZ0MUkcYcdubg=; b=mfpBpPqmwAcPO0e1BueHHoL83GQn+u39S5fzLWe3sm5x6q5ch5+7z+JZBr4ud9N0ka hlCWy6oQ6MXEvBvTA8Q+j+u28FVALLwfiLqQx7aIal1Ejk3ATshmevA5ZWy9nfGeA07n 6y6mFC7QPC8xUMujiRmFt0sG3zlgNQ7Gi9EReoaRy3Yshq+V4b2MZmGIJrv2/xpIMUpA xhDin3yzdFtWzB9QeaGkIcW+DKXTuvfOlUdjgia27BH37xhmkX5GBHnLVoiGQw25/Pq6 U4mfRfzrL9gTtnfZ8Cr7P8f4pVg+ugLieOD+Eb91fD8v0VQp9ph0V2zYweLoCT/0rDJi iuFQ== 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=9S9BwHx5UyCKJX2JPPBf1rlNAUg9PfPZ0MUkcYcdubg=; b=TsAcTJUG0skyvCoqA//Jfm6Oklq3dclnRH6zcbZn2RxQ4yjItpw//iCskT9Z2tV1Uv nZqQymJ8txAfaAwFinIccQ8QGeJnreKHmUEJspvAtVv7gfKmIUg/SI89yZz/Ppi4JKCQ j1H8hhx9DugNE8PxYRk4AuLbKCoX5HKcM/takuVoPRFR3/AnjL4Pzdp476HDSP3IkjHY TcmD494Vsl3EM3AcRpkqzaf70jV401biTZokNYTMbadL/uWPuFgfZPIfy8Gp0XoPlLx0 B8MD2l5vvuo8J497tqTklqda9igcFJoMhrSlgcjcHlkW38yrYUhRyFOlYgtlpP4C8h6q Jo2A== X-Gm-Message-State: APjAAAW5Mo8e6xUU+oLP0hnO8EaXjXt9k0oBNrsnFFISA/59uFyQOx7Q xF8zlflP5mufvHnsH2/dDRu55g== X-Google-Smtp-Source: APXvYqzvjhTRZEZ5VF4yVYhrSP28dia4+T4/m+hIu2Fuz4jmFCuGLvFyyZMHxuYLNAm7vCE7ys+TmQ== X-Received: by 2002:adf:b352:: with SMTP id k18mr14456202wrd.242.1580726478647; Mon, 03 Feb 2020 02:41:18 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:18 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 3/7] block, bfq: get extra ref to prevent a queue from being freed during a group move Date: Mon, 3 Feb 2020 11:40:56 +0100 Message-Id: <20200203104100.16965-4-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org In bfq_bfqq_move(), the bfq_queue, say Q, to be moved to a new group may happen to be deactivated in the scheduling data structures of the source group (and then activated in the destination group). If Q is referred only by the data structures in the source group when the deactivation happens, then Q is freed upon the deactivation. This commit addresses this issue by getting an extra reference before the possible deactivation, and releasing this extra reference after Q has been moved. Tested-by: Chris Evich Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index e1419edde2ec..8ab7f18ff8cb 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -651,6 +651,12 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, bfq_bfqq_expire(bfqd, bfqd->in_service_queue, false, BFQQE_PREEMPTED); + /* + * get extra reference to prevent bfqq from being freed in + * next possible deactivate + */ + bfqq->ref++; + if (bfq_bfqq_busy(bfqq)) bfq_deactivate_bfqq(bfqd, bfqq, false, false); else if (entity->on_st) @@ -670,6 +676,8 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, if (!bfqd->in_service_queue && !bfqd->rq_in_driver) bfq_schedule_dispatch(bfqd); + /* release extra ref taken above */ + bfq_put_queue(bfqq); } /** From patchwork Mon Feb 3 10:40:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362379 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3716138D for ; Mon, 3 Feb 2020 10:41:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 980DB2087E for ; Mon, 3 Feb 2020 10:41:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="E1C+QSQP" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727570AbgBCKlX (ORCPT ); Mon, 3 Feb 2020 05:41:23 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43640 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727502AbgBCKlW (ORCPT ); Mon, 3 Feb 2020 05:41:22 -0500 Received: by mail-wr1-f65.google.com with SMTP id z9so5097442wrs.10 for ; Mon, 03 Feb 2020 02:41:20 -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=EYMuqQIhNyGIyUO9+d/0zXKDzQMWFHlzvVLFhG2VePE=; b=E1C+QSQPsVg+CtJO9tSTEG9fYUN/zU+R6egxRW0FaC3HLz9p91/p8AAuf21UCXDoia Jq4UaZQrd8V/sCaW+ddNEtPSYwrVudIferppaFXDsPXA21Qh+VBnMzJmjmDs/TFUmz+R 12hkGYeylpGw3TXlDvX19TmM+7wuYERnnLUMpQik/bnma36ebJWgAaRDin7xUwf7rLdu CSmIOLjcgPva7uoTzDQQ7BRsUa62WOwxxUydZhr6h8ry1xvGGMT2XIK5v3nBSUqfQNch 2Eof7TAoe5XQhTolIsPW1+8mf4JxgbZQ3nkG+l5oawRc+tkqzpG0hzlwIkYxFT/yJQ3i H4nw== 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=EYMuqQIhNyGIyUO9+d/0zXKDzQMWFHlzvVLFhG2VePE=; b=EGcjWbKZUA5AdH50eIsDamhN1WjMqksDHnmvPH7VVnCo6OSp+Ct/ZzMISJaDbxXAdI /a9CY5lxl8qRuC2Yb6tu8h7CqMKufF3w5SbtdFJ6KL2jfNaMD6gHsQJezpsmQVmkw7aX gHRIiFv5/tMYjXPtxhYCHo66cs348Zo13fMyq37a6UaQaIWxacCNLmxkRhK8dVn/+HLC +nhZapV/nNKjPbfYfYDpSlQVd7UKj5j5mT+Z0RP+f0xKHlExRlBxf7eDuwrmYgWFyjh/ 1Wv4PSddCxmBvqEsg6JSyqDuHl2eiiKT4eMWZPKzKEj0OLs5l7T+U3DnrIwGgsrD6pwY pWUg== X-Gm-Message-State: APjAAAXCm6i8z7gMAYfaGjHkNhdefls/3SKKUkEzNYsS3qIMqyZP2jmt 1OAPuaeEmih2lnop79rrCC9InQ== X-Google-Smtp-Source: APXvYqwmdAOg8Ixp1iHiociJz/zeNxj1uqmFDGwjueLS0+Hn7nqgMfm+tHV+WbSgGza3ZT2mY5Mipg== X-Received: by 2002:adf:e68d:: with SMTP id r13mr14425809wrm.349.1580726480009; Mon, 03 Feb 2020 02:41:20 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:19 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 4/7] block, bfq: extend incomplete name of field on_st Date: Mon, 3 Feb 2020 11:40:57 +0100 Message-Id: <20200203104100.16965-5-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The flag on_st in the bfq_entity data structure is true if the entity is on a service tree or is in service. Yet the name of the field, confusingly, does not mention the second, very important case. Extend the name to mention the second case too. Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 2 +- block/bfq-iosched.c | 2 +- block/bfq-iosched.h | 2 +- block/bfq-wf2q.c | 11 +++++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index 8ab7f18ff8cb..c818c64766e5 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -659,7 +659,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq, if (bfq_bfqq_busy(bfqq)) bfq_deactivate_bfqq(bfqd, bfqq, false, false); - else if (entity->on_st) + else if (entity->on_st_or_in_serv) bfq_put_idle_entity(bfq_entity_service_tree(entity), entity); bfqg_and_blkg_put(bfqq_group(bfqq)); diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 15dfb0844644..28770ec7c06f 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1059,7 +1059,7 @@ bfq_bfqq_resume_state(struct bfq_queue *bfqq, struct bfq_data *bfqd, static int bfqq_process_refs(struct bfq_queue *bfqq) { - return bfqq->ref - bfqq->allocated - bfqq->entity.on_st - + return bfqq->ref - bfqq->allocated - bfqq->entity.on_st_or_in_serv - (bfqq->weight_counter != NULL); } diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 8526f20c53bc..f1cb89def7f8 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -150,7 +150,7 @@ struct bfq_entity { * Flag, true if the entity is on a tree (either the active or * the idle one of its service_tree) or is in service. */ - bool on_st; + bool on_st_or_in_serv; /* B-WF2Q+ start and finish timestamps [sectors/weight] */ u64 start, finish; diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index ffe9ce9faa89..26776bdbdf36 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -645,7 +645,7 @@ static void bfq_forget_entity(struct bfq_service_tree *st, { struct bfq_queue *bfqq = bfq_entity_to_bfqq(entity); - entity->on_st = false; + entity->on_st_or_in_serv = false; st->wsum -= entity->weight; if (bfqq && !is_in_service) bfq_put_queue(bfqq); @@ -999,7 +999,7 @@ static void __bfq_activate_entity(struct bfq_entity *entity, */ bfq_get_entity(entity); - entity->on_st = true; + entity->on_st_or_in_serv = true; } #ifdef CONFIG_BFQ_GROUP_IOSCHED @@ -1165,7 +1165,10 @@ bool __bfq_deactivate_entity(struct bfq_entity *entity, bool ins_into_idle_tree) struct bfq_service_tree *st; bool is_in_service; - if (!entity->on_st) /* entity never activated, or already inactive */ + if (!entity->on_st_or_in_serv) /* + * entity never activated, or + * already inactive + */ return false; /* @@ -1620,7 +1623,7 @@ bool __bfq_bfqd_reset_in_service(struct bfq_data *bfqd) * service tree either, then release the service reference to * the queue it represents (taken with bfq_get_entity). */ - if (!in_serv_entity->on_st) { + if (!in_serv_entity->on_st_or_in_serv) { /* * If no process is referencing in_serv_bfqq any * longer, then the service reference may be the only From patchwork Mon Feb 3 10:40:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362385 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2449C138D for ; Mon, 3 Feb 2020 10:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 025D72080D for ; Mon, 3 Feb 2020 10:41:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ClEgubha" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727783AbgBCKlf (ORCPT ); Mon, 3 Feb 2020 05:41:35 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:43645 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727387AbgBCKlX (ORCPT ); Mon, 3 Feb 2020 05:41:23 -0500 Received: by mail-wr1-f65.google.com with SMTP id z9so5097556wrs.10 for ; Mon, 03 Feb 2020 02:41: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=2JnpfsZk3kAtby8wy0jKx+72oyKbhVB+xt+XMt95DpU=; b=ClEgubhacM0r6j0bZGOk6QkgGy3B9LsAcvsQMJ5TWx1Nz/qWqosjWLWAJehkrjFICR 4d7HZRz9o9X+eU5NM2vPrPpo3PkvZ4SoP59HrGGDTbmCdCx48Nbd1FhqscNfWECOx97I 4armcQeDukX45wpG3QSFRINkyL81BNZAF0aMXKm8Nx0ihzhqBAHCTtkQWlRKk7kifhVq WaAtI0k1jMiu2GoRQZZx7bAO6CBkE0OfNv1h11ryfbAIJUnIjP2V2uNW+GuaWkKMLh02 1nP+UAwZurx5gUXwGeHwzptvTAPkyNBDA366IWoZz6r41Uf3944oA4G5lA0o7zsZwXjB IjGw== 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=2JnpfsZk3kAtby8wy0jKx+72oyKbhVB+xt+XMt95DpU=; b=E0RtRRCFfJo8v6cGaPT+GX7K3kYbdUuecVb4WGmvpayMXdIjRSf4iM/WyYwFzne31i d1xnpm7tAjH30mDGuA9b9Kskq1cLradsLZE5x9MhAOjebgcAFiBKB08Jxz8wSvK1U2Dq YV7ladJLumX/twq5e/9ytBJvLOn3EHf8zJKVEkcEz81PfUU943BJFIyFhscDW10foc4p +v84GZ9RR1yoSqaBRmgk8dO9Euq4i4yW8TNnGMAaU8UCJNMMlhmIrxRmaANuCZr+ymSh 4V2pqxziCUvHNGURYIMMbwU4N0eumF4oLJ6XEw2Co4s3xCAZtkeFrIVjDftxFSmE6+LE fqAg== X-Gm-Message-State: APjAAAWBOuH7/8n2Sauc8/2mJ+NO/+XUSwGq0Nqfglezdct30TLa6fAK 0i3HHrqV/dN586WLCJ4IqvNXbw== X-Google-Smtp-Source: APXvYqxYk7PxiHBDmIcORqLb4E1fjHW9hONnOxE+VHyuD8lX6ZB9yXsAInNQVM/mW4qwn69fi+OkGw== X-Received: by 2002:a5d:40d1:: with SMTP id b17mr13281359wrq.93.1580726481592; Mon, 03 Feb 2020 02:41:21 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:20 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 5/7] block, bfq: remove ifdefs from around gets/puts of bfq groups Date: Mon, 3 Feb 2020 11:40:58 +0100 Message-Id: <20200203104100.16965-6-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org ifdefs around gets and puts of bfq groups reduce readability, remove them. Reported-by: Jens Axboe Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 4 ++++ block/bfq-iosched.c | 6 +----- block/bfq-iosched.h | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index c818c64766e5..cae488b58049 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -1406,6 +1406,10 @@ struct bfq_group *bfqq_group(struct bfq_queue *bfqq) return bfqq->bfqd->root_group; } +void bfqg_and_blkg_get(struct bfq_group *bfqg) {} + +void bfqg_and_blkg_put(struct bfq_group *bfqg) {} + struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node) { struct bfq_group *bfqg; diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 28770ec7c06f..fff76c920968 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -4825,9 +4825,7 @@ void bfq_put_queue(struct bfq_queue *bfqq) { struct bfq_queue *item; struct hlist_node *n; -#ifdef CONFIG_BFQ_GROUP_IOSCHED struct bfq_group *bfqg = bfqq_group(bfqq); -#endif if (bfqq->bfqd) bfq_log_bfqq(bfqq->bfqd, bfqq, "put_queue: %p %d", @@ -4900,9 +4898,7 @@ void bfq_put_queue(struct bfq_queue *bfqq) bfqq->bfqd->last_completed_rq_bfqq = NULL; kmem_cache_free(bfq_pool, bfqq); -#ifdef CONFIG_BFQ_GROUP_IOSCHED bfqg_and_blkg_put(bfqg); -#endif } static void bfq_put_cooperator(struct bfq_queue *bfqq) @@ -6390,10 +6386,10 @@ static void bfq_exit_queue(struct elevator_queue *e) hrtimer_cancel(&bfqd->idle_slice_timer); -#ifdef CONFIG_BFQ_GROUP_IOSCHED /* release oom-queue reference to root group */ bfqg_and_blkg_put(bfqd->root_group); +#ifdef CONFIG_BFQ_GROUP_IOSCHED blkcg_deactivate_policy(bfqd->queue, &blkcg_policy_bfq); #else spin_lock_irq(&bfqd->lock); diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index f1cb89def7f8..2c7cec737b2a 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -921,6 +921,7 @@ struct bfq_group { #else struct bfq_group { + struct bfq_entity entity; struct bfq_sched_data sched_data; struct bfq_queue *async_bfqq[2][IOPRIO_BE_NR]; From patchwork Mon Feb 3 10:40:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362383 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EBAE813A4 for ; Mon, 3 Feb 2020 10:41:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CA4FC20661 for ; Mon, 3 Feb 2020 10:41:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vJ9AQJrI" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727196AbgBCKlc (ORCPT ); Mon, 3 Feb 2020 05:41:32 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36558 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727595AbgBCKlZ (ORCPT ); Mon, 3 Feb 2020 05:41:25 -0500 Received: by mail-wm1-f66.google.com with SMTP id p17so16324998wma.1 for ; Mon, 03 Feb 2020 02:41:23 -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=rzt4yAe3s0HBIE04/HczDDOIa4+f9r0CEH+uqzj+BDc=; b=vJ9AQJrI1BNhzha7OjhKAOLAwHr7Z+z7FaHE/TXavIB7TfKhs9SQePDc2R8bFtgs5t EVbMjFiIuIUfZfkHbLplmpieXt33rdSbtnVu2O5C1fizzkCT2brbn8/q6LwbVoW9e5wM imQ6Iwpzi1DfRuI0WZeC64+tvO8CUs2ymRxKzvpcSPOg8sPQb0PXKDg5kIRNfqVaGVF/ vw/nf6lnJ/5Ct4JrxcB4ocm+V8w1/Bp7p5AFAOZlMFFJ9yc+Y0TYrpfSalLil7S35uEl aQ0L2yQ+h9FEpQWcgR2Avz0qbvo+YbTk303y2qWju+6m8ioFjRclKCzJTXqUywsfzasl ci/A== 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=rzt4yAe3s0HBIE04/HczDDOIa4+f9r0CEH+uqzj+BDc=; b=Ada8G2InxXrmCFQyVM1d2pCp/aGbfCnERsMdnozsVRk33URwEqykFeC7waqVfpfL+7 mfJXmNCOMsD4WLpnmdFxPz987XfHEMyH9SKEM5D76du6VnAzm1SXHk/lHGqAuJYKrr/+ Uq6D65Bdwx7/Zc9RW699DrOhHuSdDUeiAWpYuT35GKNz/lSn9Err49qDfjG7ALyJXvBq jvj3+9fBDXzr1qH+Uh2nofrh3qAkaoSXUXWs6At7X6xO/IwFn+iFGJswuIs6oTv2krDZ CDYd+MLBjAcJQqem5oiokhdpz+lu906ZV8XK0JvX1LV4YlgQ9NrEejU9B8Wxnv33HC4g n6Eg== X-Gm-Message-State: APjAAAX5bjpMzHIaihHwtd2SdgAB12nKwp6LvodZSE1i0M/e5hEPbga9 uRtMZYLqFTkYHOg3F/7TLc5gzA== X-Google-Smtp-Source: APXvYqw515wJAJ5URUt4G4dWfEtITv3CNgLhWcem3hZCnhYkTKKDKFIe/C6Dkjwu362xwj3FjOsMkA== X-Received: by 2002:a7b:cbcf:: with SMTP id n15mr28134873wmi.21.1580726482645; Mon, 03 Feb 2020 02:41:22 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:22 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 6/7] block, bfq: get a ref to a group when adding it to a service tree Date: Mon, 3 Feb 2020 11:40:59 +0100 Message-Id: <20200203104100.16965-7-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org BFQ schedules generic entities, which may represent either bfq_queues or groups of bfq_queues. When an entity is inserted into a service tree, a reference must be taken, to make sure that the entity does not disappear while still referred in the tree. Unfortunately, such a reference is mistakenly taken only if the entity represents a bfq_queue. This commit takes a reference also in case the entity represents a group. Tested-by: Chris Evich Signed-off-by: Paolo Valente --- block/bfq-cgroup.c | 2 +- block/bfq-iosched.h | 1 + block/bfq-wf2q.c | 12 ++++++++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c index cae488b58049..09b69a3ed490 100644 --- a/block/bfq-cgroup.c +++ b/block/bfq-cgroup.c @@ -332,7 +332,7 @@ static void bfqg_put(struct bfq_group *bfqg) kfree(bfqg); } -static void bfqg_and_blkg_get(struct bfq_group *bfqg) +void bfqg_and_blkg_get(struct bfq_group *bfqg) { /* see comments in bfq_bic_update_cgroup for why refcounting bfqg */ bfqg_get(bfqg); diff --git a/block/bfq-iosched.h b/block/bfq-iosched.h index 2c7cec737b2a..d1233af9c684 100644 --- a/block/bfq-iosched.h +++ b/block/bfq-iosched.h @@ -985,6 +985,7 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd, struct blkcg_gq *bfqg_to_blkg(struct bfq_group *bfqg); struct bfq_group *bfqq_group(struct bfq_queue *bfqq); struct bfq_group *bfq_create_group_hierarchy(struct bfq_data *bfqd, int node); +void bfqg_and_blkg_get(struct bfq_group *bfqg); void bfqg_and_blkg_put(struct bfq_group *bfqg); #ifdef CONFIG_BFQ_GROUP_IOSCHED diff --git a/block/bfq-wf2q.c b/block/bfq-wf2q.c index 26776bdbdf36..eb0e2a6daabe 100644 --- a/block/bfq-wf2q.c +++ b/block/bfq-wf2q.c @@ -533,7 +533,9 @@ static void bfq_get_entity(struct bfq_entity *entity) bfqq->ref++; bfq_log_bfqq(bfqq->bfqd, bfqq, "get_entity: %p %d", bfqq, bfqq->ref); - } + } else + bfqg_and_blkg_get(container_of(entity, struct bfq_group, + entity)); } /** @@ -647,8 +649,14 @@ static void bfq_forget_entity(struct bfq_service_tree *st, entity->on_st_or_in_serv = false; st->wsum -= entity->weight; - if (bfqq && !is_in_service) + if (is_in_service) + return; + + if (bfqq) bfq_put_queue(bfqq); + else + bfqg_and_blkg_put(container_of(entity, struct bfq_group, + entity)); } /** From patchwork Mon Feb 3 10:41:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 11362381 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C09D8924 for ; Mon, 3 Feb 2020 10:41:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9EC4B20838 for ; Mon, 3 Feb 2020 10:41:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="HGk1szuN" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727650AbgBCKlc (ORCPT ); Mon, 3 Feb 2020 05:41:32 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:52691 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727196AbgBCKlZ (ORCPT ); Mon, 3 Feb 2020 05:41:25 -0500 Received: by mail-wm1-f67.google.com with SMTP id p9so15256823wmc.2 for ; Mon, 03 Feb 2020 02:41:24 -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=9M/C89B+RPb3s/AEZzJiX5HrsMKA5pqQCZ+d/xtiimQ=; b=HGk1szuNHr8Rpi6K6AEB+UGzUz7mmYy5IVSIeYVQhByZzdXdbUVfmZOZXNPt+6FaDn 9YBerNBayTRTP2fjJYfNbtSO6+LlPgjwjOIoPMubtwUGpgPGgQUiQYBBSfZRzhrcHCdO 1JVKDUJ1QWcbscUWrS8iB06shr7HP+gyNZcHpdeRLm65/PTor0LwZ0YzW5KmgOMjfs/i scaIjBh4sXpXhScIiFB/DEGdD47H9x/n5w/s5dq6+znXOb7O1TVkhhehsjOkmbz1aIBR 9crljBQOXioT5+DnOKMl5A2EdaWHjOrNys/mlU9TOGFuYovwWoVTCy5mkWfzsRSw7a2x 80QQ== 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=9M/C89B+RPb3s/AEZzJiX5HrsMKA5pqQCZ+d/xtiimQ=; b=cIe9NA/6XgrtgMTXeUHte2Kh6SC7ZD+c9u0XTUtMDR6ebm9cWUMAaWYosbioyQKHqE LcWgKWiQpqVytoNVkf3VFlWOdEq+Dnz0TvGjwTKARevXytOfdjPfftZtaYIH5mfvvED+ aS6ddwrqQSumXzQLv1LyhCwxmphpf0enHhMgP8yRIaL5k/IdgwKPfqnimpqpuQMgb3xp sCYGzKEXfE++NEctV3o1b1dloap8CuhdlCmXtLLIC1Rxyfq9QQHZIsuvrooQwd+ZvooY Y2K1KLAun+bRdwKAXu2yqVF7moLreFTE2jstLgkdsqdb2lhPKQdLol0NthYinr7iY0w+ +y9g== X-Gm-Message-State: APjAAAUHMzys1GLt4xKf05VnInGNMbwRGEmkAbDyM3KIHMwMfzQmJYAC M1rHq7Kl8bOAZ79r9pWjkYUwBA== X-Google-Smtp-Source: APXvYqzbBaAEE1ZuOQv8l5wyfJ6burueShpn1fgakonYTcdxiPDi2XpkDNjDG+Jz74vpXyUSnQ8E/g== X-Received: by 2002:a05:600c:d7:: with SMTP id u23mr29184394wmm.145.1580726484032; Mon, 03 Feb 2020 02:41:24 -0800 (PST) Received: from localhost.localdomain (84-33-65-46.dyn.eolo.it. [84.33.65.46]) by smtp.gmail.com with ESMTPSA id i204sm23798930wma.44.2020.02.03.02.41.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Feb 2020 02:41:23 -0800 (PST) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, patdung100@gmail.com, cevich@redhat.com, Paolo Valente Subject: [PATCH BUGFIX V2 7/7] block, bfq: clarify the goal of bfq_split_bfqq() Date: Mon, 3 Feb 2020 11:41:00 +0100 Message-Id: <20200203104100.16965-8-paolo.valente@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200203104100.16965-1-paolo.valente@linaro.org> References: <20200203104100.16965-1-paolo.valente@linaro.org> MIME-Version: 1.0 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The exact, general goal of the function bfq_split_bfqq() is not that apparent. Add a comment to make it clear. Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index fff76c920968..8c436abfaf14 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -5979,6 +5979,8 @@ static void bfq_finish_requeue_request(struct request *rq) } /* + * Removes the association between the current task and bfqq, assuming + * that bic points to the bfq iocontext of the task. * Returns NULL if a new bfqq should be allocated, or the old bfqq if this * was the last process referring to that bfqq. */