mm: memcontrol: use per-cpu stocks for socket memory uncharging
[sfrench/cifs-2.6.git] / mm / memcontrol.c
index 126a939b600a12f0b77ab4933896a08b502f01d3..ca83f3854e4fcf2272474d9200cebd30c75eba82 100644 (file)
@@ -1792,6 +1792,9 @@ static void refill_stock(struct mem_cgroup *memcg, unsigned int nr_pages)
        }
        stock->nr_pages += nr_pages;
 
+       if (stock->nr_pages > CHARGE_BATCH)
+               drain_stock(stock);
+
        local_irq_restore(flags);
 }
 
@@ -5886,8 +5889,7 @@ void mem_cgroup_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages)
 
        this_cpu_sub(memcg->stat->count[MEMCG_SOCK], nr_pages);
 
-       page_counter_uncharge(&memcg->memory, nr_pages);
-       css_put_many(&memcg->css, nr_pages);
+       refill_stock(memcg, nr_pages);
 }
 
 static int __init cgroup_memory(char *s)