patch-2.2.0-pre5 linux/mm/page_alloc.c
Next file: linux/mm/vmscan.c
Previous file: linux/mm/memory.c
Back to the patch index
Back to the overall index
- Lines: 32
- Date:
Tue Jan 5 17:55:58 1999
- Orig file:
v2.2.0-pre4/linux/mm/page_alloc.c
- Orig date:
Mon Jan 4 15:08:18 1999
diff -u --recursive --new-file v2.2.0-pre4/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -245,6 +245,14 @@
}
/*
+ * If this is a recursive call, we'd better
+ * do our best to just allocate things without
+ * further thought.
+ */
+ if (current->flags & PF_MEMALLOC)
+ goto ok_to_allocate;
+
+ /*
* Avoid going back-and-forth between allocating
* memory and trying to free it. If we get into
* a bad memory situation, we're better off trying
@@ -271,8 +279,14 @@
* memory.
*/
current->trashing_memory = 1;
- if (!try_to_free_pages(gfp_mask, SWAP_CLUSTER_MAX) && !(gfp_mask & (__GFP_MED | __GFP_HIGH)))
- goto nopage;
+ {
+ int freed;
+ current->flags |= PF_MEMALLOC;
+ freed = try_to_free_pages(gfp_mask, SWAP_CLUSTER_MAX);
+ current->flags &= ~PF_MEMALLOC;
+ if (!freed && !(gfp_mask & (__GFP_MED | __GFP_HIGH)))
+ goto nopage;
+ }
}
ok_to_allocate:
spin_lock_irqsave(&page_alloc_lock, flags);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov