Skip to content

Commit f075e0f

Browse files
committed
Merge branch 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: "The bulk of changes are cleanups and preparations for the upcoming kernfs conversion. - cgroup_event mechanism which is and will be used only by memcg is moved to memcg. - pidlist handling is updated so that it can be served by seq_file. Also, the list is not sorted if sane_behavior. cgroup documentation explicitly states that the file is not sorted but it has been for quite some time. - All cgroup file handling now happens on top of seq_file. This is to prepare for kernfs conversion. In addition, all operations are restructured so that they map 1-1 to kernfs operations. - Other cleanups and low-pri fixes" * 'for-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (40 commits) cgroup: trivial style updates cgroup: remove stray references to css_id doc: cgroups: Fix typo in doc/cgroups cgroup: fix fail path in cgroup_load_subsys() cgroup: fix missing unlock on error in cgroup_load_subsys() cgroup: remove for_each_root_subsys() cgroup: implement for_each_css() cgroup: factor out cgroup_subsys_state creation into create_css() cgroup: combine css handling loops in cgroup_create() cgroup: reorder operations in cgroup_create() cgroup: make for_each_subsys() useable under cgroup_root_mutex cgroup: css iterations and css_from_dir() are safe under cgroup_mutex cgroup: unify pidlist and other file handling cgroup: replace cftype->read_seq_string() with cftype->seq_show() cgroup: attach cgroup_open_file to all cgroup files cgroup: generalize cgroup_pidlist_open_file cgroup: unify read path so that seq_file is always used cgroup: unify cgroup_write_X64() and cgroup_write_string() cgroup: remove cftype->read(), ->read_map() and ->write() hugetlb_cgroup: convert away from cftype->read() ...
2 parents 5cb7398 + dd4b0a4 commit f075e0f

20 files changed

Lines changed: 1022 additions & 1098 deletions

File tree

‎Documentation/cgroups/cgroups.txt‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ CONTENTS:
2424
2.1 Basic Usage
2525
2.2 Attaching processes
2626
2.3 Mounting hierarchies by name
27-
2.4 Notification API
2827
3. Kernel API
2928
3.1 Overview
3029
3.2 Synchronization
@@ -472,25 +471,6 @@ you give a subsystem a name.
472471
The name of the subsystem appears as part of the hierarchy description
473472
in /proc/mounts and /proc/<pid>/cgroups.
474473

475-
2.4 Notification API
476-
--------------------
477-
478-
There is mechanism which allows to get notifications about changing
479-
status of a cgroup.
480-
481-
To register a new notification handler you need to:
482-
- create a file descriptor for event notification using eventfd(2);
483-
- open a control file to be monitored (e.g. memory.usage_in_bytes);
484-
- write "<event_fd> <control_fd> <args>" to cgroup.event_control.
485-
Interpretation of args is defined by control file implementation;
486-
487-
eventfd will be woken up by control file implementation or when the
488-
cgroup is removed.
489-
490-
To unregister a notification handler just close eventfd.
491-
492-
NOTE: Support of notifications should be implemented for the control
493-
file. See documentation for the subsystem.
494474

495475
3. Kernel API
496476
=============

‎Documentation/cgroups/memory.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ Each memcg's numa_stat file includes "total", "file", "anon" and "unevictable"
577577
per-node page counts including "hierarchical_<counter>" which sums up all
578578
hierarchical children's values in addition to the memcg's own value.
579579

580-
The ouput format of memory.numa_stat is:
580+
The output format of memory.numa_stat is:
581581

582582
total=<total pages> N0=<node 0 pages> N1=<node 1 pages> ...
583583
file=<total file pages> N0=<node 0 pages> N1=<node 1 pages> ...
@@ -670,7 +670,7 @@ page tables.
670670

671671
8.1 Interface
672672

673-
This feature is disabled by default. It can be enabledi (and disabled again) by
673+
This feature is disabled by default. It can be enabled (and disabled again) by
674674
writing to memory.move_charge_at_immigrate of the destination cgroup.
675675

676676
If you want to enable it:

‎Documentation/cgroups/resource_counter.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ to work with it.
9797
(struct res_counter *rc, struct res_counter *top,
9898
unsinged long val)
9999

100-
Almost same as res_cunter_uncharge() but propagation of uncharge
101-
stops when rc == top. This is useful when kill a res_coutner in
100+
Almost same as res_counter_uncharge() but propagation of uncharge
101+
stops when rc == top. This is useful when kill a res_counter in
102102
child cgroup.
103103

104104
2.1 Other accounting routines

‎block/blk-throttle.c‎

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,13 +1303,10 @@ static u64 tg_prfill_cpu_rwstat(struct seq_file *sf,
13031303
return __blkg_prfill_rwstat(sf, pd, &rwstat);
13041304
}
13051305

1306-
static int tg_print_cpu_rwstat(struct cgroup_subsys_state *css,
1307-
struct cftype *cft, struct seq_file *sf)
1306+
static int tg_print_cpu_rwstat(struct seq_file *sf, void *v)
13081307
{
1309-
struct blkcg *blkcg = css_to_blkcg(css);
1310-
1311-
blkcg_print_blkgs(sf, blkcg, tg_prfill_cpu_rwstat, &blkcg_policy_throtl,
1312-
cft->private, true);
1308+
blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_cpu_rwstat,
1309+
&blkcg_policy_throtl, seq_cft(sf)->private, true);
13131310
return 0;
13141311
}
13151312

@@ -1335,19 +1332,17 @@ static u64 tg_prfill_conf_uint(struct seq_file *sf, struct blkg_policy_data *pd,
13351332
return __blkg_prfill_u64(sf, pd, v);
13361333
}
13371334

1338-
static int tg_print_conf_u64(struct cgroup_subsys_state *css,
1339-
struct cftype *cft, struct seq_file *sf)
1335+
static int tg_print_conf_u64(struct seq_file *sf, void *v)
13401336
{
1341-
blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_u64,
1342-
&blkcg_policy_throtl, cft->private, false);
1337+
blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_u64,
1338+
&blkcg_policy_throtl, seq_cft(sf)->private, false);
13431339
return 0;
13441340
}
13451341

1346-
static int tg_print_conf_uint(struct cgroup_subsys_state *css,
1347-
struct cftype *cft, struct seq_file *sf)
1342+
static int tg_print_conf_uint(struct seq_file *sf, void *v)
13481343
{
1349-
blkcg_print_blkgs(sf, css_to_blkcg(css), tg_prfill_conf_uint,
1350-
&blkcg_policy_throtl, cft->private, false);
1344+
blkcg_print_blkgs(sf, css_to_blkcg(seq_css(sf)), tg_prfill_conf_uint,
1345+
&blkcg_policy_throtl, seq_cft(sf)->private, false);
13511346
return 0;
13521347
}
13531348

@@ -1428,40 +1423,40 @@ static struct cftype throtl_files[] = {
14281423
{
14291424
.name = "throttle.read_bps_device",
14301425
.private = offsetof(struct throtl_grp, bps[READ]),
1431-
.read_seq_string = tg_print_conf_u64,
1426+
.seq_show = tg_print_conf_u64,
14321427
.write_string = tg_set_conf_u64,
14331428
.max_write_len = 256,
14341429
},
14351430
{
14361431
.name = "throttle.write_bps_device",
14371432
.private = offsetof(struct throtl_grp, bps[WRITE]),
1438-
.read_seq_string = tg_print_conf_u64,
1433+
.seq_show = tg_print_conf_u64,
14391434
.write_string = tg_set_conf_u64,
14401435
.max_write_len = 256,
14411436
},
14421437
{
14431438
.name = "throttle.read_iops_device",
14441439
.private = offsetof(struct throtl_grp, iops[READ]),
1445-
.read_seq_string = tg_print_conf_uint,
1440+
.seq_show = tg_print_conf_uint,
14461441
.write_string = tg_set_conf_uint,
14471442
.max_write_len = 256,
14481443
},
14491444
{
14501445
.name = "throttle.write_iops_device",
14511446
.private = offsetof(struct throtl_grp, iops[WRITE]),
1452-
.read_seq_string = tg_print_conf_uint,
1447+
.seq_show = tg_print_conf_uint,
14531448
.write_string = tg_set_conf_uint,
14541449
.max_write_len = 256,
14551450
},
14561451
{
14571452
.name = "throttle.io_service_bytes",
14581453
.private = offsetof(struct tg_stats_cpu, service_bytes),
1459-
.read_seq_string = tg_print_cpu_rwstat,
1454+
.seq_show = tg_print_cpu_rwstat,
14601455
},
14611456
{
14621457
.name = "throttle.io_serviced",
14631458
.private = offsetof(struct tg_stats_cpu, serviced),
1464-
.read_seq_string = tg_print_cpu_rwstat,
1459+
.seq_show = tg_print_cpu_rwstat,
14651460
},
14661461
{ } /* terminate */
14671462
};

0 commit comments

Comments
 (0)