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

From: Kirill A. Shutemov
Date: Sat Dec 12 2009 - 08:11:46 EST


On Sat, Dec 12, 2009 at 5:19 AM, Daisuke Nishimura
<d-nishimura@xxxxxxxxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/