mbox series

[v3,0/4] Support user xattrs in cgroupfs

Message ID 20200312200317.31736-1-dxu@dxuuu.xyz (mailing list archive)
Headers show
Series Support user xattrs in cgroupfs | expand

Message

Daniel Xu March 12, 2020, 8:03 p.m. UTC
User extended attributes are useful as metadata storage for kernfs
consumers like cgroups. Especially in the case of cgroups, it is useful
to have a central metadata store that multiple processes/services can
use to coordinate actions.

A concrete example is for userspace out of memory killers. We want to
let delegated cgroup subtree owners (running as non-root) to be able to
say "please avoid killing this cgroup". This is especially important for
desktop linux as delegated subtrees owners are less likely to run as
root.

The first two commits set up some stuff for the third commit which
intro introduce a new flag, KERNFS_ROOT_SUPPORT_USER_XATTR,
that lets kernfs consumers enable user xattr support. The final commit
turns on user xattr support for cgroupfs.

Changes from v2:
- Rephrased commit message for "kernfs: kvmalloc xattr value instead of
  kmalloc"

Changes from v1:
- use kvmalloc for xattr values
- modify simple_xattr_set to return removed size
- add accounting for total user xattr size per cgroup

Daniel Xu (4):
  kernfs: kvmalloc xattr value instead of kmalloc
  kernfs: Add removed_size out param for simple_xattr_set
  kernfs: Add option to enable user xattrs
  cgroupfs: Support user xattrs

Daniel Xu (4):
  kernfs: kvmalloc xattr value instead of kmalloc
  kernfs: Add removed_size out param for simple_xattr_set
  kernfs: Add option to enable user xattrs
  cgroupfs: Support user xattrs

 fs/kernfs/inode.c           | 91 ++++++++++++++++++++++++++++++++++++-
 fs/kernfs/kernfs-internal.h |  2 +
 fs/xattr.c                  | 17 +++++--
 include/linux/kernfs.h      | 11 ++++-
 include/linux/xattr.h       |  3 +-
 kernel/cgroup/cgroup.c      |  3 +-
 mm/shmem.c                  |  2 +-
 7 files changed, 119 insertions(+), 10 deletions(-)

Comments

Tejun Heo March 12, 2020, 9:17 p.m. UTC | #1
Hello,

Daniel, the patchset looks good to me. Thanks a lot for working on
this.

Greg, provided that there aren't further objections, how do you wanna
route the patches? I'd be happy to take them through cgroup tree but
any tree is fine by me.

Thanks.
Tejun Heo March 12, 2020, 9:19 p.m. UTC | #2
On Thu, Mar 12, 2020 at 05:17:35PM -0400, Tejun Heo wrote:
> Greg, provided that there aren't further objections, how do you wanna
> route the patches? I'd be happy to take them through cgroup tree but
> any tree is fine by me.

Ooh, in case they get routed thorugh another tree, for the whole
series:

  Acked-by: Tejun Heo <tj@kernel.org>

Thanks.
Greg Kroah-Hartman March 12, 2020, 10:05 p.m. UTC | #3
On Thu, Mar 12, 2020 at 05:17:35PM -0400, Tejun Heo wrote:
> Hello,
> 
> Daniel, the patchset looks good to me. Thanks a lot for working on
> this.
> 
> Greg, provided that there aren't further objections, how do you wanna
> route the patches? I'd be happy to take them through cgroup tree but
> any tree is fine by me.

Sure, feel free to take them through your tree:

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Chris Down March 13, 2020, 1 a.m. UTC | #4
Daniel Xu writes:
>User extended attributes are useful as metadata storage for kernfs
>consumers like cgroups. Especially in the case of cgroups, it is useful
>to have a central metadata store that multiple processes/services can
>use to coordinate actions.
>
>A concrete example is for userspace out of memory killers. We want to
>let delegated cgroup subtree owners (running as non-root) to be able to
>say "please avoid killing this cgroup". This is especially important for
>desktop linux as delegated subtrees owners are less likely to run as
>root.
>
>The first two commits set up some stuff for the third commit which
>intro introduce a new flag, KERNFS_ROOT_SUPPORT_USER_XATTR,
>that lets kernfs consumers enable user xattr support. The final commit
>turns on user xattr support for cgroupfs.

The whole series looks good to me, thanks.

For the whole series:

Acked-by: Chris Down <chris@chrisdown.name>
Tejun Heo March 16, 2020, 7:55 p.m. UTC | #5
Applied to cgroup/for-5.7.

Thanks.