lkml.org 
[lkml]   [2013]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 13/20] mm, hugetlb: mm, hugetlb: unify chg and avoid_reserve to use_reserve
On Mon, Aug 26, 2013 at 06:39:35PM +0530, Aneesh Kumar K.V wrote:
> Joonsoo Kim <iamjoonsoo.kim@lge.com> writes:
>
> > Currently, we have two variable to represent whether we can use reserved
> > page or not, chg and avoid_reserve, respectively. With aggregating these,
> > we can have more clean code. This makes no functinoal difference.
> >
> > Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
> >
> > diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> > index 22ceb04..8dff972 100644
> > --- a/mm/hugetlb.c
> > +++ b/mm/hugetlb.c
> > @@ -531,8 +531,7 @@ static struct page *dequeue_huge_page_node(struct hstate *h, int nid)
> >
> > static struct page *dequeue_huge_page_vma(struct hstate *h,
> > struct vm_area_struct *vma,
> > - unsigned long address, int avoid_reserve,
> > - long chg)
> > + unsigned long address, bool use_reserve)
> > {
> > struct page *page = NULL;
> > struct mempolicy *mpol;
> > @@ -546,12 +545,10 @@ static struct page *dequeue_huge_page_vma(struct hstate *h,
> > * A child process with MAP_PRIVATE mappings created by their parent
> > * have no page reserves. This check ensures that reservations are
> > * not "stolen". The child may still get SIGKILLed
> > + * Or, when parent process do COW, we cannot use reserved page.
> > + * In this case, ensure enough pages are in the pool.
> > */
> > - if (chg && h->free_huge_pages - h->resv_huge_pages == 0)
> > - return NULL;
>
> This hunk would be much easier if you were changing.
>
> if (!vma_has_reserves(vma) &&
> h->free_huge_pages - h->resv_huge_pages == 0)
> goto err;
>
> ie, !vma_has_reserves(vma) == !use_reserve.
>
> So may be a patch rearragment would help ?. But neverthless.

I think that current form is better since use_reserve is not same as
vma_has_reserves(). I changed the call site of vma_has_reserves() to chg in
previous patch. In this patch, use_reserve in alloc_huge_page is made
by chg and avoid_reserve and is passed to dequeue_huge_page_vma(). So changing
in dequeue_huge_page_vma() is trivial.

>
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Thanks!



\
 
 \ /
  Last update: 2013-08-27 10:21    [W:0.286 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site