Re: [PATCH 0/4] sparsemem intro patches

From: David S. Miller
Date: Mon Mar 14 2005 - 17:45:40 EST

On Mon, 14 Mar 2005 14:18:31 -0800
Dave Hansen <haveblue@xxxxxxxxxx> wrote:

> Those bits are used today for page_zone() and page_to_nid(). I assume
> that you don't support NUMA, but how do you get around the page_zone()
> definition? (a quick grep in asm-sparc64 didn't show anything obvious)
> static inline struct zone *page_zone(struct page *page)
> {
> return zone_table[page->flags >> NODEZONE_SHIFT];
> }

NODEZONE_SHIFT is (64 /* sizeof(page_flags_t)*8 */ -

Which means the table is indexed by the top 3 bits of page->flags.
Sparc64 only uses a couple bits (specifically, enough to hold
(NR_CPUS - 1)) starting at bit 24, so this should not intersect
the page_zone() usage.

I don't even accidently modify those bits when setting and clearing
this cpu field.

However, I do notice that I assume NR_CPUS is a power of two. I should
certainly cure that. (Basically, I use ~(NR_CPUS - 1) as a mask).

> BTW, in theory, the new patch should allow page->flags to be better
> managed by a variety of users, including special arch users. An
> architecture should be able to relatively easily add the necessary
> pieces to reserve them. We could even have a ARCH_RESERVED_BITS macro
> or something.

That sounds like a great idea. We have several issues like this, perhaps
it's time to create some abstraction accessors via include/asm-*/page-flags.h
The platform can specify the type and size or whatever of page_flags_t, how
to stick node and zone numbers into the field, and whatever else. Furthermore,
we can have an asm-generic/page-flags.h that most folks can just use and
replicates what occurs right now.

That may be overkill, however.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at