VM Acct patch (was Re: 2.6.3-rc1-mm1)

Eugene Teo
2004-02-14T02:04:49Z

[-- Attachment #1: Type: text/plain, Size: 3788 bytes --]

<quote sender="Andrew Morton">
> ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.3-rc1/2.6.3-rc1-mm1/

[snipped]

While doing my port, I noticed that add_page_state macro can be used
in place of mod_page_state, since both performs the same task, and the
former is more meaningful.

Here my patch. It applies to 2.6.3-rc2-mm1, but it shouldn't matter if
-rc2 or -rc2-mm1 is applied. I have compiled this patch, and tested it
too.

http://www.anomalistic.org/patches/vmacct-mod_page_state-fix-2.6.3-rc2-mm1.patch

diff -Naur -X /home/amnesia/w/dontdiff 2.6.3-rc2-mm1-BAK/drivers/block/ll_rw_blk.c 2.6.3-rc2-mm1-fix/drivers/block/ll_rw_blk.c
--- 2.6.3-rc2-mm1-BAK/drivers/block/ll_rw_blk.c 2004-02-14 09:36:28.000000000 +0800
+++ 2.6.3-rc2-mm1-fix/drivers/block/ll_rw_blk.c 2004-02-14 09:40:43.000000000 +0800
@@ -2313,9 +2313,9 @@
BIO_BUG_ON(!bio->bi_io_vec);
bio->bi_rw = rw;
if (rw & WRITE)
- mod_page_state(pgpgout, count);
+ add_page_state(pgpgout, count);
else
- mod_page_state(pgpgin, count);
+ add_page_state(pgpgin, count);

if (unlikely(block_dump)) {
char b[BDEVNAME_SIZE];
diff -Naur -X /home/amnesia/w/dontdiff 2.6.3-rc2-mm1-BAK/fs/inode.c 2.6.3-rc2-mm1-fix/fs/inode.c
--- 2.6.3-rc2-mm1-BAK/fs/inode.c 2004-02-14 09:36:30.000000000 +0800
+++ 2.6.3-rc2-mm1-fix/fs/inode.c 2004-02-14 09:44:57.000000000 +0800
@@ -453,9 +453,9 @@
up(&iprune_sem);

if (current_is_kswapd())
- mod_page_state(kswapd_inodesteal, reap);
+ add_page_state(kswapd_inodesteal, reap);
else
- mod_page_state(pginodesteal, reap);
+ add_page_state(pginodesteal, reap);
}

/*
diff -Naur -X /home/amnesia/w/dontdiff 2.6.3-rc2-mm1-BAK/mm/page_alloc.c 2.6.3-rc2-mm1-fix/mm/page_alloc.c
--- 2.6.3-rc2-mm1-BAK/mm/page_alloc.c 2004-02-14 09:36:30.000000000 +0800
+++ 2.6.3-rc2-mm1-fix/mm/page_alloc.c 2004-02-14 09:42:01.000000000 +0800
@@ -268,7 +268,7 @@
LIST_HEAD(list);
int i;

- mod_page_state(pgfree, 1 << order);
+ add_page_state(pgfree, 1 << order);
for (i = 0 ; i < (1 << order) ; ++i)
free_pages_check(__FUNCTION__, page + i);
list_add(&page->list, &list);
@@ -512,7 +512,7 @@

if (page != NULL) {
BUG_ON(bad_range(zone, page));
- mod_page_state(pgalloc, 1 << order);
+ add_page_state(pgalloc, 1 << order);
prep_new_page(page, order);
}
return page;
diff -Naur -X /home/amnesia/w/dontdiff 2.6.3-rc2-mm1-BAK/mm/vmscan.c 2.6.3-rc2-mm1-fix/mm/vmscan.c
--- 2.6.3-rc2-mm1-BAK/mm/vmscan.c 2004-02-14 09:36:30.000000000 +0800
+++ 2.6.3-rc2-mm1-fix/mm/vmscan.c 2004-02-14 09:45:09.000000000 +0800
@@ -460,10 +460,10 @@
list_splice(&ret_pages, page_list);
if (pagevec_count(&freed_pvec))
__pagevec_release_nonlru(&freed_pvec);
- mod_page_state(pgsteal, ret);
+ add_page_state(pgsteal, ret);
if (current_is_kswapd())
- mod_page_state(kswapd_steal, ret);
- mod_page_state(pgactivate, pgactivate);
+ add_page_state(kswapd_steal, ret);
+ add_page_state(pgactivate, pgactivate);
return ret;
}

@@ -535,7 +535,7 @@
if (nr_taken == 0)
goto again;

- mod_page_state(pgscan, nr_scan);
+ add_page_state(pgscan, nr_scan);
nr_freed = shrink_list(&page_list, gfp_mask, nr_scanned);
ret += nr_freed;

@@ -784,8 +784,8 @@
spin_unlock_irq(&zone->lru_lock);
pagevec_release(&pvec);

- mod_page_state(pgrefill, nr_pages_in - nr_pages);
- mod_page_state(pgdeactivate, pgdeactivate);
+ add_page_state(pgrefill, nr_pages_in - nr_pages);
+ add_page_state(pgdeactivate, pgdeactivate);
}

/*

--
Eugene TEO - <eugeneteo%eugeneteo!net> <http://www.anomalistic.org/>
1024D/14A0DDE5 print D851 4574 E357 469C D308 A01E 7321 A38A 14A0 DDE5
main(i) { putchar(182623909 >> (i-1) * 5&31|!!(i<7)<<6) && main(++i); }

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]