linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Juan J. Quintela" <quintela@fi.udc.es>
To: Arjan van de Ven <arjan@fenrus.demon.nl>
Cc: Linus Torvalds <torvalds@transmeta.com>, linux-mm@kvack.org
Subject: Re: pre8: where has the anti-hog code gone?
Date: 13 May 2000 23:59:42 +0200	[thread overview]
Message-ID: <yttn1lu2jsh.fsf@vexeta.dc.fi.udc.es> (raw)
In-Reply-To: arjan@fenrus.demon.nl's message of "Sat, 13 May 2000 23:24:50 +0200 (CEST)"

>>>>> "arjan" == Arjan van de Ven <arjan@fenrus.demon.nl> writes:

Hi

arjan> I have been looking at it right now, and I think there are a few issues:

arjan> 1) shrink_[id]node_memory always return 0, even if they free memory
arjan> 2) shrink_inode_memory is broken for priority == 0

arjan> 2) is easily fixable, but even with that fixed, my traces show that, for the
arjan> mmap002 test, shrink_mmap fails just before the OOM.

After discussing with Arjan that changes. And later discussing with riel
about that we _need_ to swap_out more pages that we scan, because some
of the pages can be reclaimed, I made the following patch.  Now things
go better, not well, but better.

Now mmap002 finish sometimes, (where some is a low number).

The important part of the patch is the change in SWAP_COUNT, only
changing that number, I get better behaviour (thanks riel for
suggesting that).

The other patch is to make shrink_[di]cache to behave like the rest of
the shrink* functions and do the *maximum* effort when priority = 0,
not when priority = 1.  This last change improves things only a bit.

Comments?

Later, Juan.

diff -u -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude pre9-1/fs/dcache.c testing/fs/dcache.c
--- pre9-1/fs/dcache.c	Fri May 12 01:11:40 2000
+++ testing/fs/dcache.c	Sat May 13 21:58:41 2000
@@ -497,10 +497,8 @@
  */
 int shrink_dcache_memory(int priority, unsigned int gfp_mask)
 {
-	int count = 0;
+	int count = dentry_stat.nr_unused / (priority + 1);
 	lock_kernel();
-	if (priority)
-		count = dentry_stat.nr_unused / priority;
 	prune_dcache(count);
 	unlock_kernel();
 	/* FIXME: kmem_cache_shrink here should tell us
diff -u -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude pre9-1/fs/inode.c testing/fs/inode.c
--- pre9-1/fs/inode.c	Fri May 12 01:11:40 2000
+++ testing/fs/inode.c	Sat May 13 22:35:51 2000
@@ -411,11 +411,10 @@
 	(((inode)->i_state | (inode)->i_data.nrpages) == 0)
 #define INODE(entry)	(list_entry(entry, struct inode, i_list))
 
-void prune_icache(int goal)
+void prune_icache(int count)
 {
 	LIST_HEAD(list);
 	struct list_head *entry, *freeable = &list;
-	int count = 0;
 	struct inode * inode;
 
 	spin_lock(&inode_lock);
@@ -440,11 +439,10 @@
 		INIT_LIST_HEAD(&inode->i_hash);
 		list_add(tmp, freeable);
 		inode->i_state |= I_FREEING;
-		count++;
-		if (!--goal)
+		inodes_stat.nr_unused--;
+		if (!--count)
 			break;
 	}
-	inodes_stat.nr_unused -= count;
 	spin_unlock(&inode_lock);
 
 	dispose_list(freeable);
@@ -452,10 +450,7 @@
 
 int shrink_icache_memory(int priority, int gfp_mask)
 {
-	int count = 0;
-		
-	if (priority)
-		count = inodes_stat.nr_unused / priority;
+	int count = inodes_stat.nr_unused / (priority + 1);
 	prune_icache(count);
 	/* FIXME: kmem_cache_shrink here should tell us
 	   the number of pages freed, and it should
diff -u -urN --exclude-from=/home/lfcia/quintela/work/kernel/exclude pre9-1/mm/vmscan.c testing/mm/vmscan.c
--- pre9-1/mm/vmscan.c	Sat May 13 19:30:06 2000
+++ testing/mm/vmscan.c	Sat May 13 23:17:22 2000
@@ -430,7 +430,7 @@
  * latency.
  */
 #define FREE_COUNT	8
-#define SWAP_COUNT	8
+#define SWAP_COUNT	16
 static int do_try_to_free_pages(unsigned int gfp_mask)
 {
 	int priority;





-- 
In theory, practice and theory are the same, but in practice they 
are different -- Larry McVoy
--
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:[~2000-05-13 21:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-12 23:37 Rik van Riel
2000-05-13 15:28 ` Linus Torvalds
2000-05-13 18:14   ` Juan J. Quintela
2000-05-13 21:24   ` Arjan van de Ven
2000-05-13 21:59     ` Juan J. Quintela [this message]
2000-05-14  3:41     ` Linus Torvalds
2000-05-14  8:45       ` Arjan van de Ven
2000-05-15  1:37         ` Linus Torvalds
2000-05-14 10:52   ` Ingo Molnar
2000-05-14 10:55     ` Ingo Molnar
2000-05-14 11:28     ` Ingo Molnar
2000-05-14 12:01       ` Rik van Riel
2000-05-14 12:12         ` Ingo Molnar
2000-05-14 12:19         ` Ingo Molnar
2000-05-15 14:50 Mark_H_Johnson.RTS
2000-05-15 15:58 ` Rik van Riel
2000-05-15 16:01 ` Linus Torvalds

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=yttn1lu2jsh.fsf@vexeta.dc.fi.udc.es \
    --to=quintela@fi.udc.es \
    --cc=arjan@fenrus.demon.nl \
    --cc=linux-mm@kvack.org \
    --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