* [1/3] add early_pfn_to_nid for ppc64
@ 2005-05-04 20:28 Andy Whitcroft
2005-05-05 15:44 ` Joel Schopp
0 siblings, 1 reply; 3+ messages in thread
From: Andy Whitcroft @ 2005-05-04 20:28 UTC (permalink / raw)
To: linuxppc64-dev, paulus, anton
Cc: linux-mm, linux-kernel, apw, haveblue, kravetz
Provide an implementation of early_pfn_to_nid for PPC64. This is
used by memory models to determine the node from which to take
allocations before the memory allocators are fully initialised.
Signed-off-by: Andy Whitcroft <apw@shadowen.org>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Martin Bligh <mbligh@aracnet.com>
---
arch/ppc64/Kconfig | 4 ++++
include/asm-ppc64/mmzone.h | 5 +++++
2 files changed, 9 insertions(+)
diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/arch/ppc64/Kconfig current/arch/ppc64/Kconfig
--- reference/arch/ppc64/Kconfig 2005-05-04 20:54:41.000000000 +0100
+++ current/arch/ppc64/Kconfig 2005-05-04 20:54:48.000000000 +0100
@@ -211,6 +211,10 @@ config ARCH_FLATMEM_ENABLE
source "mm/Kconfig"
+config HAVE_ARCH_EARLY_PFN_TO_NID
+ bool
+ default y
+
# Some NUMA nodes have memory ranges that span
# other nodes. Even though a pfn is valid and
# between a node's start and end pfns, it may not
diff -X /home/apw/brief/lib/vdiff.excl -rupN reference/include/asm-ppc64/mmzone.h current/include/asm-ppc64/mmzone.h
--- reference/include/asm-ppc64/mmzone.h 2005-05-04 20:54:41.000000000 +0100
+++ current/include/asm-ppc64/mmzone.h 2005-05-04 20:54:48.000000000 +0100
@@ -90,4 +90,9 @@ static inline int pa_to_nid(unsigned lon
#define discontigmem_pfn_valid(pfn) ((pfn) < num_physpages)
#endif /* CONFIG_DISCONTIGMEM */
+
+#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT)
+#endif
+
#endif /* _ASM_MMZONE_H_ */
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [1/3] add early_pfn_to_nid for ppc64
2005-05-04 20:28 [1/3] add early_pfn_to_nid for ppc64 Andy Whitcroft
@ 2005-05-05 15:44 ` Joel Schopp
2005-05-05 16:19 ` Andy Whitcroft
0 siblings, 1 reply; 3+ messages in thread
From: Joel Schopp @ 2005-05-05 15:44 UTC (permalink / raw)
To: Andy Whitcroft
Cc: linuxppc64-dev, paulus, anton, linux-mm, haveblue, linux-kernel
> +#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
> +#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) << PAGE_SHIFT)
> +#endif
Is there a reason we didn't just use pfn_to_nid() directly here instead
of pa_to_nid()? I'm just thinking of having DISCONTIG/NUMA off and
pfn_to_nid() being #defined to zero for those cases.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [1/3] add early_pfn_to_nid for ppc64
2005-05-05 15:44 ` Joel Schopp
@ 2005-05-05 16:19 ` Andy Whitcroft
0 siblings, 0 replies; 3+ messages in thread
From: Andy Whitcroft @ 2005-05-05 16:19 UTC (permalink / raw)
To: jschopp; +Cc: linuxppc64-dev, paulus, anton, linux-mm, haveblue, linux-kernel
Joel Schopp wrote:
>> +#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
>> +#define early_pfn_to_nid(pfn) pa_to_nid(((unsigned long)pfn) <<
>> PAGE_SHIFT)
>> +#endif
>
>
> Is there a reason we didn't just use pfn_to_nid() directly here instead
> of pa_to_nid()? I'm just thinking of having DISCONTIG/NUMA off and
> pfn_to_nid() being #defined to zero for those cases.
The problem is that pfn_to_nid is defined by the memory model. In the
SPARSEMEM case it isn't always usable until after the we have
initialised and allocated the sparse mem_maps. It is allocations during
this phase that need this early_pfn_to_nid() form, to guide its
allocations of the mem_map to obtain locality with the physical memory
blocks.
This is clearer in the i386 port where the early_pfn_to_nid()
implementation uses low level table to determine the location. As has
been mentioned in another thread, we are using what is effectivly a
DISCONTIGMEM data structure here. I have some work in progress to split
that last part and move to a true early implementation on ppc64 too.
-apw
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-05-05 16:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-04 20:28 [1/3] add early_pfn_to_nid for ppc64 Andy Whitcroft
2005-05-05 15:44 ` Joel Schopp
2005-05-05 16:19 ` Andy Whitcroft
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).