linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Roger Larsson <roger.larsson@norran.net>
To: linux-mm@kvack.org
Subject: [PATCH] __alloc_pages_limit pages_min
Date: Wed, 22 Aug 2001 17:12:40 +0200	[thread overview]
Message-ID: <200108221519.f7MFJOR19243@maila.telia.com> (raw)

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/

             reply	other threads:[~2001-08-22 15:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-22 15:12 Roger Larsson [this message]
2001-08-22 17:01 ` Rik van Riel
2001-08-22 20:58   ` Roger Larsson
2001-08-22 21:10     ` Rik van Riel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200108221519.f7MFJOR19243@maila.telia.com \
    --to=roger.larsson@norran.net \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox