mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	Li Zefan <lizefan@huawei.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Song Liu <liu.song.a23@gmail.com>
Subject: Re: [PATCH 1/2] cgroup: Add generation number with cgroup id
Date: Thu, 24 Oct 2019 10:44:33 -0700	[thread overview]
Message-ID: <20191024174433.GA3622521@devbig004.ftw2.facebook.com> (raw)
In-Reply-To: <20191016125019.157144-2-namhyung@kernel.org>

Hello,

First of all, thanks a lot for working on this.

On Wed, Oct 16, 2019 at 09:50:18PM +0900, Namhyung Kim wrote:
> Current cgroup id is 32-bit and might be recycled while system is
> running.  To support unique id, add generation number (gen) to catch
> recycling and make 64 bit number.  This number will be used as kernfs
> id and inode number (and file handle).
> 
> Also introduced cgroup_idr struct to keep the idr and generation
> together.  The related functions are little bit modified as well and I
> made some change to cgroup_idr_alloc() to use cyclic allocator.
> 
> Later 64 bit system can have a simpler implementation with a single 64
> bit sequence number and a RB tree.  But it'll need to grab a spinlock
> during lookup.  I'm not entirely sure it's ok, so I left it as is.

Any chance I can persuade you into making this conversion?  idr is
exactly the wrong data structure to use for cyclic allocations.  We've
been doing it mostly for historical reasons but I really hope we can
move away from it.  These lookups aren't in super hot paths and doing
locked lookups should be fine.

>  /*
>   * A cgroup_root represents the root of a cgroup hierarchy, and may be
>   * associated with a kernfs_root to form an active hierarchy.  This is
> @@ -521,7 +529,7 @@ struct cgroup_root {
>  	unsigned int flags;
>  
>  	/* IDs for cgroups in this hierarchy */
> -	struct idr cgroup_idr;
> +	struct cgroup_idr cgroup_idr;

Given that there's cgroup->self css, can we get rid of the above?
Also, can we make css->id a 64bit value too?

Thanks.

-- 
tejun

  reply	other threads:[~2019-10-24 17:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 12:50 [PATCH 0/2] cgroup: Sync cgroup id and inode number Namhyung Kim
2019-10-16 12:50 ` [PATCH 1/2] cgroup: Add generation number with cgroup id Namhyung Kim
2019-10-24 17:44   ` Tejun Heo [this message]
2019-10-25  8:30     ` Namhyung Kim
2019-10-25  9:38       ` Namhyung Kim
2019-10-25 10:56         ` Tejun Heo
2019-10-26 11:32           ` Namhyung Kim
2019-10-25 11:06       ` Tejun Heo
2019-10-25 18:47         ` Tejun Heo
2019-10-26 11:42           ` Namhyung Kim
2019-11-01  0:47             ` Namhyung Kim
2019-10-26 11:40         ` Namhyung Kim
2019-10-16 12:50 ` [PATCH 2/2] kernfs: Allow creation with external gen + ino numbers Namhyung Kim
2019-10-24 17:52   ` Tejun Heo
2019-10-25  8:46     ` Namhyung Kim

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=20191024174433.GA3622521@devbig004.ftw2.facebook.com \
    --to=tj@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liu.song.a23@gmail.com \
    --cc=lizefan@huawei.com \
    --cc=namhyung@kernel.org \
    --cc=rafael@kernel.org \
    /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

Powered by JetHome