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] [day] [month] [year] [list]
Date:	Mon, 23 Apr 2012 02:33:11 -0700
From:	Anton Vorontsov <anton.vorontsov@...aro.org>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
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

On Mon, Apr 23, 2012 at 05:35:12PM +0900, KAMEZAWA Hiroyuki wrote:
[...]
> > 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.
[...]
> 
> NACK.
> CACHE is updated at charge()/uncharge()...inserting/removing page cache to radix-tree.

Interesting; true, we have charge/uncharge in __do_fault()/do_wp_page
and friends. So, we seem to update FILE_MAPPED in the rmap via
cgroup_dec/inc_page_stat, and CACHE is updated via charge/uncharge. Hm.

The code in memory.c is full of if/else ifs, and I wonder if there's 
some discrepancy in there, but briefly looking it looks fine. The
code looks correct indeed, but I'm getting the wrong stats. :-/

Thanks,

-- 
Anton Vorontsov
Email: cbouatmailru@...il.com
--
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