Re: [PATCH 2/2] Make is_mem_section_removable more conformablewith offlining code v3
From: Michal Hocko
Date: Mon Sep 06 2010 - 05:16:43 EST
On Sat 04-09-10 10:55:16, Wu Fengguang wrote:
> On Fri, Sep 03, 2010 at 07:42:13PM +0800, Michal Hocko wrote:
>
> > +/*
> > + * A free or LRU pages block are removable
> > + * Do not use MIGRATE_MOVABLE because it can be insufficient and
> > + * other MIGRATE types are tricky.
> > + * Do not hold zone->lock as this is used from user space by the
> > + * sysfs interface.
> > + */
> > +bool is_page_removable(struct page *page)
> > +{
> > + int page_block = 1 << pageblock_order;
> > +
> > + /* All pages from the MOVABLE zone are movable */
> > + if (zone_idx(page_zone(page)) == ZONE_MOVABLE)
> > + return true;
> > +
> > + while (page_block > 0) {
> > + int order = 0;
> > +
> > + if (pfn_valid_within(page_to_pfn(page))) {
> > + if (!page_count(page) && PageBuddy(page)) {
>
> PageBuddy() is true only for the head page and false for all tail
> pages. So when is_page_removable() is given a random 4k page
> (get_any_page() will exactly do that), the above test is not enough.
OK, I haven't noticed that set_migratetype_isolate (which calls
is_page_removable in my patch - bellow) is called from that context.
is_mem_section_removable goes by pageblocks so we are always checking
the head.
Anyway, I can see why you are counting unmovable pages in your patch
now. You need it for notifier logic, so my approach is not usable.
Thanks!
--
Michal Hocko
L3 team
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/