Skip to contentSkip to conversation

cgroup: remove redundant check in cgroup_ino()

PATCH Applied Zefan Li 2 participants 2 messages Sep 19, 2014

Subsystems (3)
lore
Share & tools
lore

Zefan Li

author
#0 lore raw

PATCH 1/1 cgroup: remove redundant check in cgroup_ino()

After we implemented default unified hierarchy, cgrp->kn can never be NULL.

---
 include/linux/cgroup.h | 7 ++-----
 mm/memory-failure.c    | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)
include/linux/cgroup.h +2 -5
index 77a1d37..818a81f 100644
@@ -532,13 +532,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp)
 	return !list_empty(&cgrp->cset_links);
 }
 
-/* returns ino associated with a cgroup, 0 indicates unmounted root */
+/* returns ino associated with a cgroup */
 static inline ino_t cgroup_ino(struct cgroup *cgrp)
 {
-	if (cgrp->kn)
-		return cgrp->kn->ino;
-	else
-		return 0;
+	return cgrp->kn->ino;
 }
 
 /* cft/css accessors for cftype->write() operation */
mm/memory-failure.c +1 -1
index 44c6bd2..8639f6b 100644
@@ -148,7 +148,7 @@ static int hwpoison_filter_task(struct page *p)
 	ino = cgroup_ino(css->cgroup);
 	css_put(css);
 
-	if (!ino || ino != hwpoison_filter_memcg)
+	if (ino != hwpoison_filter_memcg)
 		return -EINVAL;
 
 	return 0;
Signature · 1 line
1.8.0.2
maintainer Applied
#1 lore raw
Quoted 4 lines · Zefan Li

After we implemented default unified hierarchy, cgrp->kn can never be NULL.

Applied to cgroup/for-3.18.

Thanks.

Signature · 1 line
tejun