All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Rik van Riel <riel@conectiva.com.br>
Cc: linux-mm@kvack.org
Subject: Re: [PATCH] modified memory_pressure calculation
Date: Sun, 27 May 2001 20:24:39 +0200	[thread overview]
Message-ID: <3B114667.DCC8A2B7@colorfullife.com> (raw)
In-Reply-To: Pine.LNX.4.21.0105271451120.1907-100000@imladris.rielhome.conectiva

[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]

Rik van Riel wrote:
> 
> On Sun, 27 May 2001, Manfred Spraul wrote:
> 
> > >          if (z->free_pages < z->pages_min / 4 &&
> > > -           !(current->flags & PF_MEMALLOC))
> > > +            (in_interrupt() || !(current->flags & PF_MEMALLOC)))
> > >             continue;
> >
> > It's 'if (in_interrupt()) continue', not 'if (in_interrupt()) alloc'.
> > Currently a network card can allocate the last few pages if the
> > interrupt occurs in the context of the PF_MEMALLOC thread. I think
> > PF_MEMALLOC memory should never be available to interrupt handlers.
> 
> You're right, my mistake.
>
Ok, then the attached patch should be ok [SMP safe 'memory_pressure--' +
the change above].

I've moved the modified memory_pressure calculation into my 'not_now'
folder - not enough time for proper testing, and the change definitively
needs thorough testing.

We should take into account that the current page owner can reactivage a
page, i.e. nr_inactive_{dirty,clean}_pages overestimates the number of
really inactive pages in these lists.

My modified memory_pressure calculation would be one way to implement
that.

--
	Manfred

[-- Attachment #2: patch-PF --]
[-- Type: text/plain, Size: 738 bytes --]

diff -u 2.4/mm/page_alloc.c build-2.4/mm/page_alloc.c
--- 2.4/mm/page_alloc.c	Sat May 26 10:06:29 2001
+++ build-2.4/mm/page_alloc.c	Sun May 27 20:12:23 2001
@@ -141,8 +141,11 @@
 	 * since it's nothing important, but we do want to make sure
 	 * it never gets negative.
 	 */
-	if (memory_pressure > NR_CPUS)
-		memory_pressure--;
+	{
+		int mp = memory_pressure-1;
+		if (mp > 0)
+			memory_pressure = mp;
+	}
 }
 
 #define MARK_USED(index, order, area) \
@@ -476,7 +479,7 @@
 
 		/* XXX: is pages_min/4 a good amount to reserve for this? */
 		if (z->free_pages < z->pages_min / 4 &&
-				!(current->flags & PF_MEMALLOC))
+			(in_interrupt() || !(current->flags & PF_MEMALLOC)))
 			continue;
 		page = rmqueue(z, order);
 		if (page)

  reply	other threads:[~2001-05-27 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-27 12:30 [PATCH] modified memory_pressure calculation Manfred Spraul
2001-05-27 15:58 ` Rik van Riel
2001-05-27 17:44   ` Manfred Spraul
2001-05-27 17:51     ` Rik van Riel
2001-05-27 18:24       ` Manfred Spraul [this message]
2001-05-27 18:40         ` Rik van Riel
2001-05-28 17:29 ` Marcelo Tosatti
2001-05-28 19:20   ` Manfred Spraul
2001-05-28 18:07     ` Marcelo Tosatti

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=3B114667.DCC8A2B7@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=linux-mm@kvack.org \
    --cc=riel@conectiva.com.br \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.