|
@@ -66,11 +66,10 @@ struct mem_cgroup_stat {
|
|
/*
|
|
/*
|
|
* For accounting under irq disable, no need for increment preempt count.
|
|
* For accounting under irq disable, no need for increment preempt count.
|
|
*/
|
|
*/
|
|
-static void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat *stat,
|
|
|
|
|
|
+static inline void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat_cpu *stat,
|
|
enum mem_cgroup_stat_index idx, int val)
|
|
enum mem_cgroup_stat_index idx, int val)
|
|
{
|
|
{
|
|
- int cpu = smp_processor_id();
|
|
|
|
- stat->cpustat[cpu].count[idx] += val;
|
|
|
|
|
|
+ stat->count[idx] += val;
|
|
}
|
|
}
|
|
|
|
|
|
static s64 mem_cgroup_read_stat(struct mem_cgroup_stat *stat,
|
|
static s64 mem_cgroup_read_stat(struct mem_cgroup_stat *stat,
|
|
@@ -190,18 +189,21 @@ static void mem_cgroup_charge_statistics(struct mem_cgroup *mem, int flags,
|
|
{
|
|
{
|
|
int val = (charge)? 1 : -1;
|
|
int val = (charge)? 1 : -1;
|
|
struct mem_cgroup_stat *stat = &mem->stat;
|
|
struct mem_cgroup_stat *stat = &mem->stat;
|
|
|
|
+ struct mem_cgroup_stat_cpu *cpustat;
|
|
|
|
|
|
VM_BUG_ON(!irqs_disabled());
|
|
VM_BUG_ON(!irqs_disabled());
|
|
|
|
+
|
|
|
|
+ cpustat = &stat->cpustat[smp_processor_id()];
|
|
if (flags & PAGE_CGROUP_FLAG_CACHE)
|
|
if (flags & PAGE_CGROUP_FLAG_CACHE)
|
|
- __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val);
|
|
|
|
|
|
+ __mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_CACHE, val);
|
|
else
|
|
else
|
|
- __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val);
|
|
|
|
|
|
+ __mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_RSS, val);
|
|
|
|
|
|
if (charge)
|
|
if (charge)
|
|
- __mem_cgroup_stat_add_safe(stat,
|
|
|
|
|
|
+ __mem_cgroup_stat_add_safe(cpustat,
|
|
MEM_CGROUP_STAT_PGPGIN_COUNT, 1);
|
|
MEM_CGROUP_STAT_PGPGIN_COUNT, 1);
|
|
else
|
|
else
|
|
- __mem_cgroup_stat_add_safe(stat,
|
|
|
|
|
|
+ __mem_cgroup_stat_add_safe(cpustat,
|
|
MEM_CGROUP_STAT_PGPGOUT_COUNT, 1);
|
|
MEM_CGROUP_STAT_PGPGOUT_COUNT, 1);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -558,7 +560,7 @@ static int mem_cgroup_charge_common(struct page *page, struct mm_struct *mm,
|
|
css_get(&memcg->css);
|
|
css_get(&memcg->css);
|
|
}
|
|
}
|
|
|
|
|
|
- while (res_counter_charge(&mem->res, PAGE_SIZE)) {
|
|
|
|
|
|
+ while (unlikely(res_counter_charge(&mem->res, PAGE_SIZE))) {
|
|
if (!(gfp_mask & __GFP_WAIT))
|
|
if (!(gfp_mask & __GFP_WAIT))
|
|
goto out;
|
|
goto out;
|
|
|
|
|