lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4F951440.7040704@jp.fujitsu.com>
Date:	Mon, 23 Apr 2012 17:35:12 +0900
From:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To:	Anton Vorontsov <anton.vorontsov@...aro.org>
CC:	cgroups@...r.kernel.org, Johannes Weiner <hannes@...xchg.org>,
	Michal Hocko <mhocko@...e.cz>,
	Balbir Singh <bsingharora@...il.com>, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>,
	KOSAKI Motohiro <kosaki.motohiro@...il.com>,
	John Stultz <john.stultz@...aro.org>,
	linaro-kernel@...ts.linaro.org, patches@...aro.org
Subject: Re: [PATCH RFC] memcg: MEMCG_NR_FILE_MAPPED should update _STAT_CACHE
 as well

(2012/04/23 17:28), Anton Vorontsov wrote:

> ...otherwise the we're getting the wrong numbers in usage_in_bytes.
> 
> On Mon, Mar 05, 2012 at 09:19:34AM +0900, KAMEZAWA Hiroyuki wrote:
> [...]
>>> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
>>> index 228d646..c8abdc5 100644
>>> --- a/mm/memcontrol.c
>>> +++ b/mm/memcontrol.c
>>> @@ -3812,6 +3812,9 @@ static inline u64 mem_cgroup_usage(struct mem_cgroup *memcg, bool swap)
>>>  
>>>         val = mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_CACHE);
>>>         val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_RSS);
>>> +       val += mem_cgroup_recursive_stat(memcg, MEM_CGROUP_STAT_FILE_MAPPED);
>>>
>>> 1. Is there any particular reason we don't currently account file mapped
>>>    memory in usage_in_bytes?
>>>
>>>    To me, MEM_CGROUP_STAT_FILE_MAPPED hunk seems logical even if we
>>>    don't use it for lowmemory notifications.
>>>
>>>    Plus, it seems that FILE_MAPPED _is_ accounted for the non-root
>>>    cgroups, so I guess it's clearly a bug for the root memcg?
>>
>> CACHE includes all file caches. Why do you think FILE_MAPPED is not included in CACHE ?
> 
> There were tons of changes in the memcg lately, but I believe the issue
> is still there.
> 
> For example, looking into this code flow:
> 
> -> page_add_file_rmap() (mm/rmap.c)
>  -> mem_cgroup_inc_page_stat(page, MEMCG_NR_FILE_MAPPED) (include/linux/memcontrol.h)
>   -> void mem_cgroup_update_page_stat(page, MEMCG_NR_FILE_MAPPED, 1) (mm/memcontrol.c)
> 
> And then:
> 
> void mem_cgroup_update_page_stat(struct page *page,
>                                  enum mem_cgroup_page_stat_item idx, int val)
> {
>         ...
>         switch (idx) {
>         case MEMCG_NR_FILE_MAPPED:
>                 idx = MEM_CGROUP_STAT_FILE_MAPPED;
>                 break;
>         default:
>                 BUG();
>         }
> 
>         this_cpu_add(memcg->stat->count[idx], val);
>         ...
> }
> 
> So, clearly, this function only bothers updating _FILE_MAPPED only,
> leaving _CACHE alone.
> 
> If you're saying that _CACHE meant to include _FILE_MAPPED, then
> I guess the patch down below would be a proper fix then... Otherwise
> we need to be consistent on stats reporting, and either fall-back
> to my original fix (in mem_cgroup_usage()), or think about doing it
> some other way...
> 


NACK.
CACHE is updated at charge()/uncharge()...inserting/removing page cache to radix-tree.

Thanks,
-Kame


> Signed-off-by: Anton Vorontsov <anton.vorontsov@...aro.org>
> ---
> 
> The patch is against current -next.
> 
> Thanks,
> 
>  mm/memcontrol.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 884e936..760ecf5 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -1958,6 +1958,8 @@ void mem_cgroup_update_page_stat(struct page *page,
>  
>  	switch (idx) {
>  	case MEMCG_NR_FILE_MAPPED:
> +		idx = MEM_CGROUP_STAT_CACHE;
> +		this_cpu_add(memcg->stat->count[idx], val);
>  		idx = MEM_CGROUP_STAT_FILE_MAPPED;
>  		break;
>  	default:



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ