Commit 496850e5f5a372029ceb2b35c811770a9bb073b6

Authored by Nick Piggin
Committed by Linus Torvalds
1 parent f011c2dae6

mm: vmalloc failure flush fix

An initial vmalloc failure should start off a synchronous flush of lazy
areas, in case someone is in progress flushing them already, which could
cause us to return an allocation failure even if there is plenty of KVA
free.

Signed-off-by: Nick Piggin <npiggin@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 1 changed file with 13 additions and 2 deletions Side-by-side Diff

... ... @@ -522,13 +522,24 @@
522 522 }
523 523  
524 524 /*
  525 + * Kick off a purge of the outstanding lazy areas. Don't bother if somebody
  526 + * is already purging.
  527 + */
  528 +static void try_purge_vmap_area_lazy(void)
  529 +{
  530 + unsigned long start = ULONG_MAX, end = 0;
  531 +
  532 + __purge_vmap_area_lazy(&start, &end, 0, 0);
  533 +}
  534 +
  535 +/*
525 536 * Kick off a purge of the outstanding lazy areas.
526 537 */
527 538 static void purge_vmap_area_lazy(void)
528 539 {
529 540 unsigned long start = ULONG_MAX, end = 0;
530 541  
531   - __purge_vmap_area_lazy(&start, &end, 0, 0);
  542 + __purge_vmap_area_lazy(&start, &end, 1, 0);
532 543 }
533 544  
534 545 /*
... ... @@ -539,7 +550,7 @@
539 550 va->flags |= VM_LAZY_FREE;
540 551 atomic_add((va->va_end - va->va_start) >> PAGE_SHIFT, &vmap_lazy_nr);
541 552 if (unlikely(atomic_read(&vmap_lazy_nr) > lazy_max_pages()))
542   - purge_vmap_area_lazy();
  553 + try_purge_vmap_area_lazy();
543 554 }
544 555  
545 556 static struct vmap_area *find_vmap_area(unsigned long addr)