From: Roger Larsson <roger.larsson@norran.net>
To: Linus Torvalds <torvalds@transmeta.com>,
"linux-kernel@vger.rutgers.edu" <linux-kernel@vger.rutgers.edu>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: [PATCH] test5-1 vm fix
Date: Sun, 16 Jul 2000 01:07:37 +0200 [thread overview]
Message-ID: <3970EEB9.F27DB35C@norran.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 547 bytes --]
Hi,
Since I am responsible for messing up some aspects of vm
(when fixing others)
here is a patch that tries to solve the introduced problems.
* no more periodic wake up of kswapd - not needed anymore
* no more freeing all zones to (free_pages > pages_high)
* always wakes kswapd up after try_to_free_pages
* always wakes kswapd up when (free_pages < pages_low)
* remove keep_kswapd_awake() function - not needed anymore
/RogerL
Note: Includes Riels "[PATCH] 2.4.0-test4 kswapd rebalancing fix"
--
Home page:
http://www.norran.net/nra02596/
[-- Attachment #2: patch-2.4.0-test5-1-vmfix.2 --]
[-- Type: text/plain, Size: 2917 bytes --]
--- linux/mm/vmscan.c.orig Sat Jul 15 23:44:34 2000
+++ linux/mm/vmscan.c Sun Jul 16 00:57:00 2000
@@ -439,26 +439,6 @@ static inline int memory_pressure(void)
return 0;
}
-/*
- * Check if there recently has been memory pressure (zone_wake_kswapd)
- */
-static inline int keep_kswapd_awake(void)
-{
- pg_data_t *pgdat = pgdat_list;
-
- do {
- int i;
- for(i = 0; i < MAX_NR_ZONES; i++) {
- zone_t *zone = pgdat->node_zones+ i;
- if (zone->size &&
- zone->zone_wake_kswapd)
- return 1;
- }
- pgdat = pgdat->node_next;
- } while (pgdat);
-
- return 0;
-}
/*
* We need to make the locks finer granularity, but right
@@ -499,7 +479,7 @@ static int do_try_to_free_pages(unsigned
/* not (been) low on memory - it is
* pointless to try to swap out.
*/
- if (!keep_kswapd_awake())
+ if (!memory_pressure())
goto done;
/* Try to get rid of some shared memory pages.. */
@@ -520,7 +500,7 @@ static int do_try_to_free_pages(unsigned
* if (count <= 0)
* goto done;
*/
- if (!keep_kswapd_awake())
+ if (!memory_pressure())
goto done;
while (shm_swap(priority, gfp_mask)) {
@@ -595,11 +575,8 @@ int kswapd(void *unused)
tsk->flags |= PF_MEMALLOC;
for (;;) {
- if (!keep_kswapd_awake()) {
- /* wake up regulary to do an early attempt too free
- * pages - pages will not actually be freed.
- */
- interruptible_sleep_on_timeout(&kswapd_wait, HZ);
+ if (!memory_pressure()) {
+ interruptible_sleep_on(&kswapd_wait);
}
do_try_to_free_pages(GFP_KSWAPD);
@@ -631,18 +608,18 @@ int try_to_free_pages(unsigned int gfp_m
retval = do_try_to_free_pages(gfp_mask);
current->flags &= ~PF_MEMALLOC;
}
- else {
- /* make sure kswapd runs */
- if (waitqueue_active(&kswapd_wait))
- wake_up_interruptible(&kswapd_wait);
- }
+
+ /* someone needed memory that kswapd had not provided
+ * make sure kswapd runs, should not happen often */
+ if (waitqueue_active(&kswapd_wait))
+ wake_up_interruptible(&kswapd_wait);
return retval;
}
static int __init kswapd_init(void)
{
- printk("Starting kswapd v1.6\n");
+ printk("Starting kswapd v1.7\n");
swap_setup();
kernel_thread(kswapd, NULL, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
return 0;
--- linux/mm/page_alloc.c.orig Sat Jul 15 23:44:46 2000
+++ linux/mm/page_alloc.c Sat Jul 15 23:55:55 2000
@@ -275,8 +275,16 @@ struct page * __alloc_pages(zonelist_t *
break;
if (!z->low_on_memory) {
struct page *page = rmqueue(z, order);
- if (z->free_pages < z->pages_min)
+ if (z->free_pages < z->pages_min) {
z->low_on_memory = 1;
+ /* Suppose all zones have zone_wake_kswapd set
+ * but kswapd has stopped running due to
+ * no memory_pressure()
+ */
+ z->zone_wake_kswapd = 1; /* should be set already */
+ if (waitqueue_active(&kswapd_wait))
+ wake_up_interruptible(&kswapd_wait);
+ }
if (page)
return page;
}
next reply other threads:[~2000-07-15 23:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-15 23:07 Roger Larsson [this message]
2000-07-16 8:16 ` [PATCH] test5-1 vm fix Mike Galbraith
2000-07-16 19:33 ` Rik van Riel
2000-07-17 7:10 ` Roger Larsson
2000-07-17 7:46 ` Mike Galbraith
2000-07-17 14:44 ` Rik van Riel
2000-07-17 19:01 ` Mike Galbraith
2000-07-17 17:21 ` Mark Hahn
2000-07-17 20:22 ` Mike Galbraith
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=3970EEB9.F27DB35C@norran.net \
--to=roger.larsson@norran.net \
--cc=linux-kernel@vger.rutgers.edu \
--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 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.