Commit b211e9d7 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup

Pull cgroup updates from Tejun Heo:
 "Nothing too interesting.  Just a handful of cleanup patches"

* 'for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/cgroup:
  Revert "cgroup: remove redundant variable in cgroup_mount()"
  cgroup: remove redundant variable in cgroup_mount()
  cgroup: fix missing unlock in cgroup_release_agent()
  cgroup: remove CGRP_RELEASABLE flag
  perf/cgroup: Remove perf_put_cgroup()
  cgroup: remove redundant check in cgroup_ino()
  cpuset: simplify proc_cpuset_show()
  cgroup: simplify proc_cgroup_show()
  cgroup: use a per-cgroup work for release agent
  cgroup: remove bogus comments
  cgroup: remove redundant code in cgroup_rmdir()
  cgroup: remove some useless forward declarations
  cgroup: fix a typo in comment.
parents d9428f09 e756c7b6
...@@ -376,37 +376,6 @@ static const struct file_operations proc_lstats_operations = { ...@@ -376,37 +376,6 @@ static const struct file_operations proc_lstats_operations = {
#endif #endif
#ifdef CONFIG_CGROUPS
static int cgroup_open(struct inode *inode, struct file *file)
{
struct pid *pid = PROC_I(inode)->pid;
return single_open(file, proc_cgroup_show, pid);
}
static const struct file_operations proc_cgroup_operations = {
.open = cgroup_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
#ifdef CONFIG_PROC_PID_CPUSET
static int cpuset_open(struct inode *inode, struct file *file)
{
struct pid *pid = PROC_I(inode)->pid;
return single_open(file, proc_cpuset_show, pid);
}
static const struct file_operations proc_cpuset_operations = {
.open = cpuset_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
#endif
static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns, static int proc_oom_score(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *task) struct pid *pid, struct task_struct *task)
{ {
...@@ -2579,10 +2548,10 @@ static const struct pid_entry tgid_base_stuff[] = { ...@@ -2579,10 +2548,10 @@ static const struct pid_entry tgid_base_stuff[] = {
REG("latency", S_IRUGO, proc_lstats_operations), REG("latency", S_IRUGO, proc_lstats_operations),
#endif #endif
#ifdef CONFIG_PROC_PID_CPUSET #ifdef CONFIG_PROC_PID_CPUSET
REG("cpuset", S_IRUGO, proc_cpuset_operations), ONE("cpuset", S_IRUGO, proc_cpuset_show),
#endif #endif
#ifdef CONFIG_CGROUPS #ifdef CONFIG_CGROUPS
REG("cgroup", S_IRUGO, proc_cgroup_operations), ONE("cgroup", S_IRUGO, proc_cgroup_show),
#endif #endif
ONE("oom_score", S_IRUGO, proc_oom_score), ONE("oom_score", S_IRUGO, proc_oom_score),
REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
...@@ -2925,10 +2894,10 @@ static const struct pid_entry tid_base_stuff[] = { ...@@ -2925,10 +2894,10 @@ static const struct pid_entry tid_base_stuff[] = {
REG("latency", S_IRUGO, proc_lstats_operations), REG("latency", S_IRUGO, proc_lstats_operations),
#endif #endif
#ifdef CONFIG_PROC_PID_CPUSET #ifdef CONFIG_PROC_PID_CPUSET
REG("cpuset", S_IRUGO, proc_cpuset_operations), ONE("cpuset", S_IRUGO, proc_cpuset_show),
#endif #endif
#ifdef CONFIG_CGROUPS #ifdef CONFIG_CGROUPS
REG("cgroup", S_IRUGO, proc_cgroup_operations), ONE("cgroup", S_IRUGO, proc_cgroup_show),
#endif #endif
ONE("oom_score", S_IRUGO, proc_oom_score), ONE("oom_score", S_IRUGO, proc_oom_score),
REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations), REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
struct cgroup_root; struct cgroup_root;
struct cgroup_subsys; struct cgroup_subsys;
struct inode;
struct cgroup; struct cgroup;
extern int cgroup_init_early(void); extern int cgroup_init_early(void);
...@@ -38,7 +37,8 @@ extern void cgroup_exit(struct task_struct *p); ...@@ -38,7 +37,8 @@ extern void cgroup_exit(struct task_struct *p);
extern int cgroupstats_build(struct cgroupstats *stats, extern int cgroupstats_build(struct cgroupstats *stats,
struct dentry *dentry); struct dentry *dentry);
extern int proc_cgroup_show(struct seq_file *, void *); extern int proc_cgroup_show(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *tsk);
/* define the enumeration of all cgroup subsystems */ /* define the enumeration of all cgroup subsystems */
#define SUBSYS(_x) _x ## _cgrp_id, #define SUBSYS(_x) _x ## _cgrp_id,
...@@ -161,11 +161,6 @@ static inline void css_put(struct cgroup_subsys_state *css) ...@@ -161,11 +161,6 @@ static inline void css_put(struct cgroup_subsys_state *css)
/* bits in struct cgroup flags field */ /* bits in struct cgroup flags field */
enum { enum {
/*
* Control Group has previously had a child cgroup or a task,
* but no longer (only if CGRP_NOTIFY_ON_RELEASE is set)
*/
CGRP_RELEASABLE,
/* Control Group requires release notifications to userspace */ /* Control Group requires release notifications to userspace */
CGRP_NOTIFY_ON_RELEASE, CGRP_NOTIFY_ON_RELEASE,
/* /*
...@@ -234,13 +229,6 @@ struct cgroup { ...@@ -234,13 +229,6 @@ struct cgroup {
*/ */
struct list_head e_csets[CGROUP_SUBSYS_COUNT]; struct list_head e_csets[CGROUP_SUBSYS_COUNT];
/*
* Linked list running through all cgroups that can
* potentially be reaped by the release agent. Protected by
* release_list_lock
*/
struct list_head release_list;
/* /*
* list of pidlists, up to two for each namespace (one for procs, one * list of pidlists, up to two for each namespace (one for procs, one
* for tasks); created on demand. * for tasks); created on demand.
...@@ -250,6 +238,9 @@ struct cgroup { ...@@ -250,6 +238,9 @@ struct cgroup {
/* used to wait for offlining of csses */ /* used to wait for offlining of csses */
wait_queue_head_t offline_waitq; wait_queue_head_t offline_waitq;
/* used to schedule release agent */
struct work_struct release_agent_work;
}; };
#define MAX_CGROUP_ROOT_NAMELEN 64 #define MAX_CGROUP_ROOT_NAMELEN 64
...@@ -536,13 +527,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp) ...@@ -536,13 +527,10 @@ static inline bool cgroup_has_tasks(struct cgroup *cgrp)
return !list_empty(&cgrp->cset_links); 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) static inline ino_t cgroup_ino(struct cgroup *cgrp)
{ {
if (cgrp->kn) return cgrp->kn->ino;
return cgrp->kn->ino;
else
return 0;
} }
/* cft/css accessors for cftype->write() operation */ /* cft/css accessors for cftype->write() operation */
......
...@@ -86,7 +86,8 @@ extern void __cpuset_memory_pressure_bump(void); ...@@ -86,7 +86,8 @@ extern void __cpuset_memory_pressure_bump(void);
extern void cpuset_task_status_allowed(struct seq_file *m, extern void cpuset_task_status_allowed(struct seq_file *m,
struct task_struct *task); struct task_struct *task);
extern int proc_cpuset_show(struct seq_file *, void *); extern int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *tsk);
extern int cpuset_mem_spread_node(void); extern int cpuset_mem_spread_node(void);
extern int cpuset_slab_spread_node(void); extern int cpuset_slab_spread_node(void);
......
This diff is collapsed.
...@@ -2730,10 +2730,9 @@ void __cpuset_memory_pressure_bump(void) ...@@ -2730,10 +2730,9 @@ void __cpuset_memory_pressure_bump(void)
* and we take cpuset_mutex, keeping cpuset_attach() from changing it * and we take cpuset_mutex, keeping cpuset_attach() from changing it
* anyway. * anyway.
*/ */
int proc_cpuset_show(struct seq_file *m, void *unused_v) int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,
struct pid *pid, struct task_struct *tsk)
{ {
struct pid *pid;
struct task_struct *tsk;
char *buf, *p; char *buf, *p;
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
int retval; int retval;
...@@ -2743,24 +2742,16 @@ int proc_cpuset_show(struct seq_file *m, void *unused_v) ...@@ -2743,24 +2742,16 @@ int proc_cpuset_show(struct seq_file *m, void *unused_v)
if (!buf) if (!buf)
goto out; goto out;
retval = -ESRCH;
pid = m->private;
tsk = get_pid_task(pid, PIDTYPE_PID);
if (!tsk)
goto out_free;
retval = -ENAMETOOLONG; retval = -ENAMETOOLONG;
rcu_read_lock(); rcu_read_lock();
css = task_css(tsk, cpuset_cgrp_id); css = task_css(tsk, cpuset_cgrp_id);
p = cgroup_path(css->cgroup, buf, PATH_MAX); p = cgroup_path(css->cgroup, buf, PATH_MAX);
rcu_read_unlock(); rcu_read_unlock();
if (!p) if (!p)
goto out_put_task; goto out_free;
seq_puts(m, p); seq_puts(m, p);
seq_putc(m, '\n'); seq_putc(m, '\n');
retval = 0; retval = 0;
out_put_task:
put_task_struct(tsk);
out_free: out_free:
kfree(buf); kfree(buf);
out: out:
......
...@@ -392,14 +392,9 @@ perf_cgroup_match(struct perf_event *event) ...@@ -392,14 +392,9 @@ perf_cgroup_match(struct perf_event *event)
event->cgrp->css.cgroup); event->cgrp->css.cgroup);
} }
static inline void perf_put_cgroup(struct perf_event *event)
{
css_put(&event->cgrp->css);
}
static inline void perf_detach_cgroup(struct perf_event *event) static inline void perf_detach_cgroup(struct perf_event *event)
{ {
perf_put_cgroup(event); css_put(&event->cgrp->css);
event->cgrp = NULL; event->cgrp = NULL;
} }
......
...@@ -148,7 +148,7 @@ static int hwpoison_filter_task(struct page *p) ...@@ -148,7 +148,7 @@ static int hwpoison_filter_task(struct page *p)
ino = cgroup_ino(css->cgroup); ino = cgroup_ino(css->cgroup);
css_put(css); css_put(css);
if (!ino || ino != hwpoison_filter_memcg) if (ino != hwpoison_filter_memcg)
return -EINVAL; return -EINVAL;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment