lkml.org 
[lkml]   [2015]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH 2/2] mm/hugetlb: handle races in alloc_huge_page and hugetlb_reserve_pages
    On Mon, 18 May 2015 10:49:09 -0700 Mike Kravetz <mike.kravetz@oracle.com> wrote:

    > alloc_huge_page and hugetlb_reserve_pages use region_chg to
    > calculate the number of pages which will be added to the reserve
    > map. Subpool and global reserve counts are adjusted based on
    > the output of region_chg. Before the pages are actually added
    > to the reserve map, these routines could race and add fewer
    > pages than expected. If this happens, the subpool and global
    > reserve counts are not correct.
    >
    > Compare the number of pages actually added (region_add) to those
    > expected to added (region_chg). If fewer pages are actually added,
    > this indicates a race and adjust counters accordingly.
    >
    > --- a/mm/hugetlb.c
    > +++ b/mm/hugetlb.c
    > @@ -1374,13 +1374,16 @@ static long vma_commit_reservation(struct hstate *h,
    > return 0;
    > }
    >
    > +/* Forward declaration */
    > +static int hugetlb_acct_memory(struct hstate *h, long delta);
    > +

    Its best to put forward declarations at top-of-file. Otherwise we can
    end up with multiple forward declarations if someone later needs the
    symbol at an earlier site in the file.

    Had you done that you might have noticed that hugetlb_acct_memory() was
    already declared ;)

    --- a/mm/hugetlb.c~mm-hugetlb-handle-races-in-alloc_huge_page-and-hugetlb_reserve_pages-fix
    +++ a/mm/hugetlb.c
    @@ -1475,9 +1475,6 @@ static long vma_commit_reservation(struc
    return 0;
    }

    -/* Forward declaration */
    -static int hugetlb_acct_memory(struct hstate *h, long delta);
    -
    static struct page *alloc_huge_page(struct vm_area_struct *vma,
    unsigned long addr, int avoid_reserve)
    {
    _



    \
     
     \ /
      Last update: 2015-05-22 02:01    [W:3.584 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site