lkml.org 
[lkml]   [2013]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/9] mm, hugetlb: move up the code which check availability of free huge page
Date
Joonsoo Kim <iamjoonsoo.kim@lge.com> writes:

> We don't need to proceede the processing if we don't have any usable
> free huge page. So move this code up.

I guess you can also mention that since we are holding hugetlb_lock
hstate values can't change.


Also.

>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index e2bfbf7..d87f70b 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -539,10 +539,6 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
> struct zoneref *z;
> unsigned int cpuset_mems_cookie;
>
> -retry_cpuset:
> - cpuset_mems_cookie = get_mems_allowed();
> - zonelist = huge_zonelist(vma, address,
> - htlb_alloc_mask, &mpol, &nodemask);
> /*
> * A child process with MAP_PRIVATE mappings created by their parent
> * have no page reserves. This check ensures that reservations are
> @@ -550,11 +546,16 @@ retry_cpuset:
> */
> if (!vma_has_reserves(vma) &&
> h->free_huge_pages - h->resv_huge_pages == 0)
> - goto err;
> + return NULL;
>

If you don't do the above change, the patch will be much simpler.


> /* If reserves cannot be used, ensure enough pages are in the pool */
> if (avoid_reserve && h->free_huge_pages - h->resv_huge_pages == 0)
> - goto err;
> + return NULL;
> +

Same here.

> +retry_cpuset:
> + cpuset_mems_cookie = get_mems_allowed();
> + zonelist = huge_zonelist(vma, address,
> + htlb_alloc_mask, &mpol, &nodemask);
>
> for_each_zone_zonelist_nodemask(zone, z, zonelist,
> MAX_NR_ZONES - 1, nodemask) {
> @@ -572,10 +573,6 @@ retry_cpuset:
> if (unlikely(!put_mems_allowed(cpuset_mems_cookie) && !page))
> goto retry_cpuset;
> return page;
> -
> -err:
> - mpol_cond_put(mpol);
> - return NULL;
> }
>
> static void update_and_free_page(struct hstate *h, struct page *page)

-aneesh



\
 
 \ /
  Last update: 2013-07-15 16:42    [W:0.235 / U:0.256 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site