[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190209135231.GA1910@xps-13>
Date: Sat, 9 Feb 2019 14:52:31 +0100
From: Andrea Righi <righi.andrea@...il.com>
To: Josef Bacik <josef@...icpanda.com>
Cc: Paolo Valente <paolo.valente@...aro.org>,
Tejun Heo <tj@...nel.org>, Li Zefan <lizefan@...wei.com>,
Johannes Weiner <hannes@...xchg.org>,
Jens Axboe <axboe@...nel.dk>, Vivek Goyal <vgoyal@...hat.com>,
Dennis Zhou <dennis@...nel.org>, cgroups@...r.kernel.org,
linux-block@...r.kernel.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] blkcg: prevent priority inversion problem during
sync()
On Sat, Feb 09, 2019 at 01:06:33PM +0100, Andrea Righi wrote:
...
> +/**
> + * blkcg_wb_waiters_on_bdi - check for writeback waiters on a block device
> + * @bdi: block device to check
> + *
> + * Return true if any other blkcg is waiting for writeback on the target block
> + * device, false otherwise.
> + */
> +bool blkcg_wb_waiters_on_bdi(struct backing_dev_info *bdi)
> +{
> + struct blkcg *blkcg, *curr_blkcg;
> + bool ret = false;
> +
> + if (unlikely(!bdi))
> + return false;
> +
> + rcu_read_lock();
> + curr_blkcg = css_to_blkcg(task_css(current, io_cgrp_id));
Sorry, the logic is messed up here. We shouldn't get curr_blkcg from the
current task, because during writeback throttling the context is
obviously not the current task.
I'll post a new patch soon.
> + list_for_each_entry_rcu(blkcg, &bdi->cgwb_waiters, cgwb_wait_node)
> + if (blkcg != curr_blkcg) {
> + ret = true;
> + break;
> + }
> + rcu_read_unlock();
> +
> + return ret;
> +}
-Andrea
Powered by blists - more mailing lists