All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Kuai <yukuai3@huawei.com>
To: <paolo.valente@linaro.org>, <jack@suse.cz>, <axboe@kernel.dk>
Cc: <linux-block@vger.kernel.org>, <cgroups@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <yukuai3@huawei.com>,
	<yi.zhang@huawei.com>
Subject: [PATCH v3 2/3] block, bfq: avoid moving bfqq to it's parent bfqg
Date: Sat, 29 Jan 2022 09:59:23 +0800	[thread overview]
Message-ID: <20220129015924.3958918-3-yukuai3@huawei.com> (raw)
In-Reply-To: <20220129015924.3958918-1-yukuai3@huawei.com>

Moving bfqq to it's parent bfqg is pointless.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/bfq-cgroup.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 24a5c5329bcd..9783c1156159 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -645,6 +645,14 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		   struct bfq_group *bfqg)
 {
 	struct bfq_entity *entity = &bfqq->entity;
+	struct bfq_group *old_parent = bfqq_group(bfqq);
+
+	/*
+	 * No point to move bfqq to the same group, which can happen when
+	 * root group is offlined
+	 */
+	if (old_parent == bfqg)
+		return;
 
 	/*
 	 * Get extra reference to prevent bfqq from being freed in
@@ -666,7 +674,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		bfq_deactivate_bfqq(bfqd, bfqq, false, false);
 	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));
+	bfqg_and_blkg_put(old_parent);
 
 	if (entity->parent &&
 	    entity->parent->last_bfqq_created == bfqq)
-- 
2.31.1


WARNING: multiple messages have this Message-ID (diff)
From: Yu Kuai <yukuai3@huawei.com>
To: paolo.valente@linaro.org, jack@suse.cz, axboe@kernel.dk
Cc: linux-block@vger.kernel.org, cgroups@vger.kernel.org,
	linux-kernel@vger.kernel.org, yukuai3@huawei.com,
	yi.zhang@huawei.com
Subject: [PATCH v3 2/3] block, bfq: avoid moving bfqq to it's parent bfqg
Date: Sat, 29 Jan 2022 09:59:23 +0800	[thread overview]
Message-ID: <20220129015924.3958918-3-yukuai3@huawei.com> (raw)
In-Reply-To: <20220129015924.3958918-1-yukuai3@huawei.com>

Moving bfqq to it's parent bfqg is pointless.

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 block/bfq-cgroup.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/block/bfq-cgroup.c b/block/bfq-cgroup.c
index 24a5c5329bcd..9783c1156159 100644
--- a/block/bfq-cgroup.c
+++ b/block/bfq-cgroup.c
@@ -645,6 +645,14 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		   struct bfq_group *bfqg)
 {
 	struct bfq_entity *entity = &bfqq->entity;
+	struct bfq_group *old_parent = bfqq_group(bfqq);
+
+	/*
+	 * No point to move bfqq to the same group, which can happen when
+	 * root group is offlined
+	 */
+	if (old_parent == bfqg)
+		return;
 
 	/*
 	 * Get extra reference to prevent bfqq from being freed in
@@ -666,7 +674,7 @@ void bfq_bfqq_move(struct bfq_data *bfqd, struct bfq_queue *bfqq,
 		bfq_deactivate_bfqq(bfqd, bfqq, false, false);
 	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));
+	bfqg_and_blkg_put(old_parent);
 
 	if (entity->parent &&
 	    entity->parent->last_bfqq_created == bfqq)
-- 
2.31.1


  parent reply	other threads:[~2022-01-29  1:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-29  1:59 [PATCH v3 0/3] block, bfq: minor cleanup and fix Yu Kuai
2022-01-29  1:59 ` Yu Kuai
2022-01-29  1:51 ` Jens Axboe
2022-01-29  1:51   ` Jens Axboe
2022-01-29  2:05   ` yukuai (C)
2022-01-29  2:05     ` yukuai (C)
2022-02-10 11:46     ` yukuai (C)
2022-02-10 11:46       ` yukuai (C)
2022-02-18  8:30       ` yukuai (C)
2022-02-18  8:30         ` yukuai (C)
2022-01-29  1:59 ` [PATCH v3 1/3] block, bfq: cleanup bfq_bfqq_to_bfqg() Yu Kuai
2022-01-29  1:59   ` Yu Kuai
2022-01-29  1:59 ` Yu Kuai [this message]
2022-01-29  1:59   ` [PATCH v3 2/3] block, bfq: avoid moving bfqq to it's parent bfqg Yu Kuai
2022-02-08  3:53   ` yukuai (C)
2022-02-08  3:53     ` yukuai (C)
2022-02-08 16:07     ` Paolo Valente
2022-02-08 16:07       ` Paolo Valente
2022-01-29  1:59 ` [PATCH v3 3/3] block, bfq: don't move oom_bfqq Yu Kuai
2022-01-29  1:59   ` Yu Kuai
2022-02-18 13:13 ` [PATCH v3 0/3] block, bfq: minor cleanup and fix Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220129015924.3958918-3-yukuai3@huawei.com \
    --to=yukuai3@huawei.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=jack@suse.cz \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paolo.valente@linaro.org \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.