* [PATCH 1/3] resources: introduce generic page_is_ram()
[not found] <20100122032102.137106635@intel.com>
@ 2010-01-22 3:21 ` Wu Fengguang
2010-01-22 3:21 ` Wu Fengguang
` (3 more replies)
0 siblings, 4 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 3:21 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: Andrew Morton, Chen Liqin, Lennox Wu, Ralf Baechle,
Américo Wang, linux-mips, KAMEZAWA Hiroyuki, Yinghai Lu,
Wu Fengguang, x86, LKML, Andi Kleen, shaohui.zheng
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: page-is-ram.patch --]
[-- Type: text/plain, Size: 2443 bytes --]
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: Américo Wang <xiyou.wangcong@gmail.com>
CC: linux-mips@linux-mips.org
CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
CC: Yinghai Lu <yinghai@kernel.org>
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 | 11 +++++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
--- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
@@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
#endif
+#define PAGE_IS_RAM 24
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+ return PAGE_IS_RAM;
+}
+int __attribute__((weak)) page_is_ram(unsigned long pfn)
+{
+ return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
+}
+#undef PAGE_IS_RAM
+
/*
* Find empty slot in the resource tree given range and alignment.
*/
--- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
@@ -191,5 +191,7 @@ extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
+extern int page_is_ram(unsigned long pfn);
+
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
return 1;
--- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
int i;
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
@ 2010-01-22 3:21 ` Wu Fengguang
2010-01-22 4:10 ` KAMEZAWA Hiroyuki
` (2 subsequent siblings)
3 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 3:21 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, H. Peter Anvin
Cc: Andrew Morton, Chen Liqin, Lennox Wu, Ralf Baechle,
Américo Wang, linux-mips, KAMEZAWA Hiroyuki, Yinghai Lu,
Wu Fengguang, x86, LKML, Andi Kleen, shaohui.zheng
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: page-is-ram.patch --]
[-- Type: text/plain, Size: 2443 bytes --]
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: Américo Wang <xiyou.wangcong@gmail.com>
CC: linux-mips@linux-mips.org
CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
CC: Yinghai Lu <yinghai@kernel.org>
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 | 11 +++++++++++
4 files changed, 15 insertions(+), 2 deletions(-)
--- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
@@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
#endif
+#define PAGE_IS_RAM 24
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+ return PAGE_IS_RAM;
+}
+int __attribute__((weak)) page_is_ram(unsigned long pfn)
+{
+ return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
+}
+#undef PAGE_IS_RAM
+
/*
* Find empty slot in the resource tree given range and alignment.
*/
--- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
@@ -191,5 +191,7 @@ extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
+extern int page_is_ram(unsigned long pfn);
+
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
return 1;
--- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
int i;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
2010-01-22 3:21 ` Wu Fengguang
@ 2010-01-22 4:10 ` KAMEZAWA Hiroyuki
2010-01-22 4:20 ` [PATCH 1/3 v3] " Wu Fengguang
2010-01-22 5:15 ` [PATCH 1/3] " Xiaotian Feng
2010-01-22 7:51 ` H. Peter Anvin
3 siblings, 1 reply; 12+ messages in thread
From: KAMEZAWA Hiroyuki @ 2010-01-22 4:10 UTC (permalink / raw)
To: Wu Fengguang
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips, Yinghai Lu, x86, LKML, Andi Kleen, shaohui.zheng
On Fri, 22 Jan 2010 11:21:03 +0800
Wu Fengguang <fengguang.wu@intel.com> wrote:
> 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: Am辿rico Wang <xiyou.wangcong@gmail.com>
> CC: linux-mips@linux-mips.org
> CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Yinghai Lu <yinghai@kernel.org>
> Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Maybe adding comment like this is good for reviewers..
"This page_is_ram() returns true if specified address is registered
as System RAM in io_resource list."
AFAIK, this "System RAM" information has been used for kdump to grab valid
memory area and seems good for the kernel itself.
Thanks,
-Kame
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> ---
> arch/mips/mm/init.c | 2 +-
> arch/score/mm/init.c | 2 +-
> include/linux/ioport.h | 2 ++
> kernel/resource.c | 11 +++++++++++
> 4 files changed, 15 insertions(+), 2 deletions(-)
>
> --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
>
> #endif
>
> +#define PAGE_IS_RAM 24
> +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> +{
> + return PAGE_IS_RAM;
> +}
> +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> +{
> + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> +}
> +#undef PAGE_IS_RAM
> +
> /*
> * Find empty slot in the resource tree given range and alignment.
> */
> --- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
> @@ -191,5 +191,7 @@ extern int
> walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
> void *arg, int (*func)(unsigned long, unsigned long, void *));
>
> +extern int page_is_ram(unsigned long pfn);
> +
> #endif /* __ASSEMBLY__ */
> #endif /* _LINUX_IOPORT_H */
> --- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
> return 1;
> --- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> int i;
>
>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3 v3] resources: introduce generic page_is_ram()
2010-01-22 4:10 ` KAMEZAWA Hiroyuki
@ 2010-01-22 4:20 ` Wu Fengguang
0 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 4:20 UTC (permalink / raw)
To: KAMEZAWA Hiroyuki
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, Yinghai Lu, x86@kernel.org, LKML,
Andi Kleen, Zheng, Shaohui
On Fri, Jan 22, 2010 at 06:10:17AM +0200, KAMEZAWA Hiroyuki wrote:
> On Fri, 22 Jan 2010 11:21:03 +0800
> Wu Fengguang <fengguang.wu@intel.com> wrote:
>
> > 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: Am辿rico Wang <xiyou.wangcong@gmail.com>
> > CC: linux-mips@linux-mips.org
> > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > CC: Yinghai Lu <yinghai@kernel.org>
> > Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>
> Maybe adding comment like this is good for reviewers..
>
> "This page_is_ram() returns true if specified address is registered
> as System RAM in io_resource list."
>
> AFAIK, this "System RAM" information has been used for kdump to grab valid
> memory area and seems good for the kernel itself.
Thanks! Patch updated as follows.
---
resources: introduce generic page_is_ram()
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.
v3: add comment (KAMEZAWA Hiroyuki)
v2: add PAGE_IS_RAM macro (Américo Wang)
CC: Chen Liqin <liqin.chen@sunplusct.com>
CC: Lennox Wu <lennox.wu@gmail.com>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Américo Wang <xiyou.wangcong@gmail.com>
CC: linux-mips@linux-mips.org
CC: Yinghai Lu <yinghai@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
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 | 15 +++++++++++++++
4 files changed, 19 insertions(+), 2 deletions(-)
--- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/kernel/resource.c 2010-01-22 12:17:50.000000000 +0800
@@ -327,6 +327,21 @@ int walk_system_ram_range(unsigned long
#endif
+#define PAGE_IS_RAM 24
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+ return PAGE_IS_RAM;
+}
+/*
+ * This generic page_is_ram() returns true if specified address is
+ * registered as "System RAM" in iomem_resource list.
+ */
+int __attribute__((weak)) page_is_ram(unsigned long pfn)
+{
+ return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
+}
+#undef PAGE_IS_RAM
+
/*
* Find empty slot in the resource tree given range and alignment.
*/
--- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
@@ -191,5 +191,7 @@ extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
+extern int page_is_ram(unsigned long pfn);
+
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
return 1;
--- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
int i;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
2010-01-22 3:21 ` Wu Fengguang
2010-01-22 4:10 ` KAMEZAWA Hiroyuki
@ 2010-01-22 5:15 ` Xiaotian Feng
2010-01-22 5:37 ` Wu Fengguang
2010-01-22 7:51 ` H. Peter Anvin
3 siblings, 1 reply; 12+ messages in thread
From: Xiaotian Feng @ 2010-01-22 5:15 UTC (permalink / raw)
To: Wu Fengguang
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips, KAMEZAWA Hiroyuki, Yinghai Lu, x86, LKML, Andi Kleen,
shaohui.zheng
On Fri, Jan 22, 2010 at 11:21 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> 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: Américo Wang <xiyou.wangcong@gmail.com>
> CC: linux-mips@linux-mips.org
> CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> CC: Yinghai Lu <yinghai@kernel.org>
> 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 | 11 +++++++++++
> 4 files changed, 15 insertions(+), 2 deletions(-)
>
> --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
>
> #endif
>
> +#define PAGE_IS_RAM 24
> +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> +{
> + return PAGE_IS_RAM;
> +}
> +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> +{
> + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> +}
> +#undef PAGE_IS_RAM
> +
I'm not sure, but any build test for powerpc/mips/score?
walk_system_ram_range is defined when CONFIG_ARCH_HAS_WALK_MEMORY is not set.
Is it safe when CONFIG_ARCH_HAS_WALK_MEMORY is set for some powerpc archs?
> /*
> * Find empty slot in the resource tree given range and alignment.
> */
> --- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
> @@ -191,5 +191,7 @@ extern int
> walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
> void *arg, int (*func)(unsigned long, unsigned long, void *));
>
> +extern int page_is_ram(unsigned long pfn);
> +
> #endif /* __ASSEMBLY__ */
> #endif /* _LINUX_IOPORT_H */
> --- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
> return 1;
> --- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> int i;
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 5:15 ` [PATCH 1/3] " Xiaotian Feng
@ 2010-01-22 5:37 ` Wu Fengguang
2010-01-22 5:50 ` Xiaotian Feng
0 siblings, 1 reply; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 5:37 UTC (permalink / raw)
To: Xiaotian Feng
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Thu, Jan 21, 2010 at 10:15:50PM -0700, Xiaotian Feng wrote:
> On Fri, Jan 22, 2010 at 11:21 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> > 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: Américo Wang <xiyou.wangcong@gmail.com>
> > CC: linux-mips@linux-mips.org
> > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> > CC: Yinghai Lu <yinghai@kernel.org>
> > 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 | 11 +++++++++++
> > 4 files changed, 15 insertions(+), 2 deletions(-)
> >
> > --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> > +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> > @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
> >
> > #endif
> >
> > +#define PAGE_IS_RAM 24
> > +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> > +{
> > + return PAGE_IS_RAM;
> > +}
> > +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> > +{
> > + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> > +}
> > +#undef PAGE_IS_RAM
> > +
>
> I'm not sure, but any build test for powerpc/mips/score?
Sorry, no build tests yet:
/bin/sh: score-linux-gcc: command not found
I just make the mips/score page_is_ram() non-static and assume that
will make it compile.
> walk_system_ram_range is defined when CONFIG_ARCH_HAS_WALK_MEMORY is not set.
> Is it safe when CONFIG_ARCH_HAS_WALK_MEMORY is set for some powerpc archs?
Good question. Grep shows that CONFIG_ARCH_HAS_WALK_MEMORY is only
defined for powerpc, and it has its own page_is_ram() as well as
walk_system_ram_range().
walk_system_ram_range() must be defined somewhere because it is
expected to be generic routine: exported and called from both
in-kernel and out-of-tree code.
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 5:37 ` Wu Fengguang
@ 2010-01-22 5:50 ` Xiaotian Feng
2010-01-22 5:52 ` Wu Fengguang
0 siblings, 1 reply; 12+ messages in thread
From: Xiaotian Feng @ 2010-01-22 5:50 UTC (permalink / raw)
To: Wu Fengguang
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Fri, Jan 22, 2010 at 1:37 PM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> On Thu, Jan 21, 2010 at 10:15:50PM -0700, Xiaotian Feng wrote:
>> On Fri, Jan 22, 2010 at 11:21 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
>> > 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: Américo Wang <xiyou.wangcong@gmail.com>
>> > CC: linux-mips@linux-mips.org
>> > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
>> > CC: Yinghai Lu <yinghai@kernel.org>
>> > 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 | 11 +++++++++++
>> > 4 files changed, 15 insertions(+), 2 deletions(-)
>> >
>> > --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
>> > +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
>> > @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
>> >
>> > #endif
>> >
>> > +#define PAGE_IS_RAM 24
>> > +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
>> > +{
>> > + return PAGE_IS_RAM;
>> > +}
>> > +int __attribute__((weak)) page_is_ram(unsigned long pfn)
>> > +{
>> > + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
>> > +}
>> > +#undef PAGE_IS_RAM
>> > +
>>
>> I'm not sure, but any build test for powerpc/mips/score?
>
> Sorry, no build tests yet:
>
> /bin/sh: score-linux-gcc: command not found
>
> I just make the mips/score page_is_ram() non-static and assume that
> will make it compile.
>
>> walk_system_ram_range is defined when CONFIG_ARCH_HAS_WALK_MEMORY is not set.
>> Is it safe when CONFIG_ARCH_HAS_WALK_MEMORY is set for some powerpc archs?
>
> Good question. Grep shows that CONFIG_ARCH_HAS_WALK_MEMORY is only
> defined for powerpc, and it has its own page_is_ram() as well as
> walk_system_ram_range().
>
> walk_system_ram_range() must be defined somewhere because it is
> expected to be generic routine: exported and called from both
> in-kernel and out-of-tree code.
>
Yes, powerpc has its own walk_system_ram_range() and page_is_ram() ;-)
Would it be better if moving the weak attribute page_is_ram() into #if
!defined(CONFIG_ARCH_HAS_WALK_MEMORY) ?
> Thanks,
> Fengguang
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 5:50 ` Xiaotian Feng
@ 2010-01-22 5:52 ` Wu Fengguang
0 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 5:52 UTC (permalink / raw)
To: Xiaotian Feng
Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Andrew Morton,
Chen Liqin, Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Thu, Jan 21, 2010 at 09:50:01PM -0800, Xiaotian Feng wrote:
> On Fri, Jan 22, 2010 at 1:37 PM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> > On Thu, Jan 21, 2010 at 10:15:50PM -0700, Xiaotian Feng wrote:
> >> On Fri, Jan 22, 2010 at 11:21 AM, Wu Fengguang <fengguang.wu@intel.com> wrote:
> >> > 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: Américo Wang <xiyou.wangcong@gmail.com>
> >> > CC: linux-mips@linux-mips.org
> >> > CC: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> >> > CC: Yinghai Lu <yinghai@kernel.org>
> >> > 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 | 11 +++++++++++
> >> > 4 files changed, 15 insertions(+), 2 deletions(-)
> >> >
> >> > --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> >> > +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> >> > @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
> >> >
> >> > #endif
> >> >
> >> > +#define PAGE_IS_RAM 24
> >> > +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> >> > +{
> >> > + return PAGE_IS_RAM;
> >> > +}
> >> > +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> >> > +{
> >> > + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> >> > +}
> >> > +#undef PAGE_IS_RAM
> >> > +
> >>
> >> I'm not sure, but any build test for powerpc/mips/score?
> >
> > Sorry, no build tests yet:
> >
> > /bin/sh: score-linux-gcc: command not found
> >
> > I just make the mips/score page_is_ram() non-static and assume that
> > will make it compile.
> >
> >> walk_system_ram_range is defined when CONFIG_ARCH_HAS_WALK_MEMORY is not set.
> >> Is it safe when CONFIG_ARCH_HAS_WALK_MEMORY is set for some powerpc archs?
> >
> > Good question. Grep shows that CONFIG_ARCH_HAS_WALK_MEMORY is only
> > defined for powerpc, and it has its own page_is_ram() as well as
> > walk_system_ram_range().
> >
> > walk_system_ram_range() must be defined somewhere because it is
> > expected to be generic routine: exported and called from both
> > in-kernel and out-of-tree code.
> >
>
> Yes, powerpc has its own walk_system_ram_range() and page_is_ram() ;-)
>
> Would it be better if moving the weak attribute page_is_ram() into #if
> !defined(CONFIG_ARCH_HAS_WALK_MEMORY) ?
Only several archs defined page_is_ram(), so that would not be feasible
for doing a _generic_ page_is_ram().
Thanks,
Fengguang
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3] resources: introduce generic page_is_ram()
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
` (2 preceding siblings ...)
2010-01-22 5:15 ` [PATCH 1/3] " Xiaotian Feng
@ 2010-01-22 7:51 ` H. Peter Anvin
2010-01-22 8:16 ` [PATCH 1/3 v4] " Wu Fengguang
3 siblings, 1 reply; 12+ messages in thread
From: H. Peter Anvin @ 2010-01-22 7:51 UTC (permalink / raw)
To: Wu Fengguang
Cc: Thomas Gleixner, Ingo Molnar, Andrew Morton, Chen Liqin,
Lennox Wu, Ralf Baechle, Américo Wang, linux-mips,
KAMEZAWA Hiroyuki, Yinghai Lu, x86, LKML, Andi Kleen,
shaohui.zheng
On 01/21/2010 07:21 PM, Wu Fengguang wrote:
> --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
>
> #endif
>
> +#define PAGE_IS_RAM 24
> +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> +{
> + return PAGE_IS_RAM;
> +}
> +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> +{
> + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> +}
> +#undef PAGE_IS_RAM
> +
Stylistic nitpick:
The use of the magic number "24" here is pretty ugly; it seems to imply
that there is something peculiar with this number and that it is trying
to avoid an overlap, whereas in fact any number but 0 and -1 would do.
I would rather see just returning 1 and do:
return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
(walk_system_ram_range() returning -1 on error, and 0 means continue.)
Note also that we don't write "constant == expression"; although some
schools teach it as a way to avoid the "=" versus "==" beginner C
mistake, it makes the code less intuitive to read.
Other than that, the patchset looks good; if Ingo doesn't beat me to it
I'll put it in tomorrow (need sleep right now.)
-hpa
--
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel. I don't speak on their behalf.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH 1/3 v4] resources: introduce generic page_is_ram()
2010-01-22 7:51 ` H. Peter Anvin
@ 2010-01-22 8:16 ` Wu Fengguang
2010-01-27 0:30 ` Andrew Morton
0 siblings, 1 reply; 12+ messages in thread
From: Wu Fengguang @ 2010-01-22 8:16 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Thomas Gleixner, Ingo Molnar, Andrew Morton, Chen Liqin,
Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Fri, Jan 22, 2010 at 12:51:32AM -0700, H. Peter Anvin wrote:
> On 01/21/2010 07:21 PM, Wu Fengguang wrote:
> > --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> > +++ linux-mm/kernel/resource.c 2010-01-22 11:20:35.000000000 +0800
> > @@ -327,6 +327,17 @@ int walk_system_ram_range(unsigned long
> >
> > #endif
> >
> > +#define PAGE_IS_RAM 24
> > +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> > +{
> > + return PAGE_IS_RAM;
> > +}
> > +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> > +{
> > + return PAGE_IS_RAM == walk_system_ram_range(pfn, 1, NULL, __is_ram);
> > +}
> > +#undef PAGE_IS_RAM
> > +
>
> Stylistic nitpick:
>
> The use of the magic number "24" here is pretty ugly; it seems to imply
> that there is something peculiar with this number and that it is trying
> to avoid an overlap, whereas in fact any number but 0 and -1 would do.
Yes, exactly.
> I would rather see just returning 1 and do:
>
> return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
>
> (walk_system_ram_range() returning -1 on error, and 0 means continue.)
Good suggestion.
> Note also that we don't write "constant == expression"; although some
> schools teach it as a way to avoid the "=" versus "==" beginner C
> mistake, it makes the code less intuitive to read.
Yeah.
> Other than that, the patchset looks good; if Ingo doesn't beat me to it
> I'll put it in tomorrow (need sleep right now.)
OK, thanks! Here is the updated patch.
---
resources: introduce generic page_is_ram()
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.
v4: prefer plain 1 instead of PAGE_IS_RAM (H. Peter Anvin)
v3: add comment (KAMEZAWA Hiroyuki)
"AFAIK, this "System RAM" information has been used for kdump to
grab valid memory area and seems good for the kernel itself."
v2: add PAGE_IS_RAM macro (Américo Wang)
CC: Chen Liqin <liqin.chen@sunplusct.com>
CC: Lennox Wu <lennox.wu@gmail.com>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: Américo Wang <xiyou.wangcong@gmail.com>
CC: linux-mips@linux-mips.org
CC: Yinghai Lu <yinghai@kernel.org>
Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
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 | 13 +++++++++++++
4 files changed, 17 insertions(+), 2 deletions(-)
--- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/kernel/resource.c 2010-01-22 16:12:55.000000000 +0800
@@ -327,6 +327,19 @@ int walk_system_ram_range(unsigned long
#endif
+static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
+{
+ return 1;
+}
+/*
+ * This generic page_is_ram() returns true if specified address is
+ * registered as "System RAM" in iomem_resource list.
+ */
+int __attribute__((weak)) page_is_ram(unsigned long pfn)
+{
+ return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
+}
+
/*
* Find empty slot in the resource tree given range and alignment.
*/
--- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
@@ -191,5 +191,7 @@ extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
+extern int page_is_ram(unsigned long pfn);
+
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
return 1;
--- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
+++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
@@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
}
#ifndef CONFIG_NEED_MULTIPLE_NODES
-static int __init page_is_ram(unsigned long pagenr)
+int page_is_ram(unsigned long pagenr)
{
int i;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3 v4] resources: introduce generic page_is_ram()
2010-01-22 8:16 ` [PATCH 1/3 v4] " Wu Fengguang
@ 2010-01-27 0:30 ` Andrew Morton
2010-01-27 3:06 ` Wu Fengguang
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Morton @ 2010-01-27 0:30 UTC (permalink / raw)
To: Wu Fengguang
Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Chen Liqin,
Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Fri, 22 Jan 2010 16:16:19 +0800
Wu Fengguang <fengguang.wu@intel.com> wrote:
>
> 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.
>
> v4: prefer plain 1 instead of PAGE_IS_RAM (H. Peter Anvin)
> v3: add comment (KAMEZAWA Hiroyuki)
> "AFAIK, this "System RAM" information has been used for kdump to
> grab valid memory area and seems good for the kernel itself."
> v2: add PAGE_IS_RAM macro (Am__rico Wang)
>
> CC: Chen Liqin <liqin.chen@sunplusct.com>
> CC: Lennox Wu <lennox.wu@gmail.com>
> CC: Ralf Baechle <ralf@linux-mips.org>
> CC: Am__rico Wang <xiyou.wangcong@gmail.com>
> CC: linux-mips@linux-mips.org
> CC: Yinghai Lu <yinghai@kernel.org>
> Reviewed-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
> 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 | 13 +++++++++++++
> 4 files changed, 17 insertions(+), 2 deletions(-)
>
> --- linux-mm.orig/kernel/resource.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/kernel/resource.c 2010-01-22 16:12:55.000000000 +0800
> @@ -327,6 +327,19 @@ int walk_system_ram_range(unsigned long
>
> #endif
>
> +static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg)
> +{
> + return 1;
> +}
> +/*
> + * This generic page_is_ram() returns true if specified address is
> + * registered as "System RAM" in iomem_resource list.
> + */
> +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> +{
> + return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
> +}
I'll switch this to use __weak.
> /*
> * Find empty slot in the resource tree given range and alignment.
> */
> --- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
> @@ -191,5 +191,7 @@ extern int
> walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
> void *arg, int (*func)(unsigned long, unsigned long, void *));
>
> +extern int page_is_ram(unsigned long pfn);
Is it appropriate that this function be declared in ioport.h? It's a
pretty general function. Dunno.
> #endif /* __ASSEMBLY__ */
> #endif /* _LINUX_IOPORT_H */
> --- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
> return 1;
> --- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> +++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> @@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
> }
>
> #ifndef CONFIG_NEED_MULTIPLE_NODES
> -static int __init page_is_ram(unsigned long pagenr)
> +int page_is_ram(unsigned long pagenr)
> {
> int i;
hm, so we lose the __init.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/3 v4] resources: introduce generic page_is_ram()
2010-01-27 0:30 ` Andrew Morton
@ 2010-01-27 3:06 ` Wu Fengguang
0 siblings, 0 replies; 12+ messages in thread
From: Wu Fengguang @ 2010-01-27 3:06 UTC (permalink / raw)
To: Andrew Morton
Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, Chen Liqin,
Lennox Wu, Ralf Baechle, Américo Wang,
linux-mips@linux-mips.org, KAMEZAWA Hiroyuki, Yinghai Lu,
x86@kernel.org, LKML, Andi Kleen, Zheng, Shaohui
On Tue, Jan 26, 2010 at 05:30:58PM -0700, Andrew Morton wrote:
> > +int __attribute__((weak)) page_is_ram(unsigned long pfn)
> > +{
> > + return walk_system_ram_range(pfn, 1, NULL, __is_ram) == 1;
> > +}
>
> I'll switch this to use __weak.
Thanks.
> > /*
> > * Find empty slot in the resource tree given range and alignment.
> > */
> > --- linux-mm.orig/include/linux/ioport.h 2010-01-22 11:20:34.000000000 +0800
> > +++ linux-mm/include/linux/ioport.h 2010-01-22 11:20:35.000000000 +0800
> > @@ -191,5 +191,7 @@ extern int
> > walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
> > void *arg, int (*func)(unsigned long, unsigned long, void *));
> >
> > +extern int page_is_ram(unsigned long pfn);
>
> Is it appropriate that this function be declared in ioport.h? It's a
> pretty general function. Dunno.
Good suggestion. The following patch moves it to mm.h.
> > #endif /* __ASSEMBLY__ */
> > #endif /* _LINUX_IOPORT_H */
> > --- linux-mm.orig/arch/score/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> > +++ linux-mm/arch/score/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> > @@ -59,7 +59,7 @@ static unsigned long setup_zero_page(voi
> > }
> >
> > #ifndef CONFIG_NEED_MULTIPLE_NODES
> > -static int __init page_is_ram(unsigned long pagenr)
> > +int page_is_ram(unsigned long pagenr)
> > {
> > if (pagenr >= min_low_pfn && pagenr < max_low_pfn)
> > return 1;
> > --- linux-mm.orig/arch/mips/mm/init.c 2010-01-22 11:20:34.000000000 +0800
> > +++ linux-mm/arch/mips/mm/init.c 2010-01-22 11:20:35.000000000 +0800
> > @@ -298,7 +298,7 @@ void __init fixrange_init(unsigned long
> > }
> >
> > #ifndef CONFIG_NEED_MULTIPLE_NODES
> > -static int __init page_is_ram(unsigned long pagenr)
> > +int page_is_ram(unsigned long pagenr)
> > {
> > int i;
>
> hm, so we lose the __init.
Maybe Ralf Baechle knows whether MIPS can switch to the (smaller)
generic page_is_ram().
Thanks,
Fengguang
---
move page_is_ram() declaration to mm.h
---
include/linux/ioport.h | 2 --
include/linux/mm.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
--- linux-mm.orig/include/linux/ioport.h 2010-01-27 11:04:22.000000000 +0800
+++ linux-mm/include/linux/ioport.h 2010-01-27 11:04:38.000000000 +0800
@@ -191,7 +191,5 @@ extern int
walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages,
void *arg, int (*func)(unsigned long, unsigned long, void *));
-extern int page_is_ram(unsigned long pfn);
-
#endif /* __ASSEMBLY__ */
#endif /* _LINUX_IOPORT_H */
--- linux-mm.orig/include/linux/mm.h 2010-01-27 11:04:43.000000000 +0800
+++ linux-mm/include/linux/mm.h 2010-01-27 11:05:30.000000000 +0800
@@ -265,6 +265,8 @@ static inline int get_page_unless_zero(s
return atomic_inc_not_zero(&page->_count);
}
+extern int page_is_ram(unsigned long pfn);
+
/* Support for virtually mapped pages */
struct page *vmalloc_to_page(const void *addr);
unsigned long vmalloc_to_pfn(const void *addr);
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2010-01-27 3:07 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20100122032102.137106635@intel.com>
2010-01-22 3:21 ` [PATCH 1/3] resources: introduce generic page_is_ram() Wu Fengguang
2010-01-22 3:21 ` Wu Fengguang
2010-01-22 4:10 ` KAMEZAWA Hiroyuki
2010-01-22 4:20 ` [PATCH 1/3 v3] " Wu Fengguang
2010-01-22 5:15 ` [PATCH 1/3] " Xiaotian Feng
2010-01-22 5:37 ` Wu Fengguang
2010-01-22 5:50 ` Xiaotian Feng
2010-01-22 5:52 ` Wu Fengguang
2010-01-22 7:51 ` H. Peter Anvin
2010-01-22 8:16 ` [PATCH 1/3 v4] " Wu Fengguang
2010-01-27 0:30 ` Andrew Morton
2010-01-27 3:06 ` Wu Fengguang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).