Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 308932
b: refs/heads/master
c: 3afe36b
h: refs/heads/master
v: v3
  • Loading branch information
Glauber Costa authored and Linus Torvalds committed May 29, 2012
1 parent f119bc0 commit 547f19e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fa9add641b1b1c564db916accac1db346e7a2759
refs/heads/master: 3afe36b1fe7d1e3f66752bb9548a763942f3a104
24 changes: 13 additions & 11 deletions trunk/mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ struct mem_cgroup {
*/
struct rcu_head rcu_freeing;
/*
* But when using vfree(), that cannot be done at
* interrupt time, so we must then queue the work.
* We also need some space for a worker in deferred freeing.
* By the time we call it, rcu_freeing is no longer in use.
*/
struct work_struct work_freeing;
};
Expand Down Expand Up @@ -4702,23 +4702,28 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
}

/*
* Helpers for freeing a vzalloc()ed mem_cgroup by RCU,
* Helpers for freeing a kmalloc()ed/vzalloc()ed mem_cgroup by RCU,
* but in process context. The work_freeing structure is overlaid
* on the rcu_freeing structure, which itself is overlaid on memsw.
*/
static void vfree_work(struct work_struct *work)
static void free_work(struct work_struct *work)
{
struct mem_cgroup *memcg;
int size = sizeof(struct mem_cgroup);

memcg = container_of(work, struct mem_cgroup, work_freeing);
vfree(memcg);
if (size < PAGE_SIZE)
kfree(memcg);
else
vfree(memcg);
}
static void vfree_rcu(struct rcu_head *rcu_head)

static void free_rcu(struct rcu_head *rcu_head)
{
struct mem_cgroup *memcg;

memcg = container_of(rcu_head, struct mem_cgroup, rcu_freeing);
INIT_WORK(&memcg->work_freeing, vfree_work);
INIT_WORK(&memcg->work_freeing, free_work);
schedule_work(&memcg->work_freeing);
}

Expand All @@ -4744,10 +4749,7 @@ static void __mem_cgroup_free(struct mem_cgroup *memcg)
free_mem_cgroup_per_zone_info(memcg, node);

free_percpu(memcg->stat);
if (sizeof(struct mem_cgroup) < PAGE_SIZE)
kfree_rcu(memcg, rcu_freeing);
else
call_rcu(&memcg->rcu_freeing, vfree_rcu);
call_rcu(&memcg->rcu_freeing, free_rcu);
}

static void mem_cgroup_get(struct mem_cgroup *memcg)
Expand Down

0 comments on commit 547f19e

Please sign in to comment.