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]
Date:	Thu, 7 Jul 2011 14:29:22 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"bsingharora@...il.com" <bsingharora@...il.com>,
	Michal Hocko <mhocko@...e.cz>, Ying Han <yinghan@...gle.com>
Subject: Re: [PATCH][Cleanup] memcg: consolidates memory cgroup lru stat
 functions

On Thu, 7 Jul 2011 15:52:17 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:

> In mm/memcontrol.c, there are many lru stat functions as..
> 
> mem_cgroup_zone_nr_lru_pages
> mem_cgroup_node_nr_file_lru_pages
> mem_cgroup_nr_file_lru_pages
> mem_cgroup_node_nr_anon_lru_pages
> mem_cgroup_nr_anon_lru_pages
> mem_cgroup_node_nr_unevictable_lru_pages
> mem_cgroup_nr_unevictable_lru_pages
> mem_cgroup_node_nr_lru_pages
> mem_cgroup_nr_lru_pages
> mem_cgroup_get_local_zonestat
> 
> Some of them are under #ifdef MAX_NUMNODES >1 and others are not.
> This seems bad. This patch consolidates all functions into
> 
> mem_cgroup_zone_nr_lru_pages()
> mem_cgroup_node_nr_lru_pages()
> mem_cgroup_nr_lru_pages()
> 
> For these functions, "which LRU?" information is passed by a mask.
> 
> example)
> mem_cgroup_nr_lru_pages(mem, BIT(LRU_ACTIVE_ANON))
> 
> And I added some macro as ALL_LRU, ALL_LRU_FILE, ALL_LRU_ANON.
> example)
> mem_cgroup_nr_lru_pages(mem, ALL_LRU)
> 
> BTW, considering layout of NUMA memory placement of counters, this patch seems
> to be better. 
> 
> Now, when we gather all LRU information, we scan in following orer
>     for_each_lru -> for_each_node -> for_each_zone.
> 
> This means we'll touch cache lines in different node in turn.
> 
> After patch, we'll scan 
>     for_each_node -> for_each_zone -> for_each_lru(mask)
> 
> Then, we'll gather information in the same cacheline at once.

mm/vmscan.c: In function 'zone_nr_lru_pages':
mm/vmscan.c:175: warning: passing argument 2 of 'mem_cgroup_zone_nr_lru_pages' makes pointer from integer without a cast
include/linux/memcontrol.h:307: note: expected 'struct zone *' but argument is of type 'int'
mm/vmscan.c:175: error: too many arguments to function 'mem_cgroup_zone_nr_lru_pages'

--- a/include/linux/memcontrol.h~memcg-consolidates-memory-cgroup-lru-stat-functions-fix
+++ a/include/linux/memcontrol.h
@@ -304,8 +304,8 @@ mem_cgroup_inactive_file_is_low(struct m
 }
 
 static inline unsigned long
-mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, struct zone *zone,
-			     enum lru_list lru)
+mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *memcg, int nid, int zid,
+				unsigned int lru_mask)
 {
 	return 0;
 }

> +unsigned long
> +mem_cgroup_zone_nr_lru_pages(struct mem_cgroup *mem, int nid, int zid,
> +			unsigned int lru_mask)

The memcg code sometimes uses "struct mem_cgroup *mem" and sometimes
uses "struct mem_cgroup *memcg".  That's irritating.  I think "memcg"
is better.

--
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