[Devel] Re: [PATCH RFC v2 4/4] memcg: implement memory thresholds

Kirill A. Shutemov kirill at shutemov.name
Sat Dec 12 05:11:33 PST 2009


On Sat, Dec 12, 2009 at 5:19 AM, Daisuke Nishimura
<d-nishimura at mtf.biglobe.ne.jp> wrote:
>> @@ -56,6 +61,7 @@ static int really_do_swap_account __initdata = 1; /* for remember boot option*/
>>
>>  static DEFINE_MUTEX(memcg_tasklist); /* can be hold under cgroup_mutex */
> This mutex has already removed in current mmotm.
> Please write a patch for memcg based on mmot.

Ok.

>
>>  #define SOFTLIMIT_EVENTS_THRESH (1000)
>> +#define THRESHOLDS_EVENTS_THRESH (100)
>>
>>  /*
>>   * Statistics for memory cgroup.
>
> (snip)
>
>> @@ -1363,6 +1395,11 @@ static int __mem_cgroup_try_charge(struct mm_struct *mm,
>>       if (mem_cgroup_soft_limit_check(mem))
>>               mem_cgroup_update_tree(mem, page);
>>  done:
>> +     if (mem_cgroup_threshold_check(mem)) {
>> +             mem_cgroup_threshold(mem, false);
>> +             if (do_swap_account)
>> +                     mem_cgroup_threshold(mem, true);
>> +     }
>>       return 0;
>>  nomem:
>>       css_put(&mem->css);
>> @@ -1906,6 +1943,11 @@ __mem_cgroup_uncharge_common(struct page *page, enum charge_type ctype)
>>
>>       if (mem_cgroup_soft_limit_check(mem))
>>               mem_cgroup_update_tree(mem, page);
>> +     if (mem_cgroup_threshold_check(mem)) {
>> +             mem_cgroup_threshold(mem, false);
>> +             if (do_swap_account)
>> +                     mem_cgroup_threshold(mem, true);
>> +     }
>>       /* at swapout, this memcg will be accessed to record to swap */
>>       if (ctype != MEM_CGROUP_CHARGE_TYPE_SWAPOUT)
>>               css_put(&mem->css);
> Can "if (do_swap_account)" check be moved into mem_cgroup_threshold ?

Ok, I'll move it. It will affect performance of
mem_cgroup_invalidate_thresholds(),
but I don't think that it's important.
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list