linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <H.H.vanRiel@fys.ruu.nl>
To: linux-mm <linux-mm@kvack.org>
Cc: "Stephen C. Tweedie" <sct@dcs.ed.ac.uk>, werner@suse.de
Subject: memory limitation test kit (tm) :-)
Date: Thu, 26 Feb 1998 13:58:05 +0100 (MET)	[thread overview]
Message-ID: <Pine.LNX.3.91.980226135506.30101A-100000@mirkwood.dummy.home> (raw)

Hi there,

I've made a 'very preliminary' test patch to test
whether memory limitation / quotation might work.
It's untested, untunable and plain wrong, but nevertheless
I'd like you all to take a look at it and point out things
that I've forgotten in the limitation code...

-----------------------------------------------------
--- linux2188orig/mm/page_alloc.c	Thu Feb 26 13:51:16 1998
+++ linux-2.1.88/mm/page_alloc.c	Thu Feb 26 13:09:17 1998
@@ -26,6 +26,7 @@
 #include <asm/bitops.h>
 #include <asm/pgtable.h>
 #include <asm/spinlock.h>
+#include <asm/smp_lock.h> /* for (un)lock_kernel() */
 
 int nr_swap_pages = 0;
 int nr_free_pages = 0;
@@ -328,7 +329,20 @@
 void swap_in(struct task_struct * tsk, struct vm_area_struct * vma,
 	pte_t * page_table, unsigned long entry, int write_access)
 {
-	unsigned long page = __get_free_page(GFP_KERNEL);
+	int i = 0;
+	unsigned long page = 0;
+	static int swap_out_process(struct task_struct *, int);
+
+	if (vma->vm_mm->rss > num_physpages / 2 && nr_free_pages < 
+			free_pages_high) {
+		lock_kernel();
+		for (i = vma->vm_mm->rss; i > 0; i--)
+			if (swap_out_process(tsk, __GFP_IO|__GFP_WAIT))
+				break;
+		unlock_kernel();
+	}
+
+	page = __get_free_page(GFP_KERNEL);
 
 	if (pte_val(*page_table) != entry) {
 		free_page(page);
------------------------------------------------------------

Rik.
+-----------------------------+------------------------------+
| For Linux mm-patches, go to | "I'm busy managing memory.." |
| my homepage (via LinuxHQ).  | H.H.vanRiel@fys.ruu.nl       |
| ...submissions welcome...   | http://www.fys.ruu.nl/~riel/ |
+-----------------------------+------------------------------+

             reply	other threads:[~1998-02-26 14:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-26 12:58 Rik van Riel [this message]
1998-02-26 15:32 ` Rik van Riel
1998-02-26 19:10 ` Dr. Werner Fink
1998-02-26 19:29   ` Rik van Riel
1998-02-26 22:53 ` Stephen C. Tweedie
1998-02-26 23:29   ` 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.3.91.980226135506.30101A-100000@mirkwood.dummy.home \
    --to=h.h.vanriel@fys.ruu.nl \
    --cc=linux-mm@kvack.org \
    --cc=sct@dcs.ed.ac.uk \
    --cc=werner@suse.de \
    /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