[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190806160102.11366694af6b56d9c4ca6ea3@linux-foundation.org>
Date: Tue, 6 Aug 2019 16:01:02 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Tejun Heo <tj@...nel.org>
Cc: axboe@...nel.dk, jack@...e.cz, hannes@...xchg.org,
mhocko@...nel.org, vdavydov.dev@...il.com, cgroups@...r.kernel.org,
linux-mm@...ck.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...com, guro@...com
Subject: Re: [PATCH 2/4] bdi: Add bdi->id
On Sat, 3 Aug 2019 07:01:53 -0700 Tejun Heo <tj@...nel.org> wrote:
> There currently is no way to universally identify and lookup a bdi
> without holding a reference and pointer to it. This patch adds an
> non-recycling bdi->id and implements bdi_get_by_id() which looks up
> bdis by their ids. This will be used by memcg foreign inode flushing.
Why is the id non-recycling? Presumably to address some
lifetime/lookup issues, but what are they?
Why was the IDR code not used?
> I left bdi_list alone for simplicity and because while rb_tree does
> support rcu assignment it doesn't seem to guarantee lossless walk when
> walk is racing aginst tree rebalance operations.
>
> ...
>
> +/**
> + * bdi_get_by_id - lookup and get bdi from its id
> + * @id: bdi id to lookup
> + *
> + * Find bdi matching @id and get it. Returns NULL if the matching bdi
> + * doesn't exist or is already unregistered.
> + */
> +struct backing_dev_info *bdi_get_by_id(u64 id)
> +{
> + struct backing_dev_info *bdi = NULL;
> + struct rb_node **p;
> +
> + spin_lock_irq(&bdi_lock);
Why irq-safe? Everywhere else uses spin_lock_bh(&bdi_lock).
> + p = bdi_lookup_rb_node(id, NULL);
> + if (*p) {
> + bdi = rb_entry(*p, struct backing_dev_info, rb_node);
> + bdi_get(bdi);
> + }
> + spin_unlock_irq(&bdi_lock);
> +
> + return bdi;
> +}
> +
>
> ...
>
Powered by blists - more mailing lists