linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@conectiva.com.br>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Mike Galbraith <mikeg@wen-online.de>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: [PATCH] add PF_MEMALLOC to __alloc_pages()
Date: Wed, 3 Jan 2001 13:03:27 -0200 (BRDT)	[thread overview]
Message-ID: <Pine.LNX.4.21.0101031258070.1403-100000@duckman.distro.conectiva> (raw)

Hi Linus, Alan, Mike,

the following patch sets PF_MEMALLOC for the current task
in __alloc_pages() to avoid infinite recursion when we try
to free memory from __alloc_pages().

Please apply the patch below, which fixes this (embarrasing)
bug...

regards,

Rik
--
Hollywood goes for world dumbination,
	Trailer at 11.

		http://www.surriel.com/
http://www.conectiva.com/	http://distro.conectiva.com.br/



--- linux-2.4.0-prerelease/mm/page_alloc.c.orig	Wed Jan  3 12:52:13 2001
+++ linux-2.4.0-prerelease/mm/page_alloc.c	Wed Jan  3 13:01:19 2001
@@ -427,7 +427,9 @@
 		if (order > 0 && (gfp_mask & __GFP_WAIT)) {
 			zone = zonelist->zones;
 			/* First, clean some dirty pages. */
+			current->flags |= PF_MEMALLOC;
 			page_launder(gfp_mask, 1);
+			current->flags &= ~PF_MEMALLOC;
 			for (;;) {
 				zone_t *z = *(zone++);
 				if (!z)
@@ -475,7 +477,9 @@
 		 * free ourselves...
 		 */
 		} else if (gfp_mask & __GFP_WAIT) {
+			current->flags |= PF_MEMALLOC;
 			try_to_free_pages(gfp_mask);
+			current->flags &= ~PF_MEMALLOC;
 			memory_pressure++;
 			if (!order)
 				goto try_again;

--
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.eu.org/Linux-MM/

             reply	other threads:[~2001-01-03 15:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-03 15:03 Rik van Riel [this message]
2001-01-03 23:03 ` Zlatko Calusic
2001-01-04 13:34   ` 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=Pine.LNX.4.21.0101031258070.1403-100000@duckman.distro.conectiva \
    --to=riel@conectiva.com.br \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mikeg@wen-online.de \
    --cc=torvalds@transmeta.com \
    /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