2004-01-05 22:53:57

by Mike Fedyk

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386

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.


2004-01-05 23:16:08

by Martin J. Bligh

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386

>> + * 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.

2004-03-29 15:45:44

by Martin J. Bligh

[permalink] [raw]
Subject: Re: [TRIVIAL PATCH] Ensure pfn_to_nid() is always defined for i386

>> + * 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.