Re: Linux-2.4.5

Ben LaHaise
2001-05-26T02:12:20Z

On Sat, 26 May 2001, Andrea Arcangeli wrote:

> Now if you send some debugging info with deadlocks you gets with 2.4.5
> vanilla I will be certainly interested to found their source. Also Rik
> just said to have a fix for other bugs in that area, I didn't checked
> that part.

In the red hat tree, we fixed the problem by adding __GFP_FAIL to
GFP_BUFFER, as well as adding a yield to alloc_pages. Think of what
happens when you try to allocate a buffer_head to swap out a page when
you're out of memory. See below.

-ben

diff -ur v2.4.4-ac9/include/linux/mm.h work/include/linux/mm.h
--- v2.4.4-ac9/include/linux/mm.h Mon May 14 15:22:17 2001
+++ work/include/linux/mm.h Mon May 14 18:33:21 2001
@@ -528,7 +528,7 @@

#define GFP_BOUNCE (__GFP_HIGH | __GFP_FAIL)
-#define GFP_BUFFER (__GFP_HIGH | __GFP_WAIT)
+#define GFP_BUFFER (__GFP_HIGH | __GFP_FAIL | __GFP_WAIT)
#define GFP_ATOMIC (__GFP_HIGH)
#define GFP_USER ( __GFP_WAIT | __GFP_IO)
#define GFP_HIGHUSER ( __GFP_WAIT | __GFP_IO | __GFP_HIGHMEM)
diff -ur v2.4.4-ac9/mm/vmscan.c work/mm/vmscan.c
--- v2.4.4-ac9/mm/vmscan.c Mon May 14 14:57:00 2001
+++ work/mm/vmscan.c Mon May 14 16:43:05 2001
@@ -636,6 +636,12 @@
*/
shortage = free_shortage();
if (can_get_io_locks && !launder_loop && shortage) {
+ if (gfp_mask & __GFP_WAIT) {
+ __set_current_state(TASK_RUNNING);
+ current->policy |= SCHED_YIELD;
+ schedule();
+ }
+
launder_loop = 1;

/*