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

Re: [Xen-devel] [PATCH v4] memory_hotplug: Free pages as higher order



On Wed 03-10-18 19:09:39, Arun KS wrote:
[...]
> +static int online_pages_blocks(unsigned long start, unsigned long nr_pages)
> +{
> +     unsigned long end = start + nr_pages;
> +     int order, ret, onlined_pages = 0;
> +
> +     while (start < end) {
> +             order = min(MAX_ORDER - 1UL, __ffs(start));
> +
> +             while (start + (1UL << order) > end)
> +                     order--;

this really made me scratch my head. Wouldn't it be much simpler to do
the following?
                order = min(MAX_ORDER - 1, get_order(end - start))?

> +
> +             ret = (*online_page_callback)(pfn_to_page(start), order);
> +             if (!ret)
> +                     onlined_pages += (1UL << order);
> +             else if (ret > 0)
> +                     onlined_pages += ret;
> +
> +             start += (1UL << order);
> +     }
> +     return onlined_pages;
>  }
[...]
> -static void __init __free_pages_boot_core(struct page *page, unsigned int 
> order)
> +void __free_pages_core(struct page *page, unsigned int order)
>  {
>       unsigned int nr_pages = 1 << order;
>       struct page *p = page;
>       unsigned int loop;
>  
> -     prefetchw(p);
> -     for (loop = 0; loop < (nr_pages - 1); loop++, p++) {
> -             prefetchw(p + 1);
> +     for (loop = 0; loop < nr_pages; loop++, p++) {
>               __ClearPageReserved(p);
>               set_page_count(p, 0);
>       }
> -     __ClearPageReserved(p);
> -     set_page_count(p, 0);
>  
>       page_zone(page)->managed_pages += nr_pages;
>       set_page_refcounted(page);

I think this is wort a separate patch as it is unrelated to the patch.

-- 
Michal Hocko
SUSE Labs

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.