linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] __alloc_pages_limit pages_min
@ 2001-08-22 15:12 Roger Larsson
  2001-08-22 17:01 ` Rik van Riel
  0 siblings, 1 reply; 4+ messages in thread
From: Roger Larsson @ 2001-08-22 15:12 UTC (permalink / raw)
  To: linux-mm

Hi all,

If __alloc_pages_limit is called with PAGES_HIGH and direct_reclaim.
It might alloc the last free page of a zone....

How:
* inactive_clean_pages >= pages_high

first if gives

if (free_pages + inactive_clean >= pages_high) => true

No direct_reclaim gives no attempt to call reclaim_page.
Instead rmqueue will be called...
now we have one page less - run it again...
free_pages will be decremented until zero...

Last page gone in a at PAGES_HIGH alloc!!!

Note: reclaim_page will fix this situation direct it is allowed to
run since it is kicked in __alloc_pages. But since we cannot
guarantee that this will never happen...

/RogerL

this patch is against 2.4.8-pre3 as it was my current kernel.
(searching for a USB storage bug...)
*******************************************
Patch prepared by: roger.larsson@norran.net

--- linux/mm/page_alloc.c.orig	Wed Aug 22 13:36:57 2001
+++ linux/mm/page_alloc.c	Wed Aug 22 13:50:31 2001
@@ -256,8 +256,9 @@
 			/* If possible, reclaim a page directly. */
 			if (direct_reclaim)
 				page = reclaim_page(z);
-			/* If that fails, fall back to rmqueue. */
-			if (!page)
+			/* If that fails, fall back to rmqueue, but do never
+			*  go below free_pages for any zone*/
+			if (!page && z->free_pages >= z->pages_min)
 				page = rmqueue(z, order);
 			if (page)
 				return page;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2001-08-22 21:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 15:12 [PATCH] __alloc_pages_limit pages_min Roger Larsson
2001-08-22 17:01 ` Rik van Riel
2001-08-22 20:58   ` Roger Larsson
2001-08-22 21:10     ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox