Re: [PATCH] Make is_mem_section_removable more conformable withofflining code

From: Michal Hocko
Date: Thu Sep 02 2010 - 10:39:47 EST


On Thu 02-09-10 23:19:18, Hiroyuki Kamezawa wrote:
[...]
> > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
> > index 6e6e626..0bd941b 100644
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -669,6 +669,30 @@ unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
> > ?*/
> > ?#define zone_idx(zone) ? ? ? ? ((zone) - (zone)->zone_pgdat->node_zones)
> >
> > +#ifdef CONFIG_MEMORY_HOTREMOVE
> > +/*
> > + * A free or LRU pages block are removable
> > + * Do not use MIGRATE_MOVABLE because it can be insufficient and
> > + * other MIGRATE types are tricky.
> > + */
> > +static inline bool is_page_removable(struct page *page)
> > +{
> > + ? ? ? int page_block = 1 << pageblock_order;
> > + ? ? ? for (page_block > 0) {
>
> for ?

Bahh. The old and half backed patch. See the up-to-date one bellow.

> > + ? ? ? ? ? ? ? if (PageBuddy(page)) {
> > + ? ? ? ? ? ? ? ? ? ? ? page_block -= page_order(page);
> > + ? ? ? ? ? ? ? }else if (PageLRU(page))
> > + ? ? ? ? ? ? ? ? ? ? ? page_block--;
> > + ? ? ? ? ? ? ? else
> > + ? ? ? ? ? ? ? ? ? ? ? return false;
> > + ? ? ? }
> > +
> > + ? ? ? return true;
> > +}
>
> Hmm. above for is intending to check all pages in the block ?

Yes, by their orders.

> I'll look into details, tomorrow.

Thanks!

---