mm-cleanup-1 (2.4.0)
Subsystems (6)
Quoted 5 lines · Zlatko Calusic
The following patch cleans up some obsolete structures from the mm & proc code.
Beside that it also fixes what I think is a bug:
Quoted 8 lines
if ((rw == WRITE) &&
atomic_read(&nr_async_pages)>
pager_daemon.swap_cluster * (1 <<page_cluster))In that (swapout logic) it effectively says swap out 512KB at once (at least on my memory configuration). I think that is a little too much. I modified it to be a little bit more conservative and send only (1 <<
page_cluster) to the swap at a time. Same applies to theswapin_readahead()function. Comments welcome.
512kb is the maximum limit for in-flight swap pages, not the cluster size for IO.
swapin_readahead actually sends requests of (1 << page_cluster) to disk at each run.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
PATCH 1/1 mm-cleanup-1 (2.4.0)
The following patch cleans up some obsolete structures from the mm & proc code.
Beside that it also fixes what I think is a bug:
if ((rw == WRITE) && atomic_read(&nr_async_pages) >
pager_daemon.swap_cluster * (1 << page_cluster))
In that (swapout logic) it effectively says swap out 512KB at once (at least on my memory configuration). I think that is a little too much. I modified it to be a little bit more conservative and send only (1 << page_cluster) to the swap at a time. Same applies to the swapin_readahead() function. Comments welcome.
Index: 0.2/mm/oom_kill.c
mm/oom_kill.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/0_oom_kill.c 1.2 644) renamed from mm/oom_kill.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/0_oom_kill.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mm.h> #include <linux/sched.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/timex.h> /* #define DEBUG */
Index: 0.2/mm/bootmem.c
mm/bootmem.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/3_bootmem.c 1.2 644) renamed from mm/bootmem.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/3_bootmem.c 1.1 644) +0 -1
@@ -12,7 +12,6 @@ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/bootmem.h>
Index: 0.2/mm/swap_state.c
mm/swap_state.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/6_swap_state 1.2 644) renamed from mm/swap_state.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/6_swap_state 1.1 644) +0 -1
@@ -10,7 +10,6 @@ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/init.h> #include <linux/pagemap.h> #include <linux/smp_lock.h>
Index: 0.2/mm/swapfile.c
mm/swapfile.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/8_swapfile.c 1.2 644) renamed from mm/swapfile.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/8_swapfile.c 1.1 644) +0 -1
@@ -9,7 +9,6 @@ #include <linux/smp_lock.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/blkdev.h> /* for blk_size */ #include <linux/vmalloc.h> #include <linux/pagemap.h>
Index: 0.2/mm/vmscan.c
mm/vmscan.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/9_vmscan.c 1.2 644) renamed from mm/vmscan.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/9_vmscan.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/slab.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/pagemap.h> #include <linux/init.h>
Index: 0.2/mm/page_io.c
mm/page_io.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/10_page_io.c 1.3 644) renamed from mm/page_io.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/10_page_io.c 1.1 644) +1 -2
@@ -14,7 +14,6 @@ #include <linux/kernel_stat.h> #include <linux/swap.h> #include <linux/locks.h> -#include <linux/swapctl.h> #include <asm/pgtable.h>
@@ -44,7 +43,7 @@ /* Don't allow too many pending pages in flight.. */ if ((rw == WRITE) && atomic_read(&nr_async_pages) > - pager_daemon.swap_cluster * (1 << page_cluster)) + (1 << page_cluster)) wait = 1; if (rw == READ) {
Index: 0.2/mm/filemap.c
mm/filemap.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/12_filemap.c 1.2 644) renamed from mm/filemap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/12_filemap.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/smp_lock.h> #include <linux/blkdev.h> #include <linux/file.h> -#include <linux/swapctl.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/mm.h>
Index: 0.2/mm/page_alloc.c
mm/page_alloc.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/14_page_alloc 1.2 644) renamed from mm/page_alloc.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/14_page_alloc 1.1 644) +0 -1
@@ -12,7 +12,6 @@ #include <linux/config.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/interrupt.h> #include <linux/pagemap.h> #include <linux/bootmem.h>
Index: 0.2/mm/mmap.c
mm/mmap.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/16_mmap.c 1.2 644) renamed from mm/mmap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/16_mmap.c 1.1 644) +0 -1
@@ -8,7 +8,6 @@ #include <linux/mman.h> #include <linux/pagemap.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/init.h> #include <linux/file.h>
Index: 0.2/mm/swap.c
mm/swap.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/17_swap.c 1.4 644) renamed from mm/swap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/17_swap.c 1.1 644) +4 -24
@@ -10,13 +10,11 @@ * linux/Documentation/sysctl/vm.txt. * Started 18.12.91 * Swap aging added 23.2.95, Stephen Tweedie. - * Buffermem limits added 12.3.98, Rik van Riel. */ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/pagemap.h> #include <linux/init.h>
@@ -42,6 +40,10 @@ /* How many pages do we try to swap or page in/out together? */ int page_cluster; +/* We track the number of pages currently being asynchronously swapped + out, so that we don't try to swap TOO many pages out at once */ +atomic_t nr_async_pages = ATOMIC_INIT(0); + /* * This variable contains the amount of page steals the system * is doing, averaged over a minute. We use this to determine how
@@ -52,28 +54,6 @@ * In recalculate_vm_stats the value is decayed (once a second) */ int memory_pressure; - -/* We track the number of pages currently being asynchronously swapped - out, so that we don't try to swap TOO many pages out at once */ -atomic_t nr_async_pages = ATOMIC_INIT(0); - -buffer_mem_t buffer_mem = { - 2, /* minimum percent buffer */ - 10, /* borrow percent buffer */ - 60 /* maximum percent buffer */ -}; - -buffer_mem_t page_cache = { - 2, /* minimum percent page cache */ - 15, /* borrow percent page cache */ - 75 /* maximum */ -}; - -pager_daemon_t pager_daemon = { - 512, /* base number for calculating the number of tries */ - SWAP_CLUSTER_MAX, /* minimum number of tries */ - 8, /* do swap I/O in clusters of this size */ -}; /** * age_page_{up,down} - page aging helper functions
Index: 0.2/mm/memory.c
mm/memory.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/18_memory.c 1.3 644) renamed from mm/memory.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/18_memory.c 1.1 644) +1 -3
@@ -40,7 +40,6 @@ #include <linux/mman.h> #include <linux/swap.h> #include <linux/smp_lock.h> -#include <linux/swapctl.h> #include <linux/iobuf.h> #include <asm/uaccess.h> #include <asm/pgalloc.h>
@@ -1000,8 +999,7 @@ num = valid_swaphandles(entry, &offset); for (i = 0; i < num; offset++, i++) { /* Don't block on I/O for read-ahead */ - if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster - * (1 << page_cluster)) { + if (atomic_read(&nr_async_pages) >= (1 << page_cluster)) { while (i++ < num) swap_free(SWP_ENTRY(SWP_TYPE(entry), offset++)); break;
Index: 0.2/kernel/sysctl.c
kernel/sysctl.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/38_sysctl.c 1.1.1.3 644) renamed from kernel/sysctl.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/38_sysctl.c 1.1 644) +2 -8
@@ -20,8 +20,8 @@ #include <linux/config.h> #include <linux/malloc.h> +#include <linux/swap.h> #include <linux/sysctl.h> -#include <linux/swapctl.h> #include <linux/proc_fs.h> #include <linux/ctype.h> #include <linux/utsname.h>
@@ -241,18 +241,12 @@ static ctl_table vm_table[] = { {VM_FREEPG, "freepages", - &freepages, sizeof(freepages_t), 0444, NULL, &proc_dointvec}, + &freepages, 3*sizeof(int), 0444, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, {VM_OVERCOMMIT_MEMORY, "overcommit_memory", &sysctl_overcommit_memory, sizeof(sysctl_overcommit_memory), 0644, NULL, &proc_dointvec}, - {VM_BUFFERMEM, "buffermem", - &buffer_mem, sizeof(buffer_mem_t), 0644, NULL, &proc_dointvec}, - {VM_PAGECACHE, "pagecache", - &page_cache, sizeof(buffer_mem_t), 0644, NULL, &proc_dointvec}, - {VM_PAGERDAEMON, "kswapd", - &pager_daemon, sizeof(pager_daemon_t), 0644, NULL, &proc_dointvec}, {VM_PGT_CACHE, "pagetable_cache", &pgt_cache_water, 2*sizeof(int), 0644, NULL, &proc_dointvec}, {VM_PAGE_CLUSTER, "page-cluster",
Index: 0.2/include/linux/swap.h
include/linux/swap.h Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/d/b/26_swap.h 1.2 644) renamed from include/linux/swap.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/d/b/26_swap.h 1.1 644) +9 -1
@@ -63,6 +63,15 @@ int next; /* next entry on swap list */ }; +typedef struct freepages_v1 +{ + unsigned int min; + unsigned int low; + unsigned int high; +} freepages_v1; +typedef freepages_v1 freepages_t; +extern freepages_t freepages; + extern int nr_swap_pages; FASTCALL(unsigned int nr_free_pages(void)); FASTCALL(unsigned int nr_inactive_clean_pages(void));
@@ -80,7 +89,6 @@ struct task_struct; struct vm_area_struct; struct sysinfo; - struct zone_t; /* linux/mm/swap.c */
Index: 0.2/include/linux/sysctl.h
include/linux/sysctl.h Sun, 07 Jan 2001 19:16:44 +0100 zcalusic (linux24/e/b/38_sysctl.h 1.1.1.2 644) renamed from include/linux/sysctl.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/e/b/38_sysctl.h 1.1 644) +3 -3
@@ -128,9 +128,9 @@ VM_FREEPG=3, /* struct: Set free page thresholds */ VM_BDFLUSH=4, /* struct: Control buffer cache flushing */ VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ - VM_BUFFERMEM=6, /* struct: Set buffer memory thresholds */ - VM_PAGECACHE=7, /* struct: Set cache memory thresholds */ - VM_PAGERDAEMON=8, /* struct: Control kswapd behaviour */ +/* was VM_BUFFERMEM */ +/* was VM_PAGECACHE */ +/* was VM_PAGERDAEMON */ VM_PGT_CACHE=9, /* struct: Set page table cache parameters */ VM_PAGE_CLUSTER=10 /* int: set number of pages to swap together */ };
Index: 0.2/include/linux/mm.h
include/linux/mm.h Sun, 07 Jan 2001 18:42:20 +0100 zcalusic (linux24/g/b/6_mm.h 1.2 644) renamed from include/linux/mm.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/g/b/6_mm.h 1.1 644) +0 -5
@@ -521,11 +521,6 @@ extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr); -#define buffer_under_min() (atomic_read(&buffermem_pages) * 100 < \ - buffer_mem.min_percent * num_physpages) -#define pgcache_under_min() (atomic_read(&page_cache_size) * 100 < \ - page_cache.min_percent * num_physpages) - #endif /* __KERNEL__ */ #endif
Index: 0.2/fs/coda/sysctl.c
fs/coda/sysctl.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/b/38_sysctl.c 1.2 644) renamed from fs/coda/sysctl.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/b/38_sysctl.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/sched.h> #include <linux/mm.h> #include <linux/sysctl.h> -#include <linux/swapctl.h> #include <linux/proc_fs.h> #include <linux/malloc.h> #include <linux/stat.h>
Index: 0.2/fs/buffer.c
fs/buffer.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/p/b/15_buffer.c 1.2 644) renamed from fs/buffer.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/p/b/15_buffer.c 1.1 644) +0 -1
@@ -35,7 +35,6 @@ #include <linux/locks.h> #include <linux/errno.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/vmalloc.h> #include <linux/blkdev.h>
Index: 0.2/arch/mips64/mm/init.c
arch/mips64/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/o/c/30_init.c 1.2 644) renamed from arch/mips64/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/o/c/30_init.c 1.1 644) +0 -1
@@ -22,7 +22,6 @@ #include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.2/arch/arm/mm/init.c
arch/arm/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/v/c/33_init.c 1.2 644) renamed from arch/arm/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/v/c/33_init.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mman.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp.h> #include <linux/init.h> #include <linux/bootmem.h>
Index: 0.2/arch/sparc64/mm/init.c
arch/sparc64/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/y/c/18_init.c 1.2 644) renamed from arch/sparc64/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/y/c/18_init.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/malloc.h> #include <linux/blk.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <asm/head.h> #include <asm/system.h>
Index: 0.2/arch/mips/mm/init.c
arch/mips/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/M/c/40_init.c 1.2 644) renamed from arch/mips/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/M/c/40_init.c 1.1 644) +0 -1
@@ -22,7 +22,6 @@ #include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.2/arch/sparc/mm/init.c
arch/sparc/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/N/c/32_init.c 1.2 644) renamed from arch/sparc/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/N/c/32_init.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mman.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.6/include/linux/swapctl.h
include/linux/swapctl.h Sun, 07 Jan 2001 21:30:32 +0100 zcalusic () renamed from include/linux/swapctl.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/c/b/36_swapctl.h 1.1 644) +0 -35
@@ -1,35 +0,0 @@ -#ifndef _LINUX_SWAPCTL_H -#define _LINUX_SWAPCTL_H - -#include <asm/page.h> -#include <linux/fs.h> - -typedef struct buffer_mem_v1 -{ - unsigned int min_percent; - unsigned int borrow_percent; - unsigned int max_percent; -} buffer_mem_v1; -typedef buffer_mem_v1 buffer_mem_t; -extern buffer_mem_t buffer_mem; -extern buffer_mem_t page_cache; - -typedef struct freepages_v1 -{ - unsigned int min; - unsigned int low; - unsigned int high; -} freepages_v1; -typedef freepages_v1 freepages_t; -extern freepages_t freepages; - -typedef struct pager_daemon_v1 -{ - unsigned int tries_base; - unsigned int tries_min; - unsigned int swap_cluster; -} pager_daemon_v1; -typedef pager_daemon_v1 pager_daemon_t; -extern pager_daemon_t pager_daemon; - -#endif /* _LINUX_SWAPCTL_H */
Signature · 5 lines
Zlatko -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/
Quoted 16 lines · Marcelo Tosatti
Quoted 5 lines · Zlatko Calusic
The following patch cleans up some obsolete structures from the mm & proc code.
Beside that it also fixes what I think is a bug:
Quoted 8 lines
if ((rw == WRITE) &&
atomic_read(&nr_async_pages)>
pager_daemon.swap_cluster * (1 <<page_cluster))In that (swapout logic) it effectively says swap out 512KB at once (at least on my memory configuration). I think that is a little too much. I modified it to be a little bit more conservative and send only (1 <<
page_cluster) to the swap at a time. Same applies to theswapin_readahead()function. Comments welcome.
Quoted 6 lines
512kb is the maximum limit for in-flight swap pages, not the cluster size for IO.
swapin_readaheadactually sends requests of (1 <<page_cluster) to disk at each run.
OK, maybe I was too fast in concluding with that change. I'm still trying to find out why is MM working bad in some circumstances (see my other email to the list).
Anyway, I would than suggest to introduce another /proc entry and call it appropriately: max_async_pages. Because that is what we care about, anyway. I'll send another patch.
Signature · 5 lines
Zlatko -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/
Quoted 11 lines · Zlatko Calusic
The following patch cleans up some obsolete structures from the mm & proc code.
Beside that it also fixes what I think is a bug:
if ((rw == WRITE) &&
atomic_read(&nr_async_pages)>
pager_daemon.swap_cluster * (1 <<page_cluster))In that (swapout logic) it effectively says swap out 512KB at once (at least on my memory configuration). I think that is a little too much.
Since we submit a whole cluster of (1 << page_cluster) size at once, your change would mean that the VM can only do one IO at a time...
Have you actually measured your changes or is it just a gut feeling that the current default is too much?
(I can agree with 1/2 MB being a bit much, but doing just one IO at a time is probably wrong too...)
The cleanup part of your patch is nice. I think that one should be submitted as soon as the 2.4 bugfix period is over ...
(and yes, I'm not submitting any of my own trivial patches either unless they're REALLY needed, lets make sure Linus has enough time to focus on the real bugfixes)
regards,
Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...
http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com.br/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Quoted 7 lines · Zlatko Calusic
OK, maybe I was too fast in concluding with that change. I'm still trying to find out why is MM working bad in some circumstances (see my other email to the list).
Anyway, I would than suggest to introduce another /proc entry and call it appropriately:
max_async_pages. Because that is what we care about, anyway. I'll send another patch.
In fact, that's NOT what we care about.
What we really care about is the number of disk seeks the VM subsystem has queued to disk, since it's seek time that causes other requests to suffer bad latency.
regards,
Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...
http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com.br/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Quoted 3 lines · Zlatko Calusic
Anyway, I would than suggest to introduce another /proc entry and call it appropriately:
max_async_pages. Because that is what we care about, anyway. I'll send another patch.
Anton Blanchard already did a patch for this. Sent to the list on Thu, 7 Dec 2000 16:15:54 +1100 subject:
[PATCH]: sysctl to tune async and sync bdflush triggers
I don't recall seeing any responses to that patch, but it seems to do exactly what you describe.
regards,
Davej.
Signature · 7 lines
| Dave Jones. http://www.suse.de/~davej | SuSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/
Quoted 14 lines · Rik van Riel
Quoted 11 lines · Zlatko Calusic
The following patch cleans up some obsolete structures from the mm & proc code.
Beside that it also fixes what I think is a bug:
if ((rw == WRITE) &&
atomic_read(&nr_async_pages)>
pager_daemon.swap_cluster * (1 <<page_cluster))In that (swapout logic) it effectively says swap out 512KB at once (at least on my memory configuration). I think that is a little too much.
Quoted 7 lines
Since we submit a whole cluster of (1 <<
page_cluster) size at once, your change would mean that the VM can only do one IO at a time...Have you actually measured your changes or is it just a gut feeling that the current default is too much?
Well, to be honest I didn't find any change after the modification. :)
But, anyway, Marcelo explained to me what's going on and I have already agreed there is no need to change that. Instead I'll modify my patch to introduce new /proc entry with meaningful name:max_async_pages.
Quoted 3 lines
(I can agree with 1/2 MB being a bit much, but doing just one IO at a time is probably wrong too...)
I can only add that I share your opinion. :)
Quoted 5 lines
The cleanup part of your patch is nice. I think that one should be submitted as soon as the 2.4 bugfix period is over ...
Right.
Quoted 4 lines
(and yes, I'm not submitting any of my own trivial patches either unless they're REALLY needed, lets make sure Linus has enough time to focus on the real bugfixes)
I'll check your new patch as soon as I have investigated few more things and got a little more acquainted with the mm code in the 2.4.0. It's a pity I found some free time this late, but then again I see myself much more involved with the mm code in the future. It's just that I'll need some help in the start thus so much questions on the lists. :)
Signature · 5 lines
Zlatko -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/
Quoted 10 lines · Rik van Riel
Quoted 7 lines · Zlatko Calusic
OK, maybe I was too fast in concluding with that change. I'm still trying to find out why is MM working bad in some circumstances (see my other email to the list).
Anyway, I would than suggest to introduce another /proc entry and call it appropriately:
max_async_pages. Because that is what we care about, anyway. I'll send another patch.
Quoted 6 lines
In fact, that's NOT what we care about.
What we really care about is the number of disk seeks the VM subsystem has queued to disk, since it's seek time that causes other requests to suffer bad latency.
Yes, but that's not what we have in the code now. I'm just trying to make it little easier for the end user to tune his system. Right now things are quite complicated and misleading for the uninitiated.
If we are to optimize things better in the future, then be it, but I would like first to clean some historical cruft.
I'm a quite pedantical guy, you know. :)
Signature · 5 lines
Zlatko -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/
PATCH 1/1 mm-cleanup-2 (2.4.0)
In reply to Zlatko CalusicOK, take two. This patch:
o removes obsolete /proc entryes and other mm structures not used anymore.
o adds new /proc/sys/vm/max-async-pages
o updates documentation
As the patch doesn't change any kernel vital functionality it is completely safe. I don't know if it satisfies Linus' patch submitting guidelines. So sent only to the lists to be on the safe side. :)
Index: 0.2/mm/oom_kill.c
mm/oom_kill.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/0_oom_kill.c 1.2 644) renamed from mm/oom_kill.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/0_oom_kill.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mm.h> #include <linux/sched.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/timex.h> /* #define DEBUG */
Index: 0.2/mm/bootmem.c
mm/bootmem.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/3_bootmem.c 1.2 644) renamed from mm/bootmem.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/3_bootmem.c 1.1 644) +0 -1
@@ -12,7 +12,6 @@ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/interrupt.h> #include <linux/init.h> #include <linux/bootmem.h>
Index: 0.2/mm/swap_state.c
mm/swap_state.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/6_swap_state 1.2 644) renamed from mm/swap_state.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/6_swap_state 1.1 644) +0 -1
@@ -10,7 +10,6 @@ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/init.h> #include <linux/pagemap.h> #include <linux/smp_lock.h>
Index: 0.2/mm/swapfile.c
mm/swapfile.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/8_swapfile.c 1.2 644) renamed from mm/swapfile.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/8_swapfile.c 1.1 644) +0 -1
@@ -9,7 +9,6 @@ #include <linux/smp_lock.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/blkdev.h> /* for blk_size */ #include <linux/vmalloc.h> #include <linux/pagemap.h>
Index: 0.2/mm/vmscan.c
mm/vmscan.c Tue, 09 Jan 2001 01:39:38 +0100 zcalusic (linux24/j/9_vmscan.c 1.4 644) renamed from mm/vmscan.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/9_vmscan.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/slab.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/pagemap.h> #include <linux/init.h>
Index: 0.2/mm/page_io.c
mm/page_io.c Tue, 09 Jan 2001 01:31:18 +0100 zcalusic (linux24/j/10_page_io.c 1.4 644) renamed from mm/page_io.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/10_page_io.c 1.1 644) +1 -3
@@ -14,7 +14,6 @@ #include <linux/kernel_stat.h> #include <linux/swap.h> #include <linux/locks.h> -#include <linux/swapctl.h> #include <asm/pgtable.h>
@@ -43,8 +42,7 @@ struct inode *swapf = 0; /* Don't allow too many pending pages in flight.. */ - if ((rw == WRITE) && atomic_read(&nr_async_pages) > - pager_daemon.swap_cluster * (1 << page_cluster)) + if ((rw == WRITE) && atomic_read(&nr_async_pages) > max_async_pages) wait = 1; if (rw == READ) {
Index: 0.2/mm/filemap.c
mm/filemap.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/12_filemap.c 1.2 644) renamed from mm/filemap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/12_filemap.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/smp_lock.h> #include <linux/blkdev.h> #include <linux/file.h> -#include <linux/swapctl.h> #include <linux/slab.h> #include <linux/init.h> #include <linux/mm.h>
Index: 0.2/mm/page_alloc.c
mm/page_alloc.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/14_page_alloc 1.2 644) renamed from mm/page_alloc.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/14_page_alloc 1.1 644) +0 -1
@@ -12,7 +12,6 @@ #include <linux/config.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/interrupt.h> #include <linux/pagemap.h> #include <linux/bootmem.h>
Index: 0.2/mm/mmap.c
mm/mmap.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/16_mmap.c 1.2 644) renamed from mm/mmap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/16_mmap.c 1.1 644) +0 -1
@@ -8,7 +8,6 @@ #include <linux/mman.h> #include <linux/pagemap.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/init.h> #include <linux/file.h>
Index: 0.2/mm/swap.c
mm/swap.c Tue, 09 Jan 2001 01:31:18 +0100 zcalusic (linux24/j/17_swap.c 1.5 644) renamed from mm/swap.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/17_swap.c 1.1 644) +9 -24
@@ -10,13 +10,11 @@ * linux/Documentation/sysctl/vm.txt. * Started 18.12.91 * Swap aging added 23.2.95, Stephen Tweedie. - * Buffermem limits added 12.3.98, Rik van Riel. */ #include <linux/mm.h> #include <linux/kernel_stat.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/pagemap.h> #include <linux/init.h>
@@ -42,6 +40,13 @@ /* How many pages do we try to swap or page in/out together? */ int page_cluster; +/* Maximum number of swap pages in flight */ +int max_async_pages; + +/* We track the number of pages currently being asynchronously swapped + out, so that we don't try to swap TOO many pages out at once */ +atomic_t nr_async_pages = ATOMIC_INIT(0); + /* * This variable contains the amount of page steals the system * is doing, averaged over a minute. We use this to determine how
@@ -53,28 +58,6 @@ */ int memory_pressure; -/* We track the number of pages currently being asynchronously swapped - out, so that we don't try to swap TOO many pages out at once */ -atomic_t nr_async_pages = ATOMIC_INIT(0); - -buffer_mem_t buffer_mem = { - 2, /* minimum percent buffer */ - 10, /* borrow percent buffer */ - 60 /* maximum percent buffer */ -}; - -buffer_mem_t page_cache = { - 2, /* minimum percent page cache */ - 15, /* borrow percent page cache */ - 75 /* maximum */ -}; - -pager_daemon_t pager_daemon = { - 512, /* base number for calculating the number of tries */ - SWAP_CLUSTER_MAX, /* minimum number of tries */ - 8, /* do swap I/O in clusters of this size */ -}; - /** * age_page_{up,down} - page aging helper functions * @page - the page we want to age
@@ -302,4 +285,6 @@ page_cluster = 3; else page_cluster = 4; + + max_async_pages = 1 << (page_cluster + 3); }
Index: 0.2/mm/memory.c
mm/memory.c Tue, 09 Jan 2001 01:31:18 +0100 zcalusic (linux24/j/18_memory.c 1.4 644) renamed from mm/memory.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/18_memory.c 1.1 644) +1 -3
@@ -40,7 +40,6 @@ #include <linux/mman.h> #include <linux/swap.h> #include <linux/smp_lock.h> -#include <linux/swapctl.h> #include <linux/iobuf.h> #include <asm/uaccess.h> #include <asm/pgalloc.h>
@@ -1000,8 +999,7 @@ num = valid_swaphandles(entry, &offset); for (i = 0; i < num; offset++, i++) { /* Don't block on I/O for read-ahead */ - if (atomic_read(&nr_async_pages) >= pager_daemon.swap_cluster - * (1 << page_cluster)) { + if (atomic_read(&nr_async_pages) >= max_async_pages) { while (i++ < num) swap_free(SWP_ENTRY(SWP_TYPE(entry), offset++)); break;
Index: 0.2/kernel/sysctl.c
kernel/sysctl.c Tue, 09 Jan 2001 01:31:18 +0100 zcalusic (linux24/j/38_sysctl.c 1.1.1.4 644) renamed from kernel/sysctl.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/38_sysctl.c 1.1 644) +4 -8
@@ -20,8 +20,8 @@ #include <linux/config.h> #include <linux/malloc.h> +#include <linux/swap.h> #include <linux/sysctl.h> -#include <linux/swapctl.h> #include <linux/proc_fs.h> #include <linux/ctype.h> #include <linux/utsname.h>
@@ -241,22 +241,18 @@ static ctl_table vm_table[] = { {VM_FREEPG, "freepages", - &freepages, sizeof(freepages_t), 0444, NULL, &proc_dointvec}, + &freepages, 3*sizeof(int), 0444, NULL, &proc_dointvec}, {VM_BDFLUSH, "bdflush", &bdf_prm, 9*sizeof(int), 0644, NULL, &proc_dointvec_minmax, &sysctl_intvec, NULL, &bdflush_min, &bdflush_max}, {VM_OVERCOMMIT_MEMORY, "overcommit_memory", &sysctl_overcommit_memory, sizeof(sysctl_overcommit_memory), 0644, NULL, &proc_dointvec}, - {VM_BUFFERMEM, "buffermem", - &buffer_mem, sizeof(buffer_mem_t), 0644, NULL, &proc_dointvec}, - {VM_PAGECACHE, "pagecache", - &page_cache, sizeof(buffer_mem_t), 0644, NULL, &proc_dointvec}, - {VM_PAGERDAEMON, "kswapd", - &pager_daemon, sizeof(pager_daemon_t), 0644, NULL, &proc_dointvec}, {VM_PGT_CACHE, "pagetable_cache", &pgt_cache_water, 2*sizeof(int), 0644, NULL, &proc_dointvec}, {VM_PAGE_CLUSTER, "page-cluster", &page_cluster, sizeof(int), 0644, NULL, &proc_dointvec}, + {VM_MAX_ASYNC_PAGES, "max-async-pages", + &max_async_pages, sizeof(int), 0644, NULL, &proc_dointvec}, {0} };
Index: 0.2/include/linux/swap.h
include/linux/swap.h Tue, 09 Jan 2001 01:33:49 +0100 zcalusic (linux24/d/b/26_swap.h 1.4 644) renamed from include/linux/swap.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/d/b/26_swap.h 1.1 644) +10 -3
@@ -41,8 +41,6 @@ #define SWP_USED 1 #define SWP_WRITEOK 3 -#define SWAP_CLUSTER_MAX 32 - #define SWAP_MAP_MAX 0x7fff #define SWAP_MAP_BAD 0x8000
@@ -63,6 +61,15 @@ int next; /* next entry on swap list */ }; +typedef struct freepages_v1 +{ + unsigned int min; + unsigned int low; + unsigned int high; +} freepages_v1; +typedef freepages_v1 freepages_t; +extern freepages_t freepages; + extern int nr_swap_pages; FASTCALL(unsigned int nr_free_pages(void)); FASTCALL(unsigned int nr_inactive_clean_pages(void));
@@ -70,6 +77,7 @@ extern int nr_active_pages; extern int nr_inactive_dirty_pages; extern atomic_t nr_async_pages; +extern int max_async_pages; extern struct address_space swapper_space; extern atomic_t page_cache_size; extern atomic_t buffermem_pages;
@@ -80,7 +88,6 @@ struct task_struct; struct vm_area_struct; struct sysinfo; - struct zone_t; /* linux/mm/swap.c */
Index: 0.2/include/linux/sysctl.h
include/linux/sysctl.h Tue, 09 Jan 2001 01:31:18 +0100 zcalusic (linux24/e/b/38_sysctl.h 1.1.1.3 644) renamed from include/linux/sysctl.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/e/b/38_sysctl.h 1.1 644) +5 -4
@@ -128,11 +128,12 @@ VM_FREEPG=3, /* struct: Set free page thresholds */ VM_BDFLUSH=4, /* struct: Control buffer cache flushing */ VM_OVERCOMMIT_MEMORY=5, /* Turn off the virtual memory safety limit */ - VM_BUFFERMEM=6, /* struct: Set buffer memory thresholds */ - VM_PAGECACHE=7, /* struct: Set cache memory thresholds */ - VM_PAGERDAEMON=8, /* struct: Control kswapd behaviour */ +/* was VM_BUFFERMEM */ +/* was VM_PAGECACHE */ +/* was VM_PAGERDAEMON */ VM_PGT_CACHE=9, /* struct: Set page table cache parameters */ - VM_PAGE_CLUSTER=10 /* int: set number of pages to swap together */ + VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ + VM_MAX_ASYNC_PAGES=11 /* int: max number of swap pages in flight */ };
Index: 0.2/include/linux/mm.h
include/linux/mm.h Sun, 07 Jan 2001 18:42:20 +0100 zcalusic (linux24/g/b/6_mm.h 1.2 644) renamed from include/linux/mm.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/g/b/6_mm.h 1.1 644) +0 -5
@@ -521,11 +521,6 @@ extern struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr); -#define buffer_under_min() (atomic_read(&buffermem_pages) * 100 < \ - buffer_mem.min_percent * num_physpages) -#define pgcache_under_min() (atomic_read(&page_cache_size) * 100 < \ - page_cache.min_percent * num_physpages) - #endif /* __KERNEL__ */ #endif
Index: 0.2/fs/coda/sysctl.c
fs/coda/sysctl.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/j/b/38_sysctl.c 1.2 644) renamed from fs/coda/sysctl.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/j/b/38_sysctl.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/sched.h> #include <linux/mm.h> #include <linux/sysctl.h> -#include <linux/swapctl.h> #include <linux/proc_fs.h> #include <linux/malloc.h> #include <linux/stat.h>
Index: 0.2/fs/buffer.c
fs/buffer.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/p/b/15_buffer.c 1.2 644) renamed from fs/buffer.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/p/b/15_buffer.c 1.1 644) +0 -1
@@ -35,7 +35,6 @@ #include <linux/locks.h> #include <linux/errno.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp_lock.h> #include <linux/vmalloc.h> #include <linux/blkdev.h>
Index: 0.2/arch/mips64/mm/init.c
arch/mips64/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/o/c/30_init.c 1.2 644) renamed from arch/mips64/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/o/c/30_init.c 1.1 644) +0 -1
@@ -22,7 +22,6 @@ #include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.2/arch/arm/mm/init.c
arch/arm/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/v/c/33_init.c 1.2 644) renamed from arch/arm/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/v/c/33_init.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mman.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <linux/smp.h> #include <linux/init.h> #include <linux/bootmem.h>
Index: 0.2/arch/sparc64/mm/init.c
arch/sparc64/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/y/c/18_init.c 1.2 644) renamed from arch/sparc64/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/y/c/18_init.c 1.1 644) +0 -1
@@ -15,7 +15,6 @@ #include <linux/malloc.h> #include <linux/blk.h> #include <linux/swap.h> -#include <linux/swapctl.h> #include <asm/head.h> #include <asm/system.h>
Index: 0.2/arch/mips/mm/init.c
arch/mips/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/M/c/40_init.c 1.2 644) renamed from arch/mips/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/M/c/40_init.c 1.1 644) +0 -1
@@ -22,7 +22,6 @@ #include <linux/bootmem.h> #include <linux/highmem.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.2/arch/sparc/mm/init.c
arch/sparc/mm/init.c Sun, 07 Jan 2001 20:17:13 +0100 zcalusic (linux24/N/c/32_init.c 1.2 644) renamed from arch/sparc/mm/init.c Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/N/c/32_init.c 1.1 644) +0 -1
@@ -18,7 +18,6 @@ #include <linux/mman.h> #include <linux/mm.h> #include <linux/swap.h> -#include <linux/swapctl.h> #ifdef CONFIG_BLK_DEV_INITRD #include <linux/blk.h> #endif
Index: 0.2/Documentation/sysctl/vm.txt
Documentation/sysctl/vm.txt Tue, 09 Jan 2001 01:46:36 +0100 zcalusic (linux24/X/c/33_vm.txt 1.2 644) renamed from Documentation/sysctl/vm.txt Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/X/c/33_vm.txt 1.1 644) +7 -46
82 lines not on this page · raw message
Index: 0.10/include/linux/swapctl.h
include/linux/swapctl.h Tue, 09 Jan 2001 01:46:49 +0100 zcalusic () renamed from include/linux/swapctl.h Sat, 06 Jan 2001 01:48:21 +0100 zcalusic (linux24/c/b/36_swapctl.h 1.1 644) +0 -35
@@ -1,35 +0,0 @@ -#ifndef _LINUX_SWAPCTL_H -#define _LINUX_SWAPCTL_H - -#include <asm/page.h> -#include <linux/fs.h> - -typedef struct buffer_mem_v1 -{ - unsigned int min_percent; - unsigned int borrow_percent; - unsigned int max_percent; -} buffer_mem_v1; -typedef buffer_mem_v1 buffer_mem_t; -extern buffer_mem_t buffer_mem; -extern buffer_mem_t page_cache; - -typedef struct freepages_v1 -{ - unsigned int min; - unsigned int low; - unsigned int high; -} freepages_v1; -typedef freepages_v1 freepages_t; -extern freepages_t freepages; - -typedef struct pager_daemon_v1 -{ - unsigned int tries_base; - unsigned int tries_min; - unsigned int swap_cluster; -} pager_daemon_v1; -typedef pager_daemon_v1 pager_daemon_t; -extern pager_daemon_t pager_daemon; - -#endif /* _LINUX_SWAPCTL_H */
Signature · 5 lines
Zlatko -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux.eu.org/Linux-MM/