* [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
@ 2003-12-22 19:44 Matthew Dobson
2003-12-23 0:26 ` Martin J. Bligh
0 siblings, 1 reply; 8+ messages in thread
From: Matthew Dobson @ 2003-12-22 19:44 UTC (permalink / raw)
To: linux-kernel; +Cc: mbligh, Andrew Morton, Trivial Patch Monkey
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
pfn_to_nid() is defined for *almost* all configurations for i386. There
is a small bug in that for CONFIG_X86_PC it is not. This just sets up a
generic definition so that this function is always defined in a
reasonable manner.
Cheers!
-Matt
[-- Attachment #2: pfn_to_nid_def.patch --]
[-- Type: text/plain, Size: 523 bytes --]
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-vanilla/include/asm-i386/mmzone.h linux-2.6.0-patched/include/asm-i386/mmzone.h
--- linux-2.6.0-vanilla/include/asm-i386/mmzone.h Wed Dec 17 18:58:49 2003
+++ linux-2.6.0-patched/include/asm-i386/mmzone.h Thu Dec 18 14:46:14 2003
@@ -123,6 +123,7 @@ static inline struct pglist_data *pfn_to
#include <asm/srat.h>
#elif CONFIG_X86_PC
#define get_zholes_size(n) (0)
+#define pfn_to_nid(pfn) (0)
#else
#define pfn_to_nid(pfn) (0)
#endif /* CONFIG_X86_NUMAQ */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2003-12-22 19:44 [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386 Matthew Dobson
@ 2003-12-23 0:26 ` Martin J. Bligh
2004-01-05 21:35 ` Matthew Dobson
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Martin J. Bligh @ 2003-12-23 0:26 UTC (permalink / raw)
To: colpatch, linux-kernel; +Cc: Andrew Morton, Trivial Patch Monkey
> pfn_to_nid() is defined for *almost* all configurations for i386.
> There is a small bug in that for CONFIG_X86_PC it is not. This
> just sets up a generic definition so that this function is always
> defined in a reasonable manner.
I'd prefer to fix the current ungodly mess in the current fashion ...
I know it's longer, but I'd prefer to clean it up more if we're
going to touch it. This has been sitting in my tree for a while,
waiting for the code freeze to slush out a bit.
M.
diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/asm-i386/mmzone.h 278-pfn_to_nid/include/asm-i386/mmzone.h
--- 276-per_node_rss/include/asm-i386/mmzone.h 2003-10-01 11:48:22.000000000 -0700
+++ 278-pfn_to_nid/include/asm-i386/mmzone.h 2003-12-11 17:16:48.000000000 -0800
@@ -10,7 +10,49 @@
#ifdef CONFIG_DISCONTIGMEM
+#ifdef CONFIG_NUMA
+ #ifdef CONFIG_X86_NUMAQ
+ #include <asm/numaq.h>
+ #else /* summit or generic arch */
+ #include <asm/srat.h>
+ #endif
+#else /* !CONFIG_NUMA */
+ #define get_memcfg_numa get_memcfg_numa_flat
+ #define get_zholes_size(n) (0)
+#endif /* CONFIG_NUMA */
+
extern struct pglist_data *node_data[];
+#define NODE_DATA(nid) (node_data[nid])
+
+/*
+ * generic node memory support, the following assumptions apply:
+ *
+ * 1) memory comes in 256Mb contigious chunks which are either present or not
+ * 2) we will not have more than 64Gb in total
+ *
+ * for now assume that 64Gb is max amount of RAM for whole system
+ * 64Gb / 4096bytes/page = 16777216 pages
+ */
+#define MAX_NR_PAGES 16777216
+#define MAX_ELEMENTS 256
+#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
+
+extern u8 physnode_map[];
+
+static inline int pfn_to_nid(unsigned long pfn)
+{
+#ifdef CONFIG_NUMA
+ return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
+#else
+ return 0;
+#endif
+}
+
+static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
+{
+ return(NODE_DATA(pfn_to_nid(pfn)));
+}
+
/*
* Following are macros that are specific to this numa platform.
@@ -43,11 +85,6 @@ extern struct pglist_data *node_data[];
*/
#define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
-/*
- * Return a pointer to the node data for node n.
- */
-#define NODE_DATA(nid) (node_data[nid])
-
#define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
#define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
#define node_end_pfn(nid) \
@@ -93,40 +130,6 @@ extern struct pglist_data *node_data[];
*/
#define pfn_valid(pfn) ((pfn) < num_physpages)
-/*
- * generic node memory support, the following assumptions apply:
- *
- * 1) memory comes in 256Mb contigious chunks which are either present or not
- * 2) we will not have more than 64Gb in total
- *
- * for now assume that 64Gb is max amount of RAM for whole system
- * 64Gb / 4096bytes/page = 16777216 pages
- */
-#define MAX_NR_PAGES 16777216
-#define MAX_ELEMENTS 256
-#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
-
-extern u8 physnode_map[];
-
-static inline int pfn_to_nid(unsigned long pfn)
-{
- return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
-}
-static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
-{
- return(NODE_DATA(pfn_to_nid(pfn)));
-}
-
-#ifdef CONFIG_X86_NUMAQ
-#include <asm/numaq.h>
-#elif CONFIG_ACPI_SRAT
-#include <asm/srat.h>
-#elif CONFIG_X86_PC
-#define get_zholes_size(n) (0)
-#else
-#define pfn_to_nid(pfn) (0)
-#endif /* CONFIG_X86_NUMAQ */
-
extern int get_memcfg_numa_flat(void );
/*
* This allows any one NUMA architecture to be compiled
diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/linux/mmzone.h 278-pfn_to_nid/include/linux/mmzone.h
--- 276-per_node_rss/include/linux/mmzone.h 2003-10-14 15:50:34.000000000 -0700
+++ 278-pfn_to_nid/include/linux/mmzone.h 2003-12-11 17:16:48.000000000 -0800
@@ -303,7 +303,7 @@ extern struct pglist_data contig_page_da
#define NODE_DATA(nid) (&contig_page_data)
#define NODE_MEM_MAP(nid) mem_map
#define MAX_NODES_SHIFT 0
-
+#define pfn_to_nid(pfn) (0)
#else /* CONFIG_DISCONTIGMEM */
#include <asm/mmzone.h>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2003-12-23 0:26 ` Martin J. Bligh
@ 2004-01-05 21:35 ` Matthew Dobson
2004-01-05 22:53 ` Mike Fedyk
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Matthew Dobson @ 2004-01-05 21:35 UTC (permalink / raw)
To: Martin J. Bligh; +Cc: linux-kernel, Andrew Morton, Trivial Patch Monkey
Ok... This looks good to me. It's definitely longer than my 1 line fix,
but it's also more correct long-term solution.
Cheers!
-Matt
Martin J. Bligh wrote:
>>pfn_to_nid() is defined for *almost* all configurations for i386.
>>There is a small bug in that for CONFIG_X86_PC it is not. This
>>just sets up a generic definition so that this function is always
>>defined in a reasonable manner.
>
>
> I'd prefer to fix the current ungodly mess in the current fashion ...
> I know it's longer, but I'd prefer to clean it up more if we're
> going to touch it. This has been sitting in my tree for a while,
> waiting for the code freeze to slush out a bit.
>
> M.
>
>
> diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/asm-i386/mmzone.h 278-pfn_to_nid/include/asm-i386/mmzone.h
> --- 276-per_node_rss/include/asm-i386/mmzone.h 2003-10-01 11:48:22.000000000 -0700
> +++ 278-pfn_to_nid/include/asm-i386/mmzone.h 2003-12-11 17:16:48.000000000 -0800
> @@ -10,7 +10,49 @@
>
> #ifdef CONFIG_DISCONTIGMEM
>
> +#ifdef CONFIG_NUMA
> + #ifdef CONFIG_X86_NUMAQ
> + #include <asm/numaq.h>
> + #else /* summit or generic arch */
> + #include <asm/srat.h>
> + #endif
> +#else /* !CONFIG_NUMA */
> + #define get_memcfg_numa get_memcfg_numa_flat
> + #define get_zholes_size(n) (0)
> +#endif /* CONFIG_NUMA */
> +
> extern struct pglist_data *node_data[];
> +#define NODE_DATA(nid) (node_data[nid])
> +
> +/*
> + * generic node memory support, the following assumptions apply:
> + *
> + * 1) memory comes in 256Mb contigious chunks which are either present or not
> + * 2) we will not have more than 64Gb in total
> + *
> + * for now assume that 64Gb is max amount of RAM for whole system
> + * 64Gb / 4096bytes/page = 16777216 pages
> + */
> +#define MAX_NR_PAGES 16777216
> +#define MAX_ELEMENTS 256
> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
> +
> +extern u8 physnode_map[];
> +
> +static inline int pfn_to_nid(unsigned long pfn)
> +{
> +#ifdef CONFIG_NUMA
> + return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
> +#else
> + return 0;
> +#endif
> +}
> +
> +static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
> +{
> + return(NODE_DATA(pfn_to_nid(pfn)));
> +}
> +
>
> /*
> * Following are macros that are specific to this numa platform.
> @@ -43,11 +85,6 @@ extern struct pglist_data *node_data[];
> */
> #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
>
> -/*
> - * Return a pointer to the node data for node n.
> - */
> -#define NODE_DATA(nid) (node_data[nid])
> -
> #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
> #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
> #define node_end_pfn(nid) \
> @@ -93,40 +130,6 @@ extern struct pglist_data *node_data[];
> */
> #define pfn_valid(pfn) ((pfn) < num_physpages)
>
> -/*
> - * generic node memory support, the following assumptions apply:
> - *
> - * 1) memory comes in 256Mb contigious chunks which are either present or not
> - * 2) we will not have more than 64Gb in total
> - *
> - * for now assume that 64Gb is max amount of RAM for whole system
> - * 64Gb / 4096bytes/page = 16777216 pages
> - */
> -#define MAX_NR_PAGES 16777216
> -#define MAX_ELEMENTS 256
> -#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
> -
> -extern u8 physnode_map[];
> -
> -static inline int pfn_to_nid(unsigned long pfn)
> -{
> - return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
> -}
> -static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
> -{
> - return(NODE_DATA(pfn_to_nid(pfn)));
> -}
> -
> -#ifdef CONFIG_X86_NUMAQ
> -#include <asm/numaq.h>
> -#elif CONFIG_ACPI_SRAT
> -#include <asm/srat.h>
> -#elif CONFIG_X86_PC
> -#define get_zholes_size(n) (0)
> -#else
> -#define pfn_to_nid(pfn) (0)
> -#endif /* CONFIG_X86_NUMAQ */
> -
> extern int get_memcfg_numa_flat(void );
> /*
> * This allows any one NUMA architecture to be compiled
> diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/linux/mmzone.h 278-pfn_to_nid/include/linux/mmzone.h
> --- 276-per_node_rss/include/linux/mmzone.h 2003-10-14 15:50:34.000000000 -0700
> +++ 278-pfn_to_nid/include/linux/mmzone.h 2003-12-11 17:16:48.000000000 -0800
> @@ -303,7 +303,7 @@ extern struct pglist_data contig_page_da
> #define NODE_DATA(nid) (&contig_page_data)
> #define NODE_MEM_MAP(nid) mem_map
> #define MAX_NODES_SHIFT 0
> -
> +#define pfn_to_nid(pfn) (0)
> #else /* CONFIG_DISCONTIGMEM */
>
> #include <asm/mmzone.h>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2003-12-23 0:26 ` Martin J. Bligh
2004-01-05 21:35 ` Matthew Dobson
@ 2004-01-05 22:53 ` Mike Fedyk
2004-01-05 23:15 ` Martin J. Bligh
2004-03-29 15:45 ` Martin J. Bligh
2004-03-29 15:45 ` Matthew Dobson
2004-03-29 15:45 ` Mike Fedyk
3 siblings, 2 replies; 8+ messages in thread
From: Mike Fedyk @ 2004-01-05 22:53 UTC (permalink / raw)
To: Martin J. Bligh; +Cc: colpatch, linux-kernel, Andrew Morton
On Mon, Dec 22, 2003 at 04:26:40PM -0800, Martin J. Bligh wrote:
> + * for now assume that 64Gb is max amount of RAM for whole system
> + * 64Gb / 4096bytes/page = 16777216 pages
> + */
> +#define MAX_NR_PAGES 16777216
> +#define MAX_ELEMENTS 256
> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
Why not do the calculation in the define, and use PAGE_SIZE?
If PAGE_SIZE isn't 4k will it break the rest of this code, or will the
calculations make sence with larger PAGE_SIZE?
Might as well make it easier to go in the direction of variable PAGE_SIZE
instead of keeping the assumption.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2004-01-05 22:53 ` Mike Fedyk
@ 2004-01-05 23:15 ` Martin J. Bligh
2004-03-29 15:45 ` Martin J. Bligh
1 sibling, 0 replies; 8+ messages in thread
From: Martin J. Bligh @ 2004-01-05 23:15 UTC (permalink / raw)
To: Mike Fedyk; +Cc: colpatch, linux-kernel, Andrew Morton
>> + * for now assume that 64Gb is max amount of RAM for whole system
>> + * 64Gb / 4096bytes/page = 16777216 pages
>> + */
>> +#define MAX_NR_PAGES 16777216
>> +#define MAX_ELEMENTS 256
>> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
>
> Why not do the calculation in the define, and use PAGE_SIZE?
>
> If PAGE_SIZE isn't 4k will it break the rest of this code, or will the
> calculations make sence with larger PAGE_SIZE?
>
> Might as well make it easier to go in the direction of variable PAGE_SIZE
> instead of keeping the assumption.
The patch is just moving the code, not changing it ;-)
But yes, that value could probably be derived instead of hardcoded.
Separate patch though.
M.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2003-12-23 0:26 ` Martin J. Bligh
2004-01-05 21:35 ` Matthew Dobson
2004-01-05 22:53 ` Mike Fedyk
@ 2004-03-29 15:45 ` Matthew Dobson
2004-03-29 15:45 ` Mike Fedyk
3 siblings, 0 replies; 8+ messages in thread
From: Matthew Dobson @ 2004-03-29 15:45 UTC (permalink / raw)
To: Administrator; +Cc: linux-kernel, Andrew Morton, Trivial Patch Monkey
Ok... This looks good to me. It's definitely longer than my 1 line fix,
but it's also more correct long-term solution.
Cheers!
-Matt
Martin J. Bligh wrote:
>>pfn_to_nid() is defined for *almost* all configurations for i386.
>>There is a small bug in that for CONFIG_X86_PC it is not. This
>>just sets up a generic definition so that this function is always
>>defined in a reasonable manner.
>
>
> I'd prefer to fix the current ungodly mess in the current fashion ...
> I know it's longer, but I'd prefer to clean it up more if we're
> going to touch it. This has been sitting in my tree for a while,
> waiting for the code freeze to slush out a bit.
>
> M.
>
>
> diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/asm-i386/mmzone.h 278-pfn_to_nid/include/asm-i386/mmzone.h
> --- 276-per_node_rss/include/asm-i386/mmzone.h 2003-10-01 11:48:22.000000000 -0700
> +++ 278-pfn_to_nid/include/asm-i386/mmzone.h 2003-12-11 17:16:48.000000000 -0800
> @@ -10,7 +10,49 @@
>
> #ifdef CONFIG_DISCONTIGMEM
>
> +#ifdef CONFIG_NUMA
> + #ifdef CONFIG_X86_NUMAQ
> + #include <asm/numaq.h>
> + #else /* summit or generic arch */
> + #include <asm/srat.h>
> + #endif
> +#else /* !CONFIG_NUMA */
> + #define get_memcfg_numa get_memcfg_numa_flat
> + #define get_zholes_size(n) (0)
> +#endif /* CONFIG_NUMA */
> +
> extern struct pglist_data *node_data[];
> +#define NODE_DATA(nid) (node_data[nid])
> +
> +/*
> + * generic node memory support, the following assumptions apply:
> + *
> + * 1) memory comes in 256Mb contigious chunks which are either present or not
> + * 2) we will not have more than 64Gb in total
> + *
> + * for now assume that 64Gb is max amount of RAM for whole system
> + * 64Gb / 4096bytes/page = 16777216 pages
> + */
> +#define MAX_NR_PAGES 16777216
> +#define MAX_ELEMENTS 256
> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
> +
> +extern u8 physnode_map[];
> +
> +static inline int pfn_to_nid(unsigned long pfn)
> +{
> +#ifdef CONFIG_NUMA
> + return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
> +#else
> + return 0;
> +#endif
> +}
> +
> +static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
> +{
> + return(NODE_DATA(pfn_to_nid(pfn)));
> +}
> +
>
> /*
> * Following are macros that are specific to this numa platform.
> @@ -43,11 +85,6 @@ extern struct pglist_data *node_data[];
> */
> #define kvaddr_to_nid(kaddr) pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
>
> -/*
> - * Return a pointer to the node data for node n.
> - */
> -#define NODE_DATA(nid) (node_data[nid])
> -
> #define node_mem_map(nid) (NODE_DATA(nid)->node_mem_map)
> #define node_start_pfn(nid) (NODE_DATA(nid)->node_start_pfn)
> #define node_end_pfn(nid) \
> @@ -93,40 +130,6 @@ extern struct pglist_data *node_data[];
> */
> #define pfn_valid(pfn) ((pfn) < num_physpages)
>
> -/*
> - * generic node memory support, the following assumptions apply:
> - *
> - * 1) memory comes in 256Mb contigious chunks which are either present or not
> - * 2) we will not have more than 64Gb in total
> - *
> - * for now assume that 64Gb is max amount of RAM for whole system
> - * 64Gb / 4096bytes/page = 16777216 pages
> - */
> -#define MAX_NR_PAGES 16777216
> -#define MAX_ELEMENTS 256
> -#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
> -
> -extern u8 physnode_map[];
> -
> -static inline int pfn_to_nid(unsigned long pfn)
> -{
> - return(physnode_map[(pfn) / PAGES_PER_ELEMENT]);
> -}
> -static inline struct pglist_data *pfn_to_pgdat(unsigned long pfn)
> -{
> - return(NODE_DATA(pfn_to_nid(pfn)));
> -}
> -
> -#ifdef CONFIG_X86_NUMAQ
> -#include <asm/numaq.h>
> -#elif CONFIG_ACPI_SRAT
> -#include <asm/srat.h>
> -#elif CONFIG_X86_PC
> -#define get_zholes_size(n) (0)
> -#else
> -#define pfn_to_nid(pfn) (0)
> -#endif /* CONFIG_X86_NUMAQ */
> -
> extern int get_memcfg_numa_flat(void );
> /*
> * This allows any one NUMA architecture to be compiled
> diff -purN -X /home/mbligh/.diff.exclude 276-per_node_rss/include/linux/mmzone.h 278-pfn_to_nid/include/linux/mmzone.h
> --- 276-per_node_rss/include/linux/mmzone.h 2003-10-14 15:50:34.000000000 -0700
> +++ 278-pfn_to_nid/include/linux/mmzone.h 2003-12-11 17:16:48.000000000 -0800
> @@ -303,7 +303,7 @@ extern struct pglist_data contig_page_da
> #define NODE_DATA(nid) (&contig_page_data)
> #define NODE_MEM_MAP(nid) mem_map
> #define MAX_NODES_SHIFT 0
> -
> +#define pfn_to_nid(pfn) (0)
> #else /* CONFIG_DISCONTIGMEM */
>
> #include <asm/mmzone.h>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2003-12-23 0:26 ` Martin J. Bligh
` (2 preceding siblings ...)
2004-03-29 15:45 ` Matthew Dobson
@ 2004-03-29 15:45 ` Mike Fedyk
3 siblings, 0 replies; 8+ messages in thread
From: Mike Fedyk @ 2004-03-29 15:45 UTC (permalink / raw)
To: Administrator; +Cc: colpatch, linux-kernel, Andrew Morton
On Mon, Dec 22, 2003 at 04:26:40PM -0800, Martin J. Bligh wrote:
> + * for now assume that 64Gb is max amount of RAM for whole system
> + * 64Gb / 4096bytes/page = 16777216 pages
> + */
> +#define MAX_NR_PAGES 16777216
> +#define MAX_ELEMENTS 256
> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
Why not do the calculation in the define, and use PAGE_SIZE?
If PAGE_SIZE isn't 4k will it break the rest of this code, or will the
calculations make sence with larger PAGE_SIZE?
Might as well make it easier to go in the direction of variable PAGE_SIZE
instead of keeping the assumption.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386
2004-01-05 22:53 ` Mike Fedyk
2004-01-05 23:15 ` Martin J. Bligh
@ 2004-03-29 15:45 ` Martin J. Bligh
1 sibling, 0 replies; 8+ messages in thread
From: Martin J. Bligh @ 2004-03-29 15:45 UTC (permalink / raw)
To: Administrator; +Cc: colpatch, linux-kernel, Andrew Morton
>> + * for now assume that 64Gb is max amount of RAM for whole system
>> + * 64Gb / 4096bytes/page = 16777216 pages
>> + */
>> +#define MAX_NR_PAGES 16777216
>> +#define MAX_ELEMENTS 256
>> +#define PAGES_PER_ELEMENT (MAX_NR_PAGES/MAX_ELEMENTS)
>
> Why not do the calculation in the define, and use PAGE_SIZE?
>
> If PAGE_SIZE isn't 4k will it break the rest of this code, or will the
> calculations make sence with larger PAGE_SIZE?
>
> Might as well make it easier to go in the direction of variable PAGE_SIZE
> instead of keeping the assumption.
The patch is just moving the code, not changing it ;-)
But yes, that value could probably be derived instead of hardcoded.
Separate patch though.
M.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-03-29 15:45 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-12-22 19:44 [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386 Matthew Dobson
2003-12-23 0:26 ` Martin J. Bligh
2004-01-05 21:35 ` Matthew Dobson
2004-01-05 22:53 ` Mike Fedyk
2004-01-05 23:15 ` Martin J. Bligh
2004-03-29 15:45 ` Martin J. Bligh
2004-03-29 15:45 ` Matthew Dobson
2004-03-29 15:45 ` Mike Fedyk
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox