diff --git a/mm/page_counter.c b/mm/page_counter.c index 147ff99187b8197142746ef13cc28acf77dd05cf..58903e3bfdd3be1012e24920955ff745c041e283 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -57,9 +57,13 @@ void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages) 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); } /**