Re: [PATCH] Add sysfs removable attribute for hotplug memory remove

From: Dave Hansen
Date: Fri May 02 2008 - 13:27:54 EST



On Fri, 2008-05-02 at 09:56 -0700, Badari Pulavarty wrote:
>
> +/* Return the start of the next active pageblock after a given page */
> +static struct page *next_active_pageblock(struct page *page)
> +{
> + /* Ensure the starting page is pageblock-aligned */
> + BUG_ON(page_to_pfn(page) & (pageblock_nr_pages - 1));
> +
> + /* Move forward by at least 1 * pageblock_nr_pages */
> + int pageblocks_stride = 1;
> +
> + /* If the entire pageblock is free, move to the end of free page */
> + if (pageblock_free(page))
> + pageblocks_stride += page_order(page) - pageblock_order;
> +
> + return page + (pageblocks_stride * pageblock_nr_pages);
> +}

Do you really want that variable declared in the middle of the function?

Otherwise looks fine to me. I'm a bit worried about the whole "scan
every page in the section" thing. That could get expensive if people
ever decided to poll this file. Maybe we should tell our potential
users about that.

-- Dave

--
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/