[patch] trashing memory against 2.3.18ac4

Andrea Arcangeli (andrea@suse.de)
Wed, 15 Sep 1999 15:40:13 +0200 (CEST)


This my patch improves a lot responsiveness of application during heavy VM
load. Basically it bias still more the low_on_memory bit making it a
per-process thing.

To verify the difference with eyes just run an application that swapout
lots of mbyte of data. While the swapout is happening try to move some
windows inside X. Then apply the patch and repeat the same operation.

Low memory machines should benefit of this patch too.

Patch against 2.3.18ac4:

diff -urN 2.3.18ac4/include/linux/sched.h 2.3.18ac4-trashmem/include/linux/sched.h
--- 2.3.18ac4/include/linux/sched.h Wed Sep 15 14:48:32 1999
+++ 2.3.18ac4-trashmem/include/linux/sched.h Wed Sep 15 15:19:49 1999
@@ -321,6 +321,8 @@
/* mm fault and swap info: this can arguably be seen as either mm-specific or thread-specific */
unsigned long min_flt, maj_flt, nswap, cmin_flt, cmaj_flt, cnswap;
int swappable:1;
+ int trashing_mem:1;
+ int trashing_bigmem:1;
/* process credentials */
uid_t uid,euid,suid,fsuid;
gid_t gid,egid,sgid,fsgid;
@@ -404,7 +406,7 @@
/* utime */ {0,0,0,0},0, \
/* per CPU times */ {0, }, {0, }, \
/* flt */ 0,0,0,0,0,0, \
-/* swp */ 0, \
+/* swp */ 0,0,0, \
/* process credentials */ \
/* uid etc */ 0,0,0,0,0,0,0,0, \
/* suppl grps*/ 0, {0,}, \
diff -urN 2.3.18ac4/mm/page_alloc.c 2.3.18ac4-trashmem/mm/page_alloc.c
--- 2.3.18ac4/mm/page_alloc.c Tue Sep 14 14:35:26 1999
+++ 2.3.18ac4-trashmem/mm/page_alloc.c Wed Sep 15 15:18:57 1999
@@ -255,43 +255,43 @@
*/
if (!(current->flags & PF_MEMALLOC)) {
int freed;
- static int low_on_memory = 0;

#ifndef CONFIG_BIGMEM
if (nr_free_pages > freepages.min) {
- if (!low_on_memory)
+ if (!current->trashing_mem)
goto ok_to_allocate;
if (nr_free_pages >= freepages.high) {
- low_on_memory = 0;
+ current->trashing_mem = 0;
goto ok_to_allocate;
}
}

- low_on_memory = 1;
+ if (!current->trashing_mem)
+ current->trashing_mem = 1;
#else
- static int low_on_bigmemory = 0;
-
if (gfp_mask & __GFP_BIGMEM)
{
if (nr_free_pages > freepages.min) {
- if (!low_on_bigmemory)
+ if (!current->trashing_bigmem)
goto ok_to_allocate;
if (nr_free_pages >= freepages.high) {
- low_on_bigmemory = 0;
+ current->trashing_bigmem = 0;
goto ok_to_allocate;
}
}
- low_on_bigmemory = 1;
+ if (!current->trashing_bigmem)
+ current->trashing_bigmem = 1;
} else {
if (nr_free_pages-nr_free_bigpages > freepages.min) {
- if (!low_on_memory)
+ if (!current->trashing_mem)
goto ok_to_allocate;
if (nr_free_pages-nr_free_bigpages >= freepages.high) {
- low_on_memory = 0;
+ current->trashing_mem = 0;
goto ok_to_allocate;
}
}
- low_on_memory = 1;
+ if (!current->trashing_mem)
+ current->trashing_mem = 1;
}
#endif
current->flags |= PF_MEMALLOC;

Andrea

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/