Re: [RFC][PATCH 4/5] memcg: per-cpu charge stock

From: KAMEZAWA Hiroyuki
Date: Mon Aug 31 2009 - 08:07:22 EST

Balbir Singh wrote:
> * KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> [2009-08-28
> 13:27:06]:
>> For avoiding frequent access to res_counter at charge, add per-cpu
>> local charge. Comparing with modifing res_coutner (with percpu_counter),
>> this approach
>> Pros.
>> - we don't have to touch res_counter's cache line
>> - we don't have to chase res_counter's hierarchy
>> - we don't have to call res_counter function.
>> Cons.
>> - we need our own code.
>> Considering trade-off, I think this is worth to do.
> I prefer the other part due to
> 1. Code reuse (any enhancements made will benefit us)
> 2. Custom batching that can be done easily
> 3. Remember hierarchy is explicitly enabled and we've documented that
> it is expensive

Hmm. the important point is we don't touch res_counter's cacheline in
fast path. And if we don't use memcg's percpu counter, more cacheline/TLB
will be necesary. (I think percpu counter is slow.)
plz rewrite memcg's percpu counter by youself if you want something generic.

I can't understand what you mention by (3).


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at