Re: [PATCH] Tight check of pfn_valid on sparsemem - v4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Jul 2010 03:12:38 -0500
Milton Miller <miltonm@xxxxxxx> wrote:

> > > > > +/*
> > > > > + * Fill pg->private on valid mem_map with page itself.
> > > > > + * pfn_valid() will check this later. (see include/linux/mmzone.h)
> > > > > + * Every arch for supporting hole of mem_map should call
> > > > > + * mark_valid_memmap(start, end). please see usage in ARM.
> > > > > + */
> > > > > +void mark_valid_memmap(unsigned long start, unsigned long end)
> > > > > +{
> > > > > +	struct mem_section *ms;
> > > > > +	unsigned long pos, next;
> > > > > +	struct page *pg;
> > > > > +	void *memmap, *mapend;
> > > > > +
> > > > > +	for (pos = start; pos < end; pos = next) {
> > > > > +		next = (pos + PAGES_PER_SECTION) & PAGE_SECTION_MASK;
> > > > > +		ms = __pfn_to_section(pos);
> > > > > +		if (!valid_section(ms))
> > > > > +			continue;
> > > > > +	
> > > > > +		for (memmap = (void*)pfn_to_page(pos),
> > > > > +					/* The last page in section */
> > > > > +					mapend = pfn_to_page(next-1);
> > > > > +				memmap < mapend; memmap += PAGE_SIZE) {
> > > > > +			pg = virt_to_page(memmap);
> > > > > +			set_page_private(pg, (unsigned long)pg);
> > > > > +		}
> > > > > +	}
> > > > > +}
> 
> Hmm, this loop would need to change for sections.   And sizeof(struct
> page) % PAGE_SIZE may not be 0, so we want a global symbol for sparsemem
> too. 
IIUC, sizeof(struct page) % PAGE_SIZE is not a probelm.


> Perhaps the mem_section array.  Using a symbol that is part of
> the model pre-checks can remove a global symbol lookup and has the side
> effect of making sure our pfn_valid is for the right model.
> 

But yes, maybe it's good to make use of a fixed-(magic)-value.


Tanks,
-Kame



--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]