From 868644397c960e77719c868a0214af6da243e391 Mon Sep 17 00:00:00 2001 From: David Howells Date: Fri, 15 Jan 2010 17:01:33 -0800 Subject: [PATCH] --- yaml --- r: 179359 b: refs/heads/master c: 1e2ae599d37e60958c03ca5e46b1f657619a30cd h: refs/heads/master i: 179357: e96d60a266f8ea13eee422452803ee2624e04059 179355: 813b16ff4d8932800f53d6dca17401b16179b340 179351: 31036ddcf8432cfdaf997172bf2050543b21dd61 179343: 88b1043815f06d70ab6ebb83dcda68cb4caafc19 179327: a979254a0b66640478ac181b9f236478f7d1e297 v: v3 --- [refs] | 2 +- trunk/include/linux/mm_types.h | 2 +- trunk/mm/nommu.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index de33619dc237..1ec0e883912d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: ed5e5894b234ce4793d78078c026915b853e0678 +refs/heads/master: 1e2ae599d37e60958c03ca5e46b1f657619a30cd diff --git a/trunk/include/linux/mm_types.h b/trunk/include/linux/mm_types.h index 84d020bed083..80cfa78a8cf6 100644 --- a/trunk/include/linux/mm_types.h +++ b/trunk/include/linux/mm_types.h @@ -122,7 +122,7 @@ struct vm_region { unsigned long vm_pgoff; /* the offset in vm_file corresponding to vm_start */ struct file *vm_file; /* the backing file or NULL */ - atomic_t vm_usage; /* region usage count */ + int vm_usage; /* region usage count (access under nommu_region_sem) */ bool vm_icache_flushed : 1; /* true if the icache has been flushed for * this region */ }; diff --git a/trunk/mm/nommu.c b/trunk/mm/nommu.c index 17773862619b..5e39294f8ea8 100644 --- a/trunk/mm/nommu.c +++ b/trunk/mm/nommu.c @@ -552,11 +552,11 @@ static void free_page_series(unsigned long from, unsigned long to) static void __put_nommu_region(struct vm_region *region) __releases(nommu_region_sem) { - kenter("%p{%d}", region, atomic_read(®ion->vm_usage)); + kenter("%p{%d}", region, region->vm_usage); BUG_ON(!nommu_region_tree.rb_node); - if (atomic_dec_and_test(®ion->vm_usage)) { + if (--region->vm_usage == 0) { if (region->vm_top > region->vm_start) delete_nommu_region(region); up_write(&nommu_region_sem); @@ -1205,7 +1205,7 @@ unsigned long do_mmap_pgoff(struct file *file, if (!vma) goto error_getting_vma; - atomic_set(®ion->vm_usage, 1); + region->vm_usage = 1; region->vm_flags = vm_flags; region->vm_pgoff = pgoff; @@ -1272,7 +1272,7 @@ unsigned long do_mmap_pgoff(struct file *file, } /* we've found a region we can share */ - atomic_inc(&pregion->vm_usage); + pregion->vm_usage++; vma->vm_region = pregion; start = pregion->vm_start; start += (pgoff - pregion->vm_pgoff) << PAGE_SHIFT; @@ -1289,7 +1289,7 @@ unsigned long do_mmap_pgoff(struct file *file, vma->vm_region = NULL; vma->vm_start = 0; vma->vm_end = 0; - atomic_dec(&pregion->vm_usage); + pregion->vm_usage--; pregion = NULL; goto error_just_free; } @@ -1444,7 +1444,7 @@ int split_vma(struct mm_struct *mm, struct vm_area_struct *vma, /* we're only permitted to split anonymous regions that have a single * owner */ if (vma->vm_file || - atomic_read(&vma->vm_region->vm_usage) != 1) + vma->vm_region->vm_usage != 1) return -ENOMEM; if (mm->map_count >= sysctl_max_map_count) @@ -1518,7 +1518,7 @@ static int shrink_vma(struct mm_struct *mm, /* cut the backing region down to size */ region = vma->vm_region; - BUG_ON(atomic_read(®ion->vm_usage) != 1); + BUG_ON(region->vm_usage != 1); down_write(&nommu_region_sem); delete_nommu_region(region);