linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Xu <dxu@dxuuu.xyz>
To: cgroups@vger.kernel.org, tj@kernel.org, lizefan@huawei.com,
	hannes@cmpxchg.org
Cc: Daniel Xu <dxu@dxuuu.xyz>,
	shakeelb@google.com, linux-kernel@vger.kernel.org,
	gregkh@linuxfoundation.org, kernel-team@fb.com
Subject: [PATCH v2 0/4] Support user xattrs in cgroupfs
Date: Thu,  5 Mar 2020 13:16:28 -0800	[thread overview]
Message-ID: <20200305211632.15369-1-dxu@dxuuu.xyz> (raw)

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 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

 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(-)

-- 
2.21.1


             reply	other threads:[~2020-03-05 21:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 21:16 Daniel Xu [this message]
2020-03-05 21:16 ` [PATCH v2 1/4] kernfs: kvmalloc xattr value instead of kmalloc Daniel Xu
2020-03-06  8:49   ` Joe Perches
2020-03-06  9:37     ` Greg KH
2020-03-09 18:21     ` Daniel Xu
2020-03-09 19:41       ` Joe Perches
2020-03-09 19:51         ` Tejun Heo
2020-03-09 19:58           ` Joe Perches
2020-03-09 20:05             ` Tejun Heo
2020-03-10 19:40   ` Shakeel Butt
2020-03-10 20:40     ` Daniel Xu
2020-03-10 20:41       ` Shakeel Butt
2020-03-05 21:16 ` [PATCH v2 2/4] kernfs: Add removed_size out param for simple_xattr_set Daniel Xu
2020-03-10 18:20   ` Daniel Xu
2020-03-05 21:16 ` [PATCH v2 3/4] kernfs: Add option to enable user xattrs Daniel Xu
2020-03-05 21:16 ` [PATCH v2 4/4] cgroupfs: Support " Daniel Xu

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=20200305211632.15369-1-dxu@dxuuu.xyz \
    --to=dxu@dxuuu.xyz \
    --cc=cgroups@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kernel-team@fb.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=shakeelb@google.com \
    --cc=tj@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).