From: Tejun Heo <tj@kernel.org>
To: Yu Kuai <yukuai3@huawei.com>
Cc: axboe@kernel.dk, cgroups@vger.kernel.org,
linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
yi.zhang@huawei.com, zhangxiaoxu5@huawei.com, houtao1@huawei.com
Subject: Re: [RFC PATCH] blk-cgroup: prevent rcu_sched detected stalls warnings in blkg_destroy_all()
Date: Wed, 25 Nov 2020 07:32:48 -0500 [thread overview]
Message-ID: <X75O8BNVSX3ZE86w@mtj.duckdns.org> (raw)
In-Reply-To: <20201121083420.3857433-1-yukuai3@huawei.com>
Hello,
Thanks for the fix. A couple comments below.
On Sat, Nov 21, 2020 at 04:34:20PM +0800, Yu Kuai wrote:
> +#define BLKG_DESTROY_BATH 4096
I think you meant BLKG_DESTROY_BATCH.
> static void blkg_destroy_all(struct request_queue *q)
> {
> struct blkcg_gq *blkg, *n;
> + int count = BLKG_DESTROY_BATH;
But might as well just write 4096 here.
> spin_lock_irq(&q->queue_lock);
> list_for_each_entry_safe(blkg, n, &q->blkg_list, q_node) {
> struct blkcg *blkcg = blkg->blkcg;
>
> + /*
> + * If the list is too long, the loop can took a long time,
> + * thus relese the lock for a while when a batch of blkcg
> + * were destroyed.
> + */
> + if (!(--count)) {
> + count = BLKG_DESTROY_BATH;
> + spin_unlock_irq(&q->queue_lock);
> + cond_resched();
> + spin_lock_irq(&q->queue_lock);
You can't continue iteration after dropping both locks. You'd have to jump
out of loop and start list_for_each_entry_safe() again.
> + }
> spin_lock(&blkcg->lock);
> blkg_destroy(blkg);
> spin_unlock(&blkcg->lock);
Thanks.
--
tejun
next prev parent reply other threads:[~2020-11-25 12:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-21 8:34 Yu Kuai
2020-11-25 12:32 ` Tejun Heo [this message]
2020-11-25 12:49 ` yukuai (C)
2020-11-25 12:53 ` Tejun Heo
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=X75O8BNVSX3ZE86w@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=houtao1@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
--cc=zhangxiaoxu5@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®