--- a/mm/page_counter.c~mm-page_counter-mitigate-consequences-of-a-page_counter-underflow +++ a/mm/page_counter.c @@ -52,9 +52,13 @@ void page_counter_cancel(struct page_cou long new; new = atomic_long_sub_return(nr_pages, &counter->usage); - propagate_protected_usage(counter, new); /* More uncharges than charges? */ - WARN_ON_ONCE(new < 0); + if (WARN_ONCE(new < 0, "page_counter underflow: %ld nr_pages=%lu\n", + new, nr_pages)) { + new = 0; + atomic_long_set(&counter->usage, new); + } + propagate_protected_usage(counter, new); } /**