Received: from milmhbs1.lsil.com (147.145.21.209) by coscas01.lsi.com
 (172.21.36.60) with Microsoft SMTP Server id 8.1.393.1; Wed, 13 Jan 2010
 07:03:46 -0700
Received: from mail2.lsil.com (mail2.lsil.com [147.145.40.22])	by
 milmhbs1.lsil.com (8.12.11/8.12.11) with ESMTP id o0DE3elr006932	for
 <andy.sharp@lsi.com>; Wed, 13 Jan 2010 06:03:40 -0800
Received: from psmtp.com (na3sys009amx239.postini.com [74.125.149.123])	by
 mail2.lsil.com (8.12.11/8.12.11) with SMTP id o0DDwrkP010191	for
 <andy.sharp@lsi.com>; Wed, 13 Jan 2010 05:59:03 -0800 (PST)
Received: from source ([78.24.191.182]) by na3sys009amx239.postini.com
 ([74.125.148.14]) with SMTP;	Wed, 13 Jan 2010 06:03:35 PST
Received: from localhost.localdomain ([127.0.0.1]:33501 "EHLO
        eddie.linux-mips.org" rhost-flags-OK-OK-OK-FAIL)        by
 eddie.linux-mips.org with ESMTP id S1492508Ab0AMOBJ (ORCPT
        <rfc822;andy.sharp@lsi.com>); Wed, 13 Jan 2010 15:01:09 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 13 Jan 2010 15:00:51
 +0100 (CET)
Received: from mga09.intel.com ([134.134.136.24]:30635 "EHLO mga09.intel.com"
        rhost-flags-OK-OK-OK-OK) by eddie.linux-mips.org with ESMTP        id
 S1492615Ab0AMOAq (ORCPT <rfc822;linux-mips@linux-mips.org>);        Wed, 13
 Jan 2010 15:00:46 +0100
Received: from orsmga002.jf.intel.com ([10.7.209.21])  by
 orsmga102.jf.intel.com with ESMTP; 13 Jan 2010 06:00:37 -0800
Received: from unknown (HELO localhost.localdomain) ([10.255.12.25])  by
 orsmga002.jf.intel.com with ESMTP; 13 Jan 2010 06:00:17 -0800
Received: from wfg by localhost.localdomain with local (Exim 4.69)
        (envelope-from <fengguang.wu@intel.com>)        id 1NV3lb-0004hx-EX;
 Wed, 13 Jan 2010 22:00:11 +0800
From: Wu Fengguang <fengguang.wu@intel.com>
To: Andrew Morton <akpm@linux-foundation.org>
CC: Wu Fengguang <fengguang.wu@intel.com>, LKML
	<linux-kernel@vger.kernel.org>, Chen Liqin <liqin.chen@sunplusct.com>, Lennox
 Wu <lennox.wu@gmail.com>, Ralf Baechle <ralf@linux-mips.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>, KAMEZAWA Hiroyuki
	<kamezawa.hiroyu@jp.fujitsu.com>, Andi Kleen <andi@firstfloor.org>, Nick
 Piggin <npiggin@suse.de>, Hugh Dickins <hugh.dickins@tiscali.co.uk>, Linux
 Memory Management List <linux-mm@kvack.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Wed, 13 Jan 2010 06:53:09 -0700
Subject: [PATCH 4/8] resources: introduce generic page_is_ram()
Thread-Topic: [PATCH 4/8] resources: introduce generic page_is_ram()
Thread-Index: AcqUWTtQ4rMS1x3LSeOqE8zW/WWw1A==
Message-ID: <20100113135957.680223335@intel.com>
References: <20100113135305.013124116@intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Anonymous
X-MS-Exchange-Organization-AuthSource: coscas01.lsi.com
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-scanned-by: MIMEDefang 2.39
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:99.90000/99.90000 CV:99.9000 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-settings: 3 (1.0000:1.0000) s cv gt3 gt2 gt1 r p m c 
x-pstn-addresses: from <fengguang.wu@intel.com> [22/1] 
x-pstn-neptune: 0/0/0.00/0
user-agent: quilt/0.48-1
x-ironport-av: E=Sophos;i="4.49,268,1262592000";
    d="scan'208";a="483648896"
x-extloop1: 1
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

It's based on walk_system_ram_range(), for archs that don't have
their own page_is_ram().

The static verions in MIPS and SCORE are also made global.

CC: Chen Liqin <liqin.chen@sunplusct.com>
CC: Lennox Wu <lennox.wu@gmail.com>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>=20
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 arch/mips/mm/init.c    |    2 +-
 arch/score/mm/init.c   |    2 +-
 include/linux/ioport.h |    2 ++
 kernel/resource.c      |   10 ++++++++++
 4 files changed, 14 insertions(+), 2 deletions(-)

--- linux-mm.orig/kernel/resource.c	2010-01-10 10:11:53.000000000 +0800
+++ linux-mm/kernel/resource.c	2010-01-10 10:15:33.000000000 +0800
@@ -297,6 +297,16 @@ int walk_system_ram_range(unsigned long=20
=20
 #endif
=20
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+	return 24;
+}
+
+int __attribute__((weak)) page_is_ram(unsigned long pfn)
+{
+	return 24 =3D=3D walk_system_ram_range(pfn, 1, NULL, __is_ram);
+}
+
 /*
  * Find empty slot in the resource tree given range and alignment.
  */
--- linux-mm.orig/include/linux/ioport.h	2010-01-10 10:11:53.000000000 +080=
0
+++ linux-mm/include/linux/ioport.h	2010-01-10 10:11:54.000000000 +0800
@@ -188,5 +188,7 @@ extern int
 walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
 		void *arg, int (*func)(unsigned long, unsigned long, void *));
=20
+extern int page_is_ram(unsigned long pfn);
+
 #endif /* __ASSEMBLY__ */
 #endif	/* _LINUX_IOPORT_H */
--- linux-mm.orig/arch/score/mm/init.c	2010-01-10 10:35:38.000000000 +0800
+++ linux-mm/arch/score/mm/init.c	2010-01-10 10:38:04.000000000 +0800
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
 }
=20
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
 {
 	if (pagenr >=3D min_low_pfn && pagenr < max_low_pfn)
 		return 1;
--- linux-mm.orig/arch/mips/mm/init.c	2010-01-10 10:37:22.000000000 +0800
+++ linux-mm/arch/mips/mm/init.c	2010-01-10 10:37:26.000000000 +0800
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long=20
 }
=20
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
 {
 	int i;
=20



