From: Rik van Riel <riel@conectiva.com.br>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Linus Torvalds <torvalds@transmeta.com>,
linux-mm@kvack.org, los@lsdb.bwl.uni-mannheim.de
Subject: [PATCH] -ac21 don't set referenced bit
Date: Mon, 19 Jun 2000 12:36:53 -0300 (BRST) [thread overview]
Message-ID: <Pine.LNX.4.21.0006191231300.13200-100000@duckman.distro.conectiva> (raw)
Hi,
the patch below, against -ac21, does two things:
1) do not set the referenced bit when we add a page to
one of the caches ... this allows us to distinguish
between pages which are used again and pages which
aren't [keeps performance nice in the presence of
streaming IO?]
2) in do_try_to_free_pages, if we make progress on a
priority level, do not decrease priority when we loop
again ... this should allow us to a) free more pages
since we can keep looping back as long as progress is
being made and b) maybe keep a better balance between
shrink_mmap and swap_out since we have a better chance
to never reach the "gimme memory now or I'll rape your
wife and kill your children" level
[and we don't want to get there since arriving at that
priority level means we'll be doing worse page aging
and forcing the issue ... potentially making things worse
for the next time]
With this patch I'm seeing higher application performance and
lower kswapd cpu usage...
regards,
Rik
--
The Internet is not a network of computers. It is a network
of people. That is its real strength.
Wanna talk about the kernel? irc.openprojects.net / #kernelnewbies
http://www.conectiva.com/ http://www.surriel.com/
--- mm/filemap.c.orig Mon Jun 19 11:32:32 2000
+++ mm/filemap.c Mon Jun 19 11:33:21 2000
@@ -564,7 +564,7 @@
/*
* This adds a page to the page cache, starting out as locked,
- * owned by us, referenced, but not uptodate and with no errors.
+ * owned by us, but not uptodate and with no errors.
*/
static inline void __add_to_page_cache(struct page * page,
struct address_space *mapping, unsigned long offset,
@@ -576,8 +576,8 @@
if (PageLocked(page))
BUG();
- flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error) | (1 << PG_dirty));
- page->flags = flags | (1 << PG_locked) | (1 << PG_referenced);
+ flags = page->flags & ~((1 << PG_uptodate) | (1 << PG_error));
+ page->flags = flags | (1 << PG_locked);
page_cache_get(page);
page->index = offset;
add_page_to_inode_queue(mapping, page);
--- mm/swap_state.c.orig Mon Jun 19 11:32:32 2000
+++ mm/swap_state.c Mon Jun 19 11:33:59 2000
@@ -58,8 +58,8 @@
BUG();
if (page->mapping)
BUG();
- flags = page->flags & ~((1 << PG_error) | (1 << PG_dirty));
- page->flags = flags | (1 << PG_referenced) | (1 << PG_uptodate);
+ flags = page->flags & ~(1 << PG_error);
+ page->flags = flags | (1 << PG_uptodate);
add_to_page_cache_locked(page, &swapper_space, entry.val);
}
--- mm/vmscan.c.orig Mon Jun 19 11:32:32 2000
+++ mm/vmscan.c Mon Jun 19 11:47:10 2000
@@ -444,6 +444,7 @@
int priority;
int count = FREE_COUNT;
int swap_count = 0;
+ int made_progress = 0;
int ret = 0;
/* Always trim SLAB caches when memory gets low. */
@@ -452,7 +453,7 @@
priority = 64;
do {
while (shrink_mmap(priority, gfp_mask)) {
- ret = 1;
+ made_progress = 1;
if (!--count)
goto done;
}
@@ -468,11 +469,11 @@
count -= shrink_dcache_memory(priority, gfp_mask);
count -= shrink_icache_memory(priority, gfp_mask);
if (count <= 0) {
- ret = 1;
+ made_progress = 1;
goto done;
}
while (shm_swap(priority, gfp_mask)) {
- ret = 1;
+ made_progress = 1;
if (!--count)
goto done;
}
@@ -493,11 +494,25 @@
*/
swap_count += count;
while (swap_out(priority, gfp_mask)) {
+ made_progress = 1;
if (--swap_count < 0)
break;
}
- } while (--priority >= 0);
+ /*
+ * If we made progress at the current priority, the next
+ * loop will also be done at this priority level. There's
+ * absolutely no reason to drop to a lower priority and
+ * potentially upset the balance between shrink_mmap and
+ * swap_out.
+ */
+ if (made_progress) {
+ made_progress = 0;
+ ret = 1;
+ } else {
+ priority--;
+ }
+ } while (priority >= 0);
/* Always end on a shrink_mmap.. */
while (shrink_mmap(0, gfp_mask)) {
--
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/
next reply other threads:[~2000-06-19 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-19 15:36 Rik van Riel [this message]
2000-06-19 16:22 ` Andrea Arcangeli
2000-06-19 17:00 ` Rik van Riel
2000-06-19 17:10 ` Andrea Arcangeli
2000-06-19 17:51 ` Rik van Riel
2000-06-19 18:06 ` Andrea Arcangeli
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.0006191231300.13200-100000@duckman.distro.conectiva \
--to=riel@conectiva.com.br \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-mm@kvack.org \
--cc=los@lsdb.bwl.uni-mannheim.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