lkml.org 
[lkml]   [2000]   [Mar]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
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/

\
 
 \ /
  Last update: 2005-03-22 13:57    [W:0.059 / U:0.328 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site