mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 22:12:16 +00:00
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: rcu: create rcu_my_thread_group_empty() wrapper memcg: css_id() must be called under rcu_read_lock() cgroup: Check task_lock in task_subsys_state() sched: Fix an RCU warning in print_task() cgroup: Fix an RCU warning in alloc_css_id() cgroup: Fix an RCU warning in cgroup_path() KEYS: Fix an RCU warning in the reading of user keys KEYS: Fix an RCU warning
This commit is contained in:
commit
91bc482ec5
6 changed files with 43 additions and 10 deletions
|
@ -530,6 +530,7 @@ static inline struct cgroup_subsys_state *task_subsys_state(
|
||||||
{
|
{
|
||||||
return rcu_dereference_check(task->cgroups->subsys[subsys_id],
|
return rcu_dereference_check(task->cgroups->subsys[subsys_id],
|
||||||
rcu_read_lock_held() ||
|
rcu_read_lock_held() ||
|
||||||
|
lockdep_is_held(&task->alloc_lock) ||
|
||||||
cgroup_lock_is_held());
|
cgroup_lock_is_held());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -190,6 +190,8 @@ static inline int rcu_read_lock_sched_held(void)
|
||||||
|
|
||||||
#ifdef CONFIG_PROVE_RCU
|
#ifdef CONFIG_PROVE_RCU
|
||||||
|
|
||||||
|
extern int rcu_my_thread_group_empty(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rcu_dereference_check - rcu_dereference with debug checking
|
* rcu_dereference_check - rcu_dereference with debug checking
|
||||||
* @p: The pointer to read, prior to dereferencing
|
* @p: The pointer to read, prior to dereferencing
|
||||||
|
|
|
@ -1646,7 +1646,9 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
|
||||||
int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
|
int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
|
||||||
{
|
{
|
||||||
char *start;
|
char *start;
|
||||||
struct dentry *dentry = rcu_dereference(cgrp->dentry);
|
struct dentry *dentry = rcu_dereference_check(cgrp->dentry,
|
||||||
|
rcu_read_lock_held() ||
|
||||||
|
cgroup_lock_is_held());
|
||||||
|
|
||||||
if (!dentry || cgrp == dummytop) {
|
if (!dentry || cgrp == dummytop) {
|
||||||
/*
|
/*
|
||||||
|
@ -1662,13 +1664,17 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
|
||||||
*--start = '\0';
|
*--start = '\0';
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int len = dentry->d_name.len;
|
int len = dentry->d_name.len;
|
||||||
|
|
||||||
if ((start -= len) < buf)
|
if ((start -= len) < buf)
|
||||||
return -ENAMETOOLONG;
|
return -ENAMETOOLONG;
|
||||||
memcpy(start, cgrp->dentry->d_name.name, len);
|
memcpy(start, dentry->d_name.name, len);
|
||||||
cgrp = cgrp->parent;
|
cgrp = cgrp->parent;
|
||||||
if (!cgrp)
|
if (!cgrp)
|
||||||
break;
|
break;
|
||||||
dentry = rcu_dereference(cgrp->dentry);
|
|
||||||
|
dentry = rcu_dereference_check(cgrp->dentry,
|
||||||
|
rcu_read_lock_held() ||
|
||||||
|
cgroup_lock_is_held());
|
||||||
if (!cgrp->parent)
|
if (!cgrp->parent)
|
||||||
continue;
|
continue;
|
||||||
if (--start < buf)
|
if (--start < buf)
|
||||||
|
@ -4555,13 +4561,13 @@ static int alloc_css_id(struct cgroup_subsys *ss, struct cgroup *parent,
|
||||||
{
|
{
|
||||||
int subsys_id, i, depth = 0;
|
int subsys_id, i, depth = 0;
|
||||||
struct cgroup_subsys_state *parent_css, *child_css;
|
struct cgroup_subsys_state *parent_css, *child_css;
|
||||||
struct css_id *child_id, *parent_id = NULL;
|
struct css_id *child_id, *parent_id;
|
||||||
|
|
||||||
subsys_id = ss->subsys_id;
|
subsys_id = ss->subsys_id;
|
||||||
parent_css = parent->subsys[subsys_id];
|
parent_css = parent->subsys[subsys_id];
|
||||||
child_css = child->subsys[subsys_id];
|
child_css = child->subsys[subsys_id];
|
||||||
depth = css_depth(parent_css) + 1;
|
|
||||||
parent_id = parent_css->id;
|
parent_id = parent_css->id;
|
||||||
|
depth = parent_id->depth;
|
||||||
|
|
||||||
child_id = get_new_cssid(ss, depth);
|
child_id = get_new_cssid(ss, depth);
|
||||||
if (IS_ERR(child_id))
|
if (IS_ERR(child_id))
|
||||||
|
|
|
@ -122,3 +122,14 @@ void wakeme_after_rcu(struct rcu_head *head)
|
||||||
rcu = container_of(head, struct rcu_synchronize, head);
|
rcu = container_of(head, struct rcu_synchronize, head);
|
||||||
complete(&rcu->completion);
|
complete(&rcu->completion);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_PROVE_RCU
|
||||||
|
/*
|
||||||
|
* wrapper function to avoid #include problems.
|
||||||
|
*/
|
||||||
|
int rcu_my_thread_group_empty(void)
|
||||||
|
{
|
||||||
|
return thread_group_empty(current);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(rcu_my_thread_group_empty);
|
||||||
|
#endif /* #ifdef CONFIG_PROVE_RCU */
|
||||||
|
|
|
@ -114,7 +114,9 @@ print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
|
||||||
{
|
{
|
||||||
char path[64];
|
char path[64];
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
cgroup_path(task_group(p)->css.cgroup, path, sizeof(path));
|
cgroup_path(task_group(p)->css.cgroup, path, sizeof(path));
|
||||||
|
rcu_read_unlock();
|
||||||
SEQ_printf(m, " %s", path);
|
SEQ_printf(m, " %s", path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -811,10 +811,12 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
|
||||||
* enabled in "curr" and "curr" is a child of "mem" in *cgroup*
|
* enabled in "curr" and "curr" is a child of "mem" in *cgroup*
|
||||||
* hierarchy(even if use_hierarchy is disabled in "mem").
|
* hierarchy(even if use_hierarchy is disabled in "mem").
|
||||||
*/
|
*/
|
||||||
|
rcu_read_lock();
|
||||||
if (mem->use_hierarchy)
|
if (mem->use_hierarchy)
|
||||||
ret = css_is_ancestor(&curr->css, &mem->css);
|
ret = css_is_ancestor(&curr->css, &mem->css);
|
||||||
else
|
else
|
||||||
ret = (curr == mem);
|
ret = (curr == mem);
|
||||||
|
rcu_read_unlock();
|
||||||
css_put(&curr->css);
|
css_put(&curr->css);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2312,7 +2314,9 @@ mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
|
||||||
|
|
||||||
/* record memcg information */
|
/* record memcg information */
|
||||||
if (do_swap_account && swapout && memcg) {
|
if (do_swap_account && swapout && memcg) {
|
||||||
|
rcu_read_lock();
|
||||||
swap_cgroup_record(ent, css_id(&memcg->css));
|
swap_cgroup_record(ent, css_id(&memcg->css));
|
||||||
|
rcu_read_unlock();
|
||||||
mem_cgroup_get(memcg);
|
mem_cgroup_get(memcg);
|
||||||
}
|
}
|
||||||
if (swapout && memcg)
|
if (swapout && memcg)
|
||||||
|
@ -2369,8 +2373,10 @@ static int mem_cgroup_move_swap_account(swp_entry_t entry,
|
||||||
{
|
{
|
||||||
unsigned short old_id, new_id;
|
unsigned short old_id, new_id;
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
old_id = css_id(&from->css);
|
old_id = css_id(&from->css);
|
||||||
new_id = css_id(&to->css);
|
new_id = css_id(&to->css);
|
||||||
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
|
if (swap_cgroup_cmpxchg(entry, old_id, new_id) == old_id) {
|
||||||
mem_cgroup_swap_statistics(from, false);
|
mem_cgroup_swap_statistics(from, false);
|
||||||
|
@ -4038,11 +4044,16 @@ static int is_target_pte_for_mc(struct vm_area_struct *vma,
|
||||||
put_page(page);
|
put_page(page);
|
||||||
}
|
}
|
||||||
/* throught */
|
/* throught */
|
||||||
if (ent.val && do_swap_account && !ret &&
|
if (ent.val && do_swap_account && !ret) {
|
||||||
css_id(&mc.from->css) == lookup_swap_cgroup(ent)) {
|
unsigned short id;
|
||||||
ret = MC_TARGET_SWAP;
|
rcu_read_lock();
|
||||||
if (target)
|
id = css_id(&mc.from->css);
|
||||||
target->ent = ent;
|
rcu_read_unlock();
|
||||||
|
if (id == lookup_swap_cgroup(ent)) {
|
||||||
|
ret = MC_TARGET_SWAP;
|
||||||
|
if (target)
|
||||||
|
target->ent = ent;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue