From: Peter Zijlstra split off from the large bdi_init patch because cgroups are not slated for mainline any time soon. Signed-off-by: Peter Zijlstra Signed-off-by: Andrew Morton --- kernel/cgroup.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff -puN kernel/cgroup.c~task-cgroupsv11-add-procfs-interface-cgroups-bdi-init-hooks kernel/cgroup.c --- a/kernel/cgroup.c~task-cgroupsv11-add-procfs-interface-cgroups-bdi-init-hooks +++ a/kernel/cgroup.c @@ -250,12 +250,13 @@ static int cgroup_populate_dir(struct static struct inode_operations cgroup_dir_inode_operations; static struct file_operations proc_cgroupstats_operations; +static struct backing_dev_info cgroup_backing_dev_info = { + .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, +}; + static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb) { struct inode *inode = new_inode(sb); - static struct backing_dev_info cgroup_backing_dev_info = { - .capabilities = BDI_CAP_NO_ACCT_DIRTY | BDI_CAP_NO_WRITEBACK, - }; if (inode) { inode->i_mode = mode; @@ -1570,6 +1571,10 @@ int __init cgroup_init(void) int i; struct proc_dir_entry *entry; + err = bdi_init(&cgroup_backing_dev_info); + if (err) + return err; + for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { struct cgroup_subsys *ss = subsys[i]; if (!ss->early_init) @@ -1585,6 +1590,9 @@ int __init cgroup_init(void) entry->proc_fops = &proc_cgroupstats_operations; out: + if (err) + bdi_destroy(&cgroup_backing_dev_info); + return err; } _