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 <[email protected]> > +/* > + * 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
Attachment:
signature.asc
Description: This is a digitally signed message part
- Follow-Ups:
- [PATCH] sparsemem record nid during memory present
- From: Andy Whitcroft <[email protected]>
- [PATCH] sparsemem record nid during memory present
- References:
- [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions?
- From: Michael Ellerman <[email protected]>
- Re: [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions?
- From: Andy Whitcroft <[email protected]>
- Re: [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions?
- From: Andy Whitcroft <[email protected]>
- [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions?
- Prev by Date: Re: USB 2.0 ehci failure with large amount of RAM (4GB) on x86_64
- Next by Date: Re: [PATCH -mm] megaraid gcc 4.1 warning fix
- Previous by thread: Re: [PATCH] SPARSEMEM + NUMA can't handle unaligned memory regions?
- Next by thread: [PATCH] sparsemem record nid during memory present
- Index(es):