Skip to content

Commit 32d01dc

Browse files
committed
Merge branch 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup
Pull cgroup updates from Tejun Heo: "A lot updates for cgroup: - The biggest one is cgroup's conversion to kernfs. cgroup took after the long abandoned vfs-entangled sysfs implementation and made it even more convoluted over time. cgroup's internal objects were fused with vfs objects which also brought in vfs locking and object lifetime rules. Naturally, there are places where vfs rules don't fit and nasty hacks, such as credential switching or lock dance interleaving inode mutex and cgroup_mutex with object serial number comparison thrown in to decide whether the operation is actually necessary, needed to be employed. After conversion to kernfs, internal object lifetime and locking rules are mostly isolated from vfs interactions allowing shedding of several nasty hacks and overall simplification. This will also allow implmentation of operations which may affect multiple cgroups which weren't possible before as it would have required nesting i_mutexes. - Various simplifications including dropping of module support, easier cgroup name/path handling, simplified cgroup file type handling and task_cg_lists optimization. - Prepatory changes for the planned unified hierarchy, which is still a patchset away from being actually operational. The dummy hierarchy is updated to serve as the default unified hierarchy. Controllers which aren't claimed by other hierarchies are associated with it, which BTW was what the dummy hierarchy was for anyway. - Various fixes from Li and others. This pull request includes some patches to add missing slab.h to various subsystems. This was triggered xattr.h include removal from cgroup.h. cgroup.h indirectly got included a lot of files which brought in xattr.h which brought in slab.h. There are several merge commits - one to pull in kernfs updates necessary for converting cgroup (already in upstream through driver-core), others for interfering changes in the fixes branch" * 'for-3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup: (74 commits) cgroup: remove useless argument from cgroup_exit() cgroup: fix spurious lockdep warning in cgroup_exit() cgroup: Use RCU_INIT_POINTER(x, NULL) in cgroup.c cgroup: break kernfs active_ref protection in cgroup directory operations cgroup: fix cgroup_taskset walking order cgroup: implement CFTYPE_ONLY_ON_DFL cgroup: make cgrp_dfl_root mountable cgroup: drop const from @buffer of cftype->write_string() cgroup: rename cgroup_dummy_root and related names cgroup: move ->subsys_mask from cgroupfs_root to cgroup cgroup: treat cgroup_dummy_root as an equivalent hierarchy during rebinding cgroup: remove NULL checks from [pr_cont_]cgroup_{name|path}() cgroup: use cgroup_setup_root() to initialize cgroup_dummy_root cgroup: reorganize cgroup bootstrapping cgroup: relocate setting of CGRP_DEAD cpuset: use rcu_read_lock() to protect task_cs() cgroup_freezer: document freezer_fork() subtleties cgroup: update cgroup_transfer_tasks() to either succeed or fail cgroup: drop task_lock() protection around task->cgroups cgroup: update how a newly forked task gets associated with css_set ...
2 parents 68114e5 + 1ec4183 commit 32d01dc

32 files changed

Lines changed: 1913 additions & 2739 deletions

‎arch/sparc/kernel/leon_pci_grpci2.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/of_device.h>
99
#include <linux/kernel.h>
1010
#include <linux/pci.h>
11+
#include <linux/slab.h>
1112
#include <linux/delay.h>
1213
#include <linux/export.h>
1314
#include <asm/io.h>

‎arch/sparc/kernel/sun4m_irq.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
* Copyright (C) 1996 Dave Redman (djhr@tadpole.co.uk)
1010
*/
1111

12+
#include <linux/slab.h>
13+
1214
#include <asm/timer.h>
1315
#include <asm/traps.h>
1416
#include <asm/pgalloc.h>

‎block/blk-cgroup.c‎

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ static int blkcg_can_attach(struct cgroup_subsys_state *css,
894894
int ret = 0;
895895

896896
/* task_lock() is needed to avoid races with exit_io_context() */
897-
cgroup_taskset_for_each(task, css, tset) {
897+
cgroup_taskset_for_each(task, tset) {
898898
task_lock(task);
899899
ioc = task->io_context;
900900
if (ioc && atomic_read(&ioc->nr_tasks) > 1)
@@ -906,17 +906,14 @@ static int blkcg_can_attach(struct cgroup_subsys_state *css,
906906
return ret;
907907
}
908908

909-
struct cgroup_subsys blkio_subsys = {
910-
.name = "blkio",
909+
struct cgroup_subsys blkio_cgrp_subsys = {
911910
.css_alloc = blkcg_css_alloc,
912911
.css_offline = blkcg_css_offline,
913912
.css_free = blkcg_css_free,
914913
.can_attach = blkcg_can_attach,
915-
.subsys_id = blkio_subsys_id,
916914
.base_cftypes = blkcg_files,
917-
.module = THIS_MODULE,
918915
};
919-
EXPORT_SYMBOL_GPL(blkio_subsys);
916+
EXPORT_SYMBOL_GPL(blkio_cgrp_subsys);
920917

921918
/**
922919
* blkcg_activate_policy - activate a blkcg policy on a request_queue
@@ -1106,7 +1103,7 @@ int blkcg_policy_register(struct blkcg_policy *pol)
11061103

11071104
/* everything is in place, add intf files for the new policy */
11081105
if (pol->cftypes)
1109-
WARN_ON(cgroup_add_cftypes(&blkio_subsys, pol->cftypes));
1106+
WARN_ON(cgroup_add_cftypes(&blkio_cgrp_subsys, pol->cftypes));
11101107
ret = 0;
11111108
out_unlock:
11121109
mutex_unlock(&blkcg_pol_mutex);

‎block/blk-cgroup.h‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css)
186186

187187
static inline struct blkcg *task_blkcg(struct task_struct *tsk)
188188
{
189-
return css_to_blkcg(task_css(tsk, blkio_subsys_id));
189+
return css_to_blkcg(task_css(tsk, blkio_cgrp_id));
190190
}
191191

192192
static inline struct blkcg *bio_blkcg(struct bio *bio)
@@ -241,12 +241,16 @@ static inline struct blkcg_gq *pd_to_blkg(struct blkg_policy_data *pd)
241241
*/
242242
static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
243243
{
244-
int ret;
244+
char *p;
245245

246-
ret = cgroup_path(blkg->blkcg->css.cgroup, buf, buflen);
247-
if (ret)
246+
p = cgroup_path(blkg->blkcg->css.cgroup, buf, buflen);
247+
if (!p) {
248248
strncpy(buf, "<unavailable>", buflen);
249-
return ret;
249+
return -ENAMETOOLONG;
250+
}
251+
252+
memmove(buf, p, buf + buflen - p);
253+
return 0;
250254
}
251255

252256
/**

‎block/blk-throttle.c‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1408,13 +1408,13 @@ static int tg_set_conf(struct cgroup_subsys_state *css, struct cftype *cft,
14081408
}
14091409

14101410
static int tg_set_conf_u64(struct cgroup_subsys_state *css, struct cftype *cft,
1411-
const char *buf)
1411+
char *buf)
14121412
{
14131413
return tg_set_conf(css, cft, buf, true);
14141414
}
14151415

14161416
static int tg_set_conf_uint(struct cgroup_subsys_state *css, struct cftype *cft,
1417-
const char *buf)
1417+
char *buf)
14181418
{
14191419
return tg_set_conf(css, cft, buf, false);
14201420
}
@@ -1425,28 +1425,24 @@ static struct cftype throtl_files[] = {
14251425
.private = offsetof(struct throtl_grp, bps[READ]),
14261426
.seq_show = tg_print_conf_u64,
14271427
.write_string = tg_set_conf_u64,
1428-
.max_write_len = 256,
14291428
},
14301429
{
14311430
.name = "throttle.write_bps_device",
14321431
.private = offsetof(struct throtl_grp, bps[WRITE]),
14331432
.seq_show = tg_print_conf_u64,
14341433
.write_string = tg_set_conf_u64,
1435-
.max_write_len = 256,
14361434
},
14371435
{
14381436
.name = "throttle.read_iops_device",
14391437
.private = offsetof(struct throtl_grp, iops[READ]),
14401438
.seq_show = tg_print_conf_uint,
14411439
.write_string = tg_set_conf_uint,
1442-
.max_write_len = 256,
14431440
},
14441441
{
14451442
.name = "throttle.write_iops_device",
14461443
.private = offsetof(struct throtl_grp, iops[WRITE]),
14471444
.seq_show = tg_print_conf_uint,
14481445
.write_string = tg_set_conf_uint,
1449-
.max_write_len = 256,
14501446
},
14511447
{
14521448
.name = "throttle.io_service_bytes",

‎block/cfq-iosched.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1701,13 +1701,13 @@ static int __cfqg_set_weight_device(struct cgroup_subsys_state *css,
17011701
}
17021702

17031703
static int cfqg_set_weight_device(struct cgroup_subsys_state *css,
1704-
struct cftype *cft, const char *buf)
1704+
struct cftype *cft, char *buf)
17051705
{
17061706
return __cfqg_set_weight_device(css, cft, buf, false);
17071707
}
17081708

17091709
static int cfqg_set_leaf_weight_device(struct cgroup_subsys_state *css,
1710-
struct cftype *cft, const char *buf)
1710+
struct cftype *cft, char *buf)
17111711
{
17121712
return __cfqg_set_weight_device(css, cft, buf, true);
17131713
}
@@ -1838,7 +1838,6 @@ static struct cftype cfq_blkcg_files[] = {
18381838
.flags = CFTYPE_ONLY_ON_ROOT,
18391839
.seq_show = cfqg_print_leaf_weight_device,
18401840
.write_string = cfqg_set_leaf_weight_device,
1841-
.max_write_len = 256,
18421841
},
18431842
{
18441843
.name = "weight",
@@ -1853,7 +1852,6 @@ static struct cftype cfq_blkcg_files[] = {
18531852
.flags = CFTYPE_NOT_ON_ROOT,
18541853
.seq_show = cfqg_print_weight_device,
18551854
.write_string = cfqg_set_weight_device,
1856-
.max_write_len = 256,
18571855
},
18581856
{
18591857
.name = "weight",
@@ -1866,7 +1864,6 @@ static struct cftype cfq_blkcg_files[] = {
18661864
.name = "leaf_weight_device",
18671865
.seq_show = cfqg_print_leaf_weight_device,
18681866
.write_string = cfqg_set_leaf_weight_device,
1869-
.max_write_len = 256,
18701867
},
18711868
{
18721869
.name = "leaf_weight",

‎fs/bio.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1969,7 +1969,7 @@ int bio_associate_current(struct bio *bio)
19691969

19701970
/* associate blkcg if exists */
19711971
rcu_read_lock();
1972-
css = task_css(current, blkio_subsys_id);
1972+
css = task_css(current, blkio_cgrp_id);
19731973
if (css && css_tryget(css))
19741974
bio->bi_css = css;
19751975
rcu_read_unlock();

‎fs/kernfs/dir.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ char *kernfs_path(struct kernfs_node *kn, char *buf, size_t buflen)
112112
spin_unlock_irqrestore(&kernfs_rename_lock, flags);
113113
return p;
114114
}
115+
EXPORT_SYMBOL_GPL(kernfs_path);
115116

116117
/**
117118
* pr_cont_kernfs_name - pr_cont name of a kernfs_node

0 commit comments

Comments
 (0)