linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: mel@skynet.ie (Mel Gorman)
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>,
	balbir@linux.vnet.ibm.com, Paul Menage <menage@google.com>,
	Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>,
	linux-mm@kvack.org
Subject: Re: [memcg BUG] unable to handle kernel NULL pointer derefence at 00000000
Date: Tue, 21 Oct 2008 09:34:54 +0100	[thread overview]
Message-ID: <20081021083454.GA2427@csn.ul.ie> (raw)
In-Reply-To: <20081021171801.4c16c295.kamezawa.hiroyu@jp.fujitsu.com>

On Tue, Oct 21, 2008 at 05:18:01PM +0900, KAMEZAWA Hiroyuki wrote:
> On Tue, 21 Oct 2008 15:21:07 +0800
> Li Zefan <lizf@cn.fujitsu.com> wrote:
> > dmesg is attached.
> > 
> Thanks....I think I caught some. (added Mel Gorman to CC:)
> 
> NODE_DATA(nid)->spanned_pages just means sum of zone->spanned_pages in node.
> 
> So, If there is a hole between zone, node->spanned_pages doesn't mean
> length of node's memmap....(then, some hole can be skipped.)
> 

This is correct. pgdat->node_spanned_pages is the range of PFNs the node
covers. In some cases, this can even overlap other nodes. There can be
memory holes and there is no guarantee there is memmap present for the holes.
The number of actual pages is pgdat->node_present_pages.

> OMG....Could you try this ? 
> 
> -Kame
> ==
> NODE_DATA(nid)->node_spanned_pages doesn't means width of node's memory
> but means sum of spanned_pages in all zones of node.
> 

Does not necessarily mean that either. Conceivably there could be gaps
between the zones.

> alloc_node_page_cgroup() misunderstand it. This patch tries to use
> the same algorithm as alloc_node_mem_map() for allocating page_cgroup()
> for node.
> 
> Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 
>  mm/page_cgroup.c |   17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6.27/mm/page_cgroup.c
> ===================================================================
> --- linux-2.6.27.orig/mm/page_cgroup.c
> +++ linux-2.6.27/mm/page_cgroup.c
> @@ -41,10 +41,18 @@ static int __init alloc_node_page_cgroup
>  {
>  	struct page_cgroup *base, *pc;
>  	unsigned long table_size;
> -	unsigned long start_pfn, nr_pages, index;
> +	unsigned long start, end, start_pfn, nr_pages, index;
>  
> -	start_pfn = NODE_DATA(nid)->node_start_pfn;
> -	nr_pages = NODE_DATA(nid)->node_spanned_pages;
> +	/*
> +	 * Instead of allocating page_cgroup for [start, end)
> +	 * We allocate page_cgroup to the same size of mem_map.
> +	 * See page_alloc.c::alloc_node_mem_map()
> +	 */
> +	start = NODE_DATA(nid)->node_start_pfn & ~(MAX_ORDER_NR_PAGES - 1);
> +	end = NODE_DATA(nid)->node_start_pfn
> +			+ NODE_DATA(nid)->node_spanned_pages;
> +	end = ALIGN(end, MAX_ORDER_NR_PAGES);
> +	nr_pages = end - start;
>  

I don't know what this function is doing, but that will calculate nr_pages
to be the full width of a node, holes and all which is what I think you're
trying to do. Again, remember this could cover another node as you can have
a situation where the pfn ranges are

      node1_pages   |   node0_pages	|  node1_pages
start <---------------------------------------------->end

Maybe this is not a problem for you. It all depends on how you map a PFN
to a table. There is also a concern for memory usage as;

>  	table_size = sizeof(struct page_cgroup) * nr_pages;
>  

this is potentially a very large table.

> @@ -52,6 +60,9 @@ static int __init alloc_node_page_cgroup
>  			table_size, PAGE_SIZE, __pa(MAX_DMA_ADDRESS));
>  	if (!base)
>  		return -ENOMEM;
> +
> +	start_pfn = NODE_DATA(nid)->node_start_pfn;
> +	base = base + start_pfn - start;
>  	for (index = 0; index < nr_pages; index++) {
>  		pc = base + index;
>  		__init_page_cgroup(pc, start_pfn + index);
> 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-10-21  8:34 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 10:48 [RFC][PATCH -mm 0/5] mem+swap resource controller(trial patch) Daisuke Nishimura
2008-10-17 10:56 ` [PATCH -mm 1/5] memcg: replace res_counter Daisuke Nishimura
2008-10-20 19:53   ` Paul Menage
2008-10-21  1:14     ` KAMEZAWA Hiroyuki
2008-10-21  1:29       ` Paul Menage
2008-10-21  1:49         ` KAMEZAWA Hiroyuki
2008-10-21  2:15           ` Paul Menage
2008-10-21  2:50             ` KAMEZAWA Hiroyuki
2008-10-21  2:20           ` Paul Menage
2008-10-21  3:03             ` KAMEZAWA Hiroyuki
2008-10-21  6:30               ` Paul Menage
2008-10-21  5:30       ` Balbir Singh
2008-10-21  5:39         ` KAMEZAWA Hiroyuki
2008-10-21  6:20           ` [memcg BUG] unable to handle kernel NULL pointer derefence at 00000000 Li Zefan
2008-10-21  6:25             ` KAMEZAWA Hiroyuki
2008-10-21  6:28               ` Li Zefan
2008-10-21  6:38                 ` Daisuke Nishimura
2008-10-21  6:54             ` KAMEZAWA Hiroyuki
2008-10-21  7:04               ` Li Zefan
2008-10-21  7:16                 ` KAMEZAWA Hiroyuki
2008-10-21  7:21                   ` Li Zefan
2008-10-21  8:18                     ` KAMEZAWA Hiroyuki
2008-10-21  8:34                       ` Mel Gorman [this message]
2008-10-21  8:38                         ` KAMEZAWA Hiroyuki
2008-10-21  8:35                       ` Li Zefan
2008-10-21  8:36                         ` KAMEZAWA Hiroyuki
2008-10-21  8:57                         ` KAMEZAWA Hiroyuki
2008-10-21  9:13                           ` Li Zefan
2008-10-21  9:25                             ` KAMEZAWA Hiroyuki
2008-10-21  9:54                               ` Li Zefan
2008-10-21 10:14                                 ` KAMEZAWA Hiroyuki
2008-10-21 10:57                                   ` Li Zefan
2008-10-21 11:00                                     ` KAMEZAWA Hiroyuki
2008-10-21 11:09                                       ` KAMEZAWA Hiroyuki
2008-10-21 11:13                                     ` KAMEZAWA Hiroyuki
2008-10-21 11:19                                     ` Ingo Molnar
2008-10-21 11:23                                       ` KAMEZAWA Hiroyuki
2008-10-21 11:28                                         ` Ingo Molnar
2008-10-21 11:32                                           ` KAMEZAWA Hiroyuki
2008-10-21 11:38                                             ` Ingo Molnar
2008-10-22  2:13                                             ` Daisuke Nishimura
2008-10-22  2:31                                               ` KAMEZAWA Hiroyuki
2008-10-21 11:29                                         ` Balbir Singh
2008-10-21 11:34                                           ` KAMEZAWA Hiroyuki
2008-10-21 12:00                                           ` KAMEZAWA Hiroyuki
2008-10-21 12:14                                             ` Balbir Singh
2008-10-21 13:09                                               ` KAMEZAWA Hiroyuki
2008-10-21 13:25                                                 ` Balbir Singh
2008-10-21 13:34                                                 ` Balbir Singh
2008-10-21 13:44                                                   ` [memcg BUG] unable to handle kernel NULL pointer derefence at00000000 亀澤 寛之
2008-10-21 10:58                                   ` [memcg BUG] unable to handle kernel NULL pointer derefence at 00000000 Balbir Singh
2008-10-21  9:33                           ` Daisuke Nishimura
2008-10-21  9:41                             ` KAMEZAWA Hiroyuki
2008-10-21 10:15                               ` Daisuke Nishimura
2008-10-17 10:59 ` [PATCH -mm 2/5] memcg: mem_cgroup private ID Daisuke Nishimura
2008-10-17 11:01 ` [PATCH -mm 3/5] memcg: mem+swap controller Kconfig Daisuke Nishimura, KAMEZAWA Hiroyuki
2008-10-17 11:04 ` [PATCH -mm 4/5] memcg: mem+swap counter Daisuke Nishimura
2008-10-17 11:06 ` [PATCH -mm 5/5] memcg: mem+swap accounting Daisuke Nishimura
2008-10-20  0:24 ` [RFC][PATCH -mm 0/5] mem+swap resource controller(trial patch) KAMEZAWA Hiroyuki
2008-10-20  2:53   ` Daisuke Nishimura

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081021083454.GA2427@csn.ul.ie \
    --to=mel@skynet.ie \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=lizf@cn.fujitsu.com \
    --cc=menage@google.com \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox