[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20090722093847.61f0e4ee.kamezawa.hiroyu@jp.fujitsu.com>
Date: Wed, 22 Jul 2009 09:38:47 +0900
From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc: "Rafael J. Wysocki" <rjw@...k.pl>,
Heiko Carstens <heiko.carstens@...ibm.com>,
Nigel Cunningham <ncunningham@...a.org.au>,
Gerald Schaefer <gerald.schaefer@...ibm.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Martin Schwidefsky <schwidefsky@...ibm.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Yasunori Goto <y-goto@...fujitsu.com>,
Nick Piggin <npiggin@...e.de>, linux-mm@...ck.org
Subject: Re: [PATCH] hibernate / memory hotplug: always use
for_each_populated_zone()
On Wed, 22 Jul 2009 09:25:35 +0900
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com> wrote:
> See ia64's ia64_pfn_valid(). It uses get_user() very effectively.
> (I think this cost cost is small in any arch...)
>
> 523 ia64_pfn_valid (unsigned long pfn)
> 524 {
> 525 char byte;
> 526 struct page *pg = pfn_to_page(pfn);
> 527
> 528 return (__get_user(byte, (char __user *) pg) == 0)
> 529 && ((((u64)pg & PAGE_MASK) == (((u64)(pg + 1) - 1) & PAGE_MASK))
> 530 || (__get_user(byte, (char __user *) (pg + 1) - 1) == 0));
> 531 }
>
Just an explanation. This code is for checking "there is memmap or not" for
CONFIG_VIRTUAL_MEMMAP+CONFIG_DISCONTIGMEM, which allocates memmap in virtually
contiguous area. Because ia64 tends to have very sparse memory map,
memmap cannot be allocated in continuous area and memmap has holes.
This code checkes first byte and last byte of "struct page" is valid.
Thanks,
-Kame
--
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