[lkml]   [2012]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 16/23] slab: provide kmalloc_no_account
On 04/24/2012 10:44 PM, KAMEZAWA Hiroyuki wrote:
> (2012/04/23 8:53), Glauber Costa wrote:
>> Some allocations need to be accounted to the root memcg regardless
>> of their context. One trivial example, is the allocations we do
>> during the memcg slab cache creation themselves. Strictly speaking,
>> they could go to the parent, but it is way easier to bill them to
>> the root cgroup.
>> Only generic kmalloc allocations are allowed to be bypassed.
>> The function is not exported, because drivers code should always
>> be accounted.
>> This code is mosly written by Suleiman Souhlal.
>> Signed-off-by: Glauber Costa<>
>> CC: Christoph Lameter<>
>> CC: Pekka Enberg<>
>> CC: Michal Hocko<>
>> CC: Kamezawa Hiroyuki<>
>> CC: Johannes Weiner<>
>> CC: Suleiman Souhlal<>
> Seems reasonable.
> Reviewed-by: KAMEZAWA Hiroyuki<>
> Hmm...but can't we find the 'context' in automatic way ?

Not that I can think of. Well, actually, not without adding some tests
to the allocation path I'd rather not (like testing for the return
address and then doing a table lookup, etc)

An option would be to store it in the task_struct. So we would allocate
as following:


The problem with that, is that it is quite easy to abuse.
but if we don't export that to modules, it would be acceptable.

Question is, given the fact that the number of kmalloc_no_account() is
expected to be really small, is it worth it?

 \ /
  Last update: 2012-04-25 16:33    [W:0.086 / U:3.592 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site