]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/hugetlb: handle races in alloc_huge_page and hugetlb_reserve_pages
authorMike Kravetz <mike.kravetz@oracle.com>
Wed, 24 Jun 2015 23:57:58 +0000 (16:57 -0700)
committerSantosh Shilimkar <santosh.shilimkar@oracle.com>
Thu, 27 Aug 2015 23:02:53 +0000 (16:02 -0700)
commit14c1cfc3f1d7aa97653e628b150f01700ea57f6c
tree2c950b67fc7c1ee8eb80b1d41a17bc4ead7bd9c7
parent27f685c57873876bf80f8212ae39b114b72dacf2
mm/hugetlb: handle races in alloc_huge_page and hugetlb_reserve_pages

Orabug: 21652814

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.

Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Cc: David Rientjes <rientjes@google.com>
Cc: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 33039678c8da8133e30ea3250d10ae14701dae2b)
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
mm/hugetlb.c