aboutsummaryrefslogtreecommitdiffstats
path: root/debian/patches/features/all/openvz/revert-cgroup-lite-add-cgroup-id-for-blk-cgroups.patch
blob: 3555fdb10bf27babaad3eef8a7e8b8e0f815522e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From 5b9779dd276987a84110cf3ea1ca6b3b3d81adaf Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Sat, 29 May 2010 04:18:54 +0100
Subject: [PATCH 2/2] Revert "cgroup-lite: add cgroup-id for blk-cgroups"

This reverts commit 983bb0952f838b55130f20a9486a04c92ae5826b.
---
 include/linux/cgroup.h |    2 -
 kernel/cgroup_lite.c   |   77 ------------------------------------------------
 2 files changed, 0 insertions(+), 79 deletions(-)

diff --git a/include/linux/cgroup.h b/include/linux/cgroup.h
index fb7d985..0008dee 100644
--- a/include/linux/cgroup.h
+++ b/include/linux/cgroup.h
@@ -220,8 +220,6 @@ struct cgroup {
 
 	/* For RCU-protected deletion */
 	struct rcu_head rcu_head;
-
-	int cgroup_lite_id;
 };
 
 /*
diff --git a/kernel/cgroup_lite.c b/kernel/cgroup_lite.c
index 65575cc..629987f 100644
--- a/kernel/cgroup_lite.c
+++ b/kernel/cgroup_lite.c
@@ -19,73 +19,6 @@ static struct css_set init_css_set;
 static struct cgroup init_cgroup;
 static struct cftype *subsys_cftypes[CGROUP_SUBSYS_COUNT];
 
-static struct idr cgroup_idr;
-static DEFINE_SPINLOCK(cgroup_idr_lock);
-
-unsigned short css_id(struct cgroup_subsys_state *css)
-{
-	return css->cgroup->cgroup_lite_id;
-}
-
-unsigned short css_depth(struct cgroup_subsys_state *css)
-{
-	return (css->cgroup == &init_cgroup) ? 0 : 1;
-}
-
-int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
-{
-	snprintf(buf, buflen, "/%d", cgrp->cgroup_lite_id);
-	return 0;
-}
-
-struct cgroup_subsys_state *css_lookup(struct cgroup_subsys *ss, int id)
-{
-	struct cgroup *g;
-
-	BUG_ON(!ss->use_id);
-	g = idr_find(&cgroup_idr, id);
-	if (!g)
-		return NULL;
-	return g->subsys[ss->subsys_id];
-}
-
-void free_css_id(struct cgroup_subsys *ss, struct cgroup_subsys_state *css)
-{
-}
-
-static int init_cgroup_id(struct cgroup *g)
-{
-	int err, id;
-
-	if (unlikely(!idr_pre_get(&cgroup_idr, GFP_KERNEL)))
-		return -ENOMEM;
-
-	spin_lock(&cgroup_idr_lock);
-	err = idr_get_new_above(&cgroup_idr, g, 1, &id);
-	spin_unlock(&cgroup_idr_lock);
-
-	if (err)
-		return err;
-
-	if (id > USHORT_MAX) {
-		spin_lock(&cgroup_idr_lock);
-		idr_remove(&cgroup_idr, id);
-		spin_unlock(&cgroup_idr_lock);
-		return -ENOSPC;
-	}
-
-	g->cgroup_lite_id = id;
-
-	return 0;
-}
-
-static void fini_cgroup_id(struct cgroup *g)
-{
-	spin_lock(&cgroup_idr_lock);
-	idr_remove(&cgroup_idr, g->cgroup_lite_id);
-	spin_unlock(&cgroup_idr_lock);
-}
-
 void __css_put(struct cgroup_subsys_state *css)
 {
 	atomic_dec(&css->refcnt);
@@ -134,10 +67,6 @@ int init_ve_cgroups(struct ve_struct *ve)
 	if (cs == NULL)
 		goto err_calloc;
 
-	err = init_cgroup_id(g);
-	if (err)
-		goto err_id;
-
 	g->parent = &init_cgroup;
 	err = init_css_set_subsystems(g, cs);
 	if (err)
@@ -149,8 +78,6 @@ int init_ve_cgroups(struct ve_struct *ve)
 	return 0;
 
 err_subsys:
-	fini_cgroup_id(g);
-err_id:
 	kfree(cs);
 err_calloc:
 	kfree(g);
@@ -181,7 +108,6 @@ void fini_ve_cgroups(struct ve_struct *ve)
 			cs->destroy(cs, g);
 	}
 
-	fini_cgroup_id(g);
 	kfree(g);
 	kfree(css);
 	ve->ve_cgroup = NULL;
@@ -299,9 +225,6 @@ int __init cgroup_init(void)
 {
 	get_ve0()->ve_cgroup = &init_cgroup;
 	get_ve0()->ve_css_set = &init_css_set;
-	idr_init(&cgroup_idr);
-	if (init_cgroup_id(&init_cgroup))
-		panic("CG: Can't init initial cgroup id\n");
 	if (init_css_set_subsystems(&init_cgroup, &init_css_set) != 0)
 		panic("CG: Can't init initial set\n");
 	return 0;
-- 
1.7.1