linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: gregkh@linuxfoundation.org
Cc: kernel-team@fb.com, linux-kernel@vger.kernel.org,
	cgroups@vger.kernel.org, lizefan@huawei.com, hannes@cmpxchg.org,
	namhyung@kernel.org, ast@kernel.org, daniel@iogearbox.net
Subject: [PATCHSET cgroup/for-5.5] kernfs,cgroup: support 64bit inos and unify cgroup IDs
Date: Mon,  4 Nov 2019 15:59:34 -0800	[thread overview]
Message-ID: <20191104235944.3470866-1-tj@kernel.org> (raw)

Hello,

Currently, there are three IDs which are being used to identify a
cgroup.

1. cgroup->id
2. cgroupfs 32bit ino
3. cgroupfs 32bit ino + 32bit gen

All three IDs are visible to userland through different interfaces.
This is very confusing and #1 can't even be resolved to cgroups from
userland.

A 64bit number is sufficient to identify a cgroup instance uniquely
and ino_t is 64bit on all archs except for alpha.  There's no reason
for three different IDs at all.  This patchset updates kernfs so that
it supports 64bit ino and associated exportfs operations and unifies
the cgroup IDs.

* On 64bit ino archs, ino is kernfs node ID which is also the cgroup
  ID.  The ino can be passed directly into open_by_handle_at(2) w/ the
  new key type FILEID_KERNFS.  Backward compatibility is maintained
  for FILEID_INO32_GEN keys.

* On 32bit ino archs, kernfs node ID is still 64bit and the cgroup ID.
  ino is the low 32bits and gen is the high 32bits.  If the high
  32bits is zero, open_by_handle_at(2) only matches the ino part of
  the ID allowing userland to resolve inos to cgroups as long as
  distinguishing recycled inos isn't necessary.

This patchset contains the following 10 patches.

 0001-kernfs-fix-ino-wrap-around-detection.patch
 0002-writeback-use-ino_t-for-inodes-in-tracepoints.patch
 0003-netprio-use-css-ID-instead-of-cgroup-ID.patch
 0004-kernfs-use-dumber-locking-for-kernfs_find_and_get_no.patch
 0005-kernfs-kernfs_find_and_get_node_by_ino-should-only-l.patch
 0006-kernfs-convert-kernfs_node-id-from-union-kernfs_node.patch
 0007-kernfs-combine-ino-id-lookup-functions-into-kernfs_f.patch
 0008-kernfs-implement-custom-exportfs-ops-and-fid-type.patch
 0009-kernfs-use-64bit-inos-if-ino_t-is-64bit.patch
 0010-cgroup-use-cgrp-kn-id-as-the-cgroup-ID.patch

0001 is a fix which should be backported through -stable.  0002 and
0003 are prep patches.  0004-0009 make kernfs_node->id a u64 and use
it as ino on 64bit ino archs.  0010 replaces cgroup->id with the
kernfs node ID.

Greg, how do you want to route the patches?  We can route 0001-0009
through your tree and the last one through cgroup after pulling in.
I'd be happy to route them all too.

This patchset is also available in the following git branch.

  git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git review-unified-cgid

diffstat follows.  Thanks.

 fs/kernfs/dir.c                  |  101 +++++++++++++++++++-------------------
 fs/kernfs/file.c                 |    4 -
 fs/kernfs/inode.c                |    4 -
 fs/kernfs/kernfs-internal.h      |    2 
 fs/kernfs/mount.c                |  102 ++++++++++++++++++++++-----------------
 include/linux/cgroup-defs.h      |   17 ------
 include/linux/cgroup.h           |   26 ++++-----
 include/linux/exportfs.h         |    5 +
 include/linux/kernfs.h           |   57 ++++++++++++++-------
 include/net/netprio_cgroup.h     |    2 
 include/trace/events/cgroup.h    |    6 +-
 include/trace/events/writeback.h |   92 +++++++++++++++++------------------
 kernel/bpf/helpers.c             |    2 
 kernel/bpf/local_storage.c       |    2 
 kernel/cgroup/cgroup.c           |   81 ++++++++++--------------------
 kernel/trace/blktrace.c          |   84 +++++++++++++++++---------------
 net/core/filter.c                |    4 -
 net/core/netprio_cgroup.c        |    8 +--
 18 files changed, 301 insertions(+), 298 deletions(-)

--
tejun


             reply	other threads:[~2019-11-04 23:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 23:59 Tejun Heo [this message]
2019-11-04 23:59 ` [PATCH 01/10] kernfs: fix ino wrap-around detection Tejun Heo
2019-11-04 23:59 ` [PATCH 02/10] writeback: use ino_t for inodes in tracepoints Tejun Heo
2019-11-05  9:11   ` Jan Kara
2019-11-04 23:59 ` [PATCH 03/10] netprio: use css ID instead of cgroup ID Tejun Heo
2019-11-05 13:27   ` Neil Horman
2019-11-04 23:59 ` [PATCH 04/10] kernfs: use dumber locking for kernfs_find_and_get_node_by_ino() Tejun Heo
2019-11-04 23:59 ` [PATCH 05/10] kernfs: kernfs_find_and_get_node_by_ino() should only look up activated nodes Tejun Heo
2019-11-04 23:59 ` [PATCH 06/10] kernfs: convert kernfs_node->id from union kernfs_node_id to u64 Tejun Heo
2019-11-04 23:59 ` [PATCH 07/10] kernfs: combine ino/id lookup functions into kernfs_find_and_get_node_by_id() Tejun Heo
2019-11-04 23:59 ` [PATCH 08/10] kernfs: implement custom exportfs ops and fid type Tejun Heo
2019-11-04 23:59 ` [PATCH 09/10] kernfs: use 64bit inos if ino_t is 64bit Tejun Heo
2019-11-04 23:59 ` [PATCH 10/10] cgroup: use cgrp->kn->id as the cgroup ID Tejun Heo
2019-11-06 13:50 ` [PATCHSET cgroup/for-5.5] kernfs,cgroup: support 64bit inos and unify cgroup IDs Namhyung Kim
2019-11-07 15:31   ` Tejun Heo
2019-11-12 15:51 ` Tejun Heo
2019-11-12 16:08   ` Greg KH
2019-11-12 16:09 ` Greg KH
2019-11-12 16:19   ` 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=20191104235944.3470866-1-tj@kernel.org \
    --to=tj@kernel.org \
    --cc=ast@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=namhyung@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;
as well as URLs for NNTP newsgroup(s).