Skip to contentSkip to conversation

cgroup changes for v4.18-rc1

GIT PULL Tejun Heo 2 participants 5 messages Jun 5, 2018 – Jun 6, 2018 cgroup

lore
Share & tools
lore

Tejun Heo

author maintainer
#0 lore raw

Hello, Linus.

cgroup changes for v4.18.

* For cpustat, cgroup has a percpu hierarchical stat mechanism which propagates up the hierarchy lazily. This pull request contains commits to factor out and generalize the mechanism so that it can be used for other cgroup stats too. The original intention was to update memcg stats to use it but memcg went for a different approach, so still the only user is cpustat. The factoring out and generalization still make sense and it's likely that this can be used for other purposes in the future.

* cgroup uses file modified events to notify certain events. A rate limiting mechanism is added.

* Other misc changes.

Thanks.

The following changes since commit fe03a7594d86e0754f05e604cd803a6a9aae3c1c:

Merge tag 'acpi-4.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm (2018-04-26 11:06:36 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup.git for-4.18

for you to fetch changes up to d8742e22902186e30c346b1ba881cb52942ae3e4:

cgroup: css_set_lock should nest inside tasklist_lock (2018-05-23 11:04:54 -0700)

----------------------------------------------------------------
Andy Shevchenko (1):
rdmacg: Convert to use match_string() helper

Tejun Heo (12):
cgroup: Explicitly remove core interface files
cgroup: Limit event generation frequency
cgroup: Rename kernel/cgroup/stat.c to kernel/cgroup/rstat.c
cgroup: Rename stat to rstat
cgroup: Distinguish base resource stat implementation from rstat
cgroup: Reorganize kernel/cgroup/rstat.c
cgroup: Factor out and expose cgroup_rstat_*() interface functions
cgroup: Replace cgroup_rstat_mutex with a spinlock
cgroup: Add cgroup_subsys->css_rstat_flush()
cgroup: Add memory barriers to plug cgroup_rstat_updated() race window
cgroup: Make cgroup_rstat_updated() ready for root cgroup usage
cgroup: css_set_lock should nest inside tasklist_lock

 include/linux/cgroup-defs.h     |  52 +++--
 include/linux/cgroup.h          |  12 +-
 kernel/cgroup/Makefile          |   2 +-
 kernel/cgroup/cgroup-internal.h |  11 +-
 kernel/cgroup/cgroup.c          | 105 +++++++---
 kernel/cgroup/rdma.c            |  35 ++--
 kernel/cgroup/rstat.c           | 416 ++++++++++++++++++++++++++++++++++++++++
 kernel/cgroup/stat.c            | 338 --------------------------------
 8 files changed, 554 insertions(+), 417 deletions(-)
 create mode 100644 kernel/cgroup/rstat.c
 delete mode 100644 kernel/cgroup/stat.c
Signature · 1 line
tejun
#1 lore raw
Quoted 3 lines · Tejun Heo

* cgroup uses file modified events to notify certain events. A rate limiting mechanism is added.

This "explanation" didn't really parse for me at all.

I edited the merge message to something that I think is correct and made more sense to me.

Linus

author maintainer
#2 lore raw

Hello, Linus.

Quoted 9 lines · Linus Torvalds
Quoted 3 lines · Tejun Heo

* cgroup uses file modified events to notify certain events. A rate limiting mechanism is added.

This "explanation" didn't really parse for me at all.

I edited the merge message to something that I think is correct and made more sense to me.

Heh, yeah, yours reads a lot better. Sorry about that. The background is that the mechanism was first added to generate notifications on events like cgroup becoming empty, which is very low frequency. Since then, we've expanded its usage to cover things like memory.high breached events which can be a lot higher frequency.

The notification implementation isn't super light weight, so the patch ratelimits the notifications by capping minimum notification interval interval to 10ms.

Thanks.

Signature · 1 line
tejun
#3 lore raw
Quoted 4 lines · Tejun Heo

The notification implementation isn't super light weight, so the patch ratelimits the notifications by capping minimum notification interval interval to 10ms.

Yeah, I looked at the patch (and the code) to make sense of the explanation.

My reaction to that was that it might be a better idea to simply not notify if a notification was already pending, rather than have the timeout. Or perhaps in addition to. The path _to_ the fsnotify code looked quite messy, though.

Linus

author maintainer
#4 lore raw
Quoted 6 lines · Linus Torvalds
Quoted 4 lines · Tejun Heo

The notification implementation isn't super light weight, so the patch ratelimits the notifications by capping minimum notification interval interval to 10ms.

Quoted 6 lines

Yeah, I looked at the patch (and the code) to make sense of the explanation.

My reaction to that was that it might be a better idea to simply not notify if a notification was already pending, rather than have the timeout. Or perhaps in addition to. The path _to_ the fsnotify code looked quite messy, though.

Yeah, getting to the inode is currently quite involved. Some of the complications come from the fact that a kernfs node can be associated with multiple inodes for sysfs namespace support.

The right thing to do could be linking the inodes to the kernfs node and protect it with a spinlock so that we don't have to punt and walk them directly from notification path.

For now, I think the 10ms thing is an acceptable workaround but this likely needs more work in the future.

Thanks.

Signature · 1 line
tejun