* [PATCH] code clean up of kswapd
@ 2000-06-05 23:13 Roger Larsson
0 siblings, 0 replies; only message in thread
From: Roger Larsson @ 2000-06-05 23:13 UTC (permalink / raw)
To: linux-mm@kvack.org
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
Hi all,
This is only a code clean up of kswapd -
It should do almost the same.
I do not claim improved performance :-(
But improved readability :-)
Basically done to be able to add other
stuff more easily later...
[Not tried against ac8, but ac7+riel.3
should be almost the same]
Comments?
/RogerL
--
Home page:
http://www.norran.net/nra02596/
[-- Attachment #2: patch-2.4.0-test1-ac7-riel.3-kswapd.1 --]
[-- Type: text/plain, Size: 1105 bytes --]
--- vmscan.c.riel Sat Jun 3 19:09:16 2000
+++ vmscan.c Sat Jun 3 22:30:22 2000
@@ -551,24 +551,39 @@
for (;;) {
pg_data_t *pgdat;
int something_to_do = 0;
+ int more_to_do = 0;
pgdat = pgdat_list;
do {
int i;
+
for(i = 0; i < MAX_NR_ZONES; i++) {
zone_t *zone = pgdat->node_zones+ i;
- if (tsk->need_resched)
- schedule();
if (!zone->size || !zone->zone_wake_kswapd)
continue;
+ something_to_do = 1;
if (zone->free_pages < zone->pages_low)
- something_to_do = 1;
- do_try_to_free_pages(GFP_KSWAPD);
+ more_to_do = 1;
}
pgdat = pgdat->node_next;
+
} while (pgdat);
- if (!something_to_do) {
+ /* Need to free pages?
+ * Will actually run fewer times than previous version!
+ * (It did run once per zone with waken kswapd)
+ */
+ if (something_to_do) {
+ do_try_to_free_pages(GFP_KSWAPD);
+ }
+
+ /* In a hurry? */
+ if (more_to_do) {
+ if (tsk->need_resched) {
+ schedule();
+ }
+ }
+ else {
tsk->state = TASK_INTERRUPTIBLE;
interruptible_sleep_on(&kswapd_wait);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2000-06-05 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-06-05 23:13 [PATCH] code clean up of kswapd Roger Larsson
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.