Messages in this thread Patch in this message | | | Date | Tue, 21 Mar 2000 10:08:22 +0100 (CET) | From | Mikulas Patocka <> | Subject | __get_free_pages bug in 2.2 |
| |
Hi!
I looked at __get_free_pages in 2.2.15pre13 at it seems quite odd. It can return NULL for __GFP_WAIT allocations even if there's a lot of free swap space - causing processes randomly dying. In 2.0 there was an infinite loop in get_free_pages; in 2.2 isn't - could anybody explain why? The net is faster than disk - so it is possible that net interrupts eat all atomic memory.
If the machine is under heavy net load and interrupt comes just after we swapped out page, but before the return from try_to_free_pages, the interrupt can eat pages that were just swapped out and get_free_page(GFP_KERNEL or GFP_USER) fails.
When I did echo 1 1 1 >/proc/sys/vm/freepages (don't tell me I shouldn't do it - it's just for simulating stress conditions), processes were randomly dying, after applying the following patch, the machine is solid even with 1 1 1 in freepages.
Mikulas
--- linux/mm/page_alloc.c__ Thu Mar 9 15:12:31 2000 +++ linux/mm/page_alloc.c Tue Mar 21 09:50:12 2000 @@ -237,6 +237,15 @@ RMQUEUE_TYPE(order, 1); spin_unlock_irqrestore(&page_alloc_lock, flags); + if (!(current->flags & PF_MEMALLOC) && (gfp_mask & __GFP_WAIT)) { + int freed; + current->trashing_mem = 1; + current->flags |= PF_MEMALLOC; + freed = try_to_free_pages(gfp_mask); + current->flags &= ~PF_MEMALLOC; + if (freed) goto ok_to_allocate; + } + nopage: return 0; }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |