Messages in this thread | | | Subject | Re: [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions? | From | Michael Ellerman <> | Date | Wed, 10 May 2006 16:06:13 +1000 |
| |
On Tue, 2006-05-09 at 15:28 +0100, Andy Whitcroft wrote: > Andy Whitcroft wrote: > > 3) record the nid -- when we record the memory present in the system we > > are passed the nid. > > > > Somehow the last of these seems the most logical given we have the > > correct information at the time we record that we need to instantiate > > the section. So I had a quick go at something which seems to have come > > out pretty clean. Attached is a completly untested patch to show what I > > am proposing. > > Ok. Attached is a version which builds and boots. The patch looks > pretty simple. Michael could you give it a spin on the broken machine > for me.
Hey, it's not broken, it's just special :D
That works a treat, boots and otherwise seems fine.
> Signed-off-by: Andy Whitcroft <apw@shadowen.org>
> +/* > + * During early boot we need to record the nid from which we will > + * later allocate the section mem_map. Encode this into the section > + * pointer. Overload the section_mem_map with this information. > + */ > +static inline unsigned long sparse_encode_early_nid(int nid) > +{ > + return (nid << SECTION_MAP_LAST_BIT); > +} > + > +static inline int sparse_early_nid(struct mem_section *section) > +{ > + unsigned long nid = section->section_mem_map; > + return (nid >> SECTION_MAP_LAST_BIT); > +}
What about just for readability: (in linux/mmzone.h)
#define SECTION_MARKED_PRESENT (1UL<<0) #define SECTION_HAS_MEM_MAP (1UL<<1) #define SECTION_MAP_LAST_BIT (1UL<<2) #define SECTION_NID_SHIFT SECTION_MAP_LAST_BIT
cheers
-- Michael Ellerman IBM OzLabs
wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person [unhandled content-type:application/pgp-signature] | |