diff -urpN pgcl-2.5.59-wk-4/fs/exec.c pgcl-2.5.59-wk-5/fs/exec.c --- pgcl-2.5.59-wk-4/fs/exec.c 2003-01-30 19:50:06.000000000 -0800 +++ pgcl-2.5.59-wk-5/fs/exec.c 2003-02-14 21:46:27.000000000 -0800 @@ -412,7 +412,8 @@ int setup_arg_pages(struct linux_binprm if (!mpnt) return -ENOMEM; - if (!vm_enough_memory((STACK_TOP - (MMUPAGE_MASK & (unsigned long) bprm->p))>>MMUPAGE_SHIFT)) { + /* must match hte length of mpnt below */ + if (!vm_enough_memory((STACK_TOP-(PAGE_MASK&(unsigned long)bprm->p))/MMUPAGE_SIZE)) { kmem_cache_free(vm_area_cachep, mpnt); return -ENOMEM; } diff -urpN pgcl-2.5.59-wk-4/fs/proc/proc_misc.c pgcl-2.5.59-wk-5/fs/proc/proc_misc.c --- pgcl-2.5.59-wk-4/fs/proc/proc_misc.c 2003-01-16 18:21:39.000000000 -0800 +++ pgcl-2.5.59-wk-5/fs/proc/proc_misc.c 2003-02-14 22:01:28.000000000 -0800 @@ -194,7 +194,7 @@ static int meminfo_read_proc(char *page, K(ps.nr_writeback), K(ps.nr_mapped), K(ps.nr_slab), - K(committed), + committed << (MMUPAGE_SHIFT - 10), K(ps.nr_page_table_pages), ps.nr_reverse_maps ); diff -urpN pgcl-2.5.59-wk-4/mm/mmap.c pgcl-2.5.59-wk-5/mm/mmap.c --- pgcl-2.5.59-wk-4/mm/mmap.c 2003-01-30 19:50:06.000000000 -0800 +++ pgcl-2.5.59-wk-5/mm/mmap.c 2003-02-14 20:15:06.000000000 -0800 @@ -61,7 +61,8 @@ inline void vm_unacct_memory(long pages) /* * Check that a process has enough memory to allocate a new virtual * mapping. 1 means there is enough memory for the allocation to - * succeed and 0 implies there is not. + * succeed and 0 implies there is not. the "pages" argument is in + * mmupages. * * We currently support three overcommit policies, which are set via the * vm.overcommit_memory sysctl. See Documentation/vm/overcommit-acounting @@ -73,7 +74,7 @@ int vm_enough_memory(long pages) { unsigned long free, allowed; - atomic_add((pages+PAGE_MMUCOUNT-1)/PAGE_MMUCOUNT, &vm_committed_space); + atomic_add(pages, &vm_committed_space); /* * Sometimes we want to use more memory than we have @@ -82,9 +83,9 @@ int vm_enough_memory(long pages) return 1; if (sysctl_overcommit_memory == 0) { - free = get_page_cache_size(); - free += nr_free_pages(); - free += nr_swap_pages; + free = get_page_cache_size()*PAGE_MMUCOUNT; + free += nr_free_pages()*PAGE_MMUCOUNT; + free += nr_swap_pages*PAGE_MMUCOUNT; /* * This double-counts: the nrpages are both in the @@ -92,7 +93,7 @@ int vm_enough_memory(long pages) * this compensates for the swap-space over-allocation * (ie "nr_swap_pages" being too small). */ - free += total_swapcache_pages; + free += total_swapcache_pages*PAGE_MMUCOUNT; /* * The code below doesn't account for free space in the @@ -112,8 +113,8 @@ int vm_enough_memory(long pages) return 0; } - allowed = totalram_pages * sysctl_overcommit_ratio / 100; - allowed += total_swap_pages; + allowed = totalram_pages*(sysctl_overcommit_ratio/100)*PAGE_MMUCOUNT; + allowed += total_swap_pages*PAGE_MMUCOUNT; if (atomic_read(&vm_committed_space) < allowed) return 1; diff -urpN pgcl-2.5.59-wk-4/mm/shmem.c pgcl-2.5.59-wk-5/mm/shmem.c --- pgcl-2.5.59-wk-4/mm/shmem.c 2003-01-30 19:50:06.000000000 -0800 +++ pgcl-2.5.59-wk-5/mm/shmem.c 2003-02-14 21:00:15.000000000 -0800 @@ -45,7 +45,7 @@ #define SHMEM_MAX_INDEX (SHMEM_NR_DIRECT + (ENTRIES_PER_PAGEPAGE/2) * (ENTRIES_PER_PAGE+1)) #define SHMEM_MAX_BYTES ((unsigned long long)SHMEM_MAX_INDEX << PAGE_CACHE_SHIFT) -#define VM_ACCT(size) (PAGE_CACHE_ALIGN(size)/MMUPAGE_SIZE) +#define VM_ACCT(size) (MMUPAGE_ALIGN(size)/MMUPAGE_SIZE) /* Pretend that each entry is of this size in directory's i_size */ #define BOGO_DIRENT_SIZE 20