|
@@ -144,6 +144,11 @@ struct mem_cgroup {
|
|
*/
|
|
*/
|
|
struct mem_cgroup_lru_info info;
|
|
struct mem_cgroup_lru_info info;
|
|
|
|
|
|
|
|
+ /*
|
|
|
|
+ protect against reclaim related member.
|
|
|
|
+ */
|
|
|
|
+ spinlock_t reclaim_param_lock;
|
|
|
|
+
|
|
int prev_priority; /* for recording reclaim priority */
|
|
int prev_priority; /* for recording reclaim priority */
|
|
|
|
|
|
/*
|
|
/*
|
|
@@ -400,18 +405,28 @@ int mem_cgroup_calc_mapped_ratio(struct mem_cgroup *mem)
|
|
*/
|
|
*/
|
|
int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
|
|
int mem_cgroup_get_reclaim_priority(struct mem_cgroup *mem)
|
|
{
|
|
{
|
|
- return mem->prev_priority;
|
|
|
|
|
|
+ int prev_priority;
|
|
|
|
+
|
|
|
|
+ spin_lock(&mem->reclaim_param_lock);
|
|
|
|
+ prev_priority = mem->prev_priority;
|
|
|
|
+ spin_unlock(&mem->reclaim_param_lock);
|
|
|
|
+
|
|
|
|
+ return prev_priority;
|
|
}
|
|
}
|
|
|
|
|
|
void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, int priority)
|
|
void mem_cgroup_note_reclaim_priority(struct mem_cgroup *mem, int priority)
|
|
{
|
|
{
|
|
|
|
+ spin_lock(&mem->reclaim_param_lock);
|
|
if (priority < mem->prev_priority)
|
|
if (priority < mem->prev_priority)
|
|
mem->prev_priority = priority;
|
|
mem->prev_priority = priority;
|
|
|
|
+ spin_unlock(&mem->reclaim_param_lock);
|
|
}
|
|
}
|
|
|
|
|
|
void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, int priority)
|
|
void mem_cgroup_record_reclaim_priority(struct mem_cgroup *mem, int priority)
|
|
{
|
|
{
|
|
|
|
+ spin_lock(&mem->reclaim_param_lock);
|
|
mem->prev_priority = priority;
|
|
mem->prev_priority = priority;
|
|
|
|
+ spin_unlock(&mem->reclaim_param_lock);
|
|
}
|
|
}
|
|
|
|
|
|
int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
|
|
int mem_cgroup_inactive_anon_is_low(struct mem_cgroup *memcg, struct zone *zone)
|
|
@@ -2076,6 +2091,7 @@ mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont)
|
|
}
|
|
}
|
|
mem_cgroup_set_inactive_ratio(mem);
|
|
mem_cgroup_set_inactive_ratio(mem);
|
|
mem->last_scanned_child = NULL;
|
|
mem->last_scanned_child = NULL;
|
|
|
|
+ spin_lock_init(&mem->reclaim_param_lock);
|
|
|
|
|
|
return &mem->css;
|
|
return &mem->css;
|
|
free_out:
|
|
free_out:
|