On Sun 08-01-17 11:08:30, Mike Kravetz wrote: [...] > diff --git a/mm/hugetlb.c b/mm/hugetlb.c > index 3edb759..221abdc 100644 > --- a/mm/hugetlb.c > +++ b/mm/hugetlb.c > @@ -1783,12 +1783,9 @@ static void return_unused_surplus_pages(struct hstate *h, > { > unsigned long nr_pages; > > - /* Uncommit the reservation */ > - h->resv_huge_pages -= unused_resv_pages; > - > /* Cannot return gigantic pages currently */ > if (hstate_is_gigantic(h)) > - return; > + goto out; > > nr_pages = min(unused_resv_pages, h->surplus_huge_pages); > > @@ -1801,10 +1798,16 @@ static void return_unused_surplus_pages(struct hstate *h, > * on-line nodes with memory and will handle the hstate accounting. > */ > while (nr_pages--) { > + h->resv_huge_pages--; > + unused_resv_pages--; > if (!free_pool_huge_page(h, &node_states[N_MEMORY], 1)) > - break; > + goto out; > cond_resched_lock(&hugetlb_lock); > } > + > +out: > + /* Fully uncommit the reservation */ > + h->resv_huge_pages -= unused_resv_pages; > } OK, this would handle the case I was wondering about. It really deserves a big fat comment explaining when this can happen. Other than that this looks OK and safe enough for the stable after second look into the code. Thanks! -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>