diff options
author | Greg Ungerer <gerg@snapgear.com> | 2004-10-27 07:14:44 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-27 07:14:44 -0700 |
commit | abd68b6a1850b4224da2a38a5aaf17338dacc8c4 (patch) | |
tree | 0f81d6e94e06a5bdbe399f5946ce43e9c1ead095 /mm | |
parent | abbe31a371f5a4ed198c4182ab8f9d973b633b85 (diff) | |
download | history-abd68b6a1850b4224da2a38a5aaf17338dacc8c4.tar.gz |
[PATCH] update total_vm on non-MMU configurations
This patch fixes 3 problems with the nommu.c support code:
1. export mem_map and vmtruncate (to make them the same as MMU version)
2. update the total_vm usage in mmap routines
Without this the OOM killer has no "badness" points to rate
processes on...
This patch was originally submitted by Giovanni Casoli
<giovanni.casoli@atengineering.it> for a 2.4.26 kernel.
I applied it to the 2.6.9 code.
3. provide stub for arch_get_unmapped_area
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/nommu.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index f749f023e565b6..c99c32fd30d11e 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -33,9 +33,10 @@ unsigned long askedalloc, realalloc; atomic_t vm_committed_space = ATOMIC_INIT(0); int sysctl_overcommit_memory = OVERCOMMIT_GUESS; /* heuristic overcommit */ int sysctl_overcommit_ratio = 50; /* default is 50% */ - int sysctl_max_map_count = DEFAULT_MAX_MAP_COUNT; + EXPORT_SYMBOL(sysctl_max_map_count); +EXPORT_SYMBOL(mem_map); /* * Handle all mappings that got truncated by a "truncate()" @@ -75,6 +76,8 @@ out: return -EFBIG; } +EXPORT_SYMBOL(vmtruncate); + /* * Return the total memory allocated for this pointer, not * just what the caller asked for. @@ -431,6 +434,7 @@ unsigned long do_mmap_pgoff( tblock->next = current->mm->context.tblock.next; current->mm->context.tblock.next = tblock; + current->mm->total_vm += len >> PAGE_SHIFT; #ifdef DEBUG printk("do_mmap:\n"); @@ -484,6 +488,7 @@ int do_munmap(struct mm_struct * mm, unsigned long addr, size_t len) realalloc -= kobjsize(tblock); askedalloc -= sizeof(struct mm_tblock_struct); kfree(tblock); + mm->total_vm -= len >> PAGE_SHIFT; #ifdef DEBUG show_process_blocks(); @@ -496,6 +501,7 @@ int do_munmap(struct mm_struct * mm, unsigned long addr, size_t len) void exit_mmap(struct mm_struct * mm) { struct mm_tblock_struct *tmp; + mm->total_vm = 0; if (!mm) return; @@ -575,3 +581,14 @@ unsigned long get_unmapped_area(struct file *file, unsigned long addr, void swap_unplug_io_fn(struct backing_dev_info *bdi, struct page *page) { } + +unsigned long arch_get_unmapped_area(struct file *file, unsigned long addr, + unsigned long len, unsigned long pgoff, unsigned long flags) +{ + return -ENOMEM; +} + +void arch_unmap_area(struct vm_area_struct *area) +{ +} + |