diff options
author | Lee Schermerhorn <lee.schermerhorn@hp.com> | 2008-04-28 05:13:08 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:23 -0400 |
commit | f0be3d32b05d3fea2fcdbbb81a39dac2a7163169 (patch) | |
tree | 5794ce6a8befbce82cd3e44ff15fbf3bb5f2f3bf /mm/mmap.c | |
parent | 3b1163006332302117b1b2acf226d4014ff46525 (diff) |
mempolicy: rename mpol_free to mpol_put
This is a change that was requested some time ago by Mel Gorman. Makes sense
to me, so here it is.
Note: I retain the name "mpol_free_shared_policy()" because it actually does
free the shared_policy, which is NOT a reference counted object. However, ...
The mempolicy object[s] referenced by the shared_policy are reference counted,
so mpol_put() is used to release the reference held by the shared_policy. The
mempolicy might not be freed at this time, because some task attached to the
shared object associated with the shared policy may be in the process of
allocating a page based on the mempolicy. In that case, the task performing
the allocation will hold a reference on the mempolicy, obtained via
mpol_shared_policy_lookup(). The mempolicy will be freed when all tasks
holding such a reference have called mpol_put() for the mempolicy.
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -232,7 +232,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma) | |||
232 | vma->vm_ops->close(vma); | 232 | vma->vm_ops->close(vma); |
233 | if (vma->vm_file) | 233 | if (vma->vm_file) |
234 | fput(vma->vm_file); | 234 | fput(vma->vm_file); |
235 | mpol_free(vma_policy(vma)); | 235 | mpol_put(vma_policy(vma)); |
236 | kmem_cache_free(vm_area_cachep, vma); | 236 | kmem_cache_free(vm_area_cachep, vma); |
237 | return next; | 237 | return next; |
238 | } | 238 | } |
@@ -626,7 +626,7 @@ again: remove_next = 1 + (end > next->vm_end); | |||
626 | if (file) | 626 | if (file) |
627 | fput(file); | 627 | fput(file); |
628 | mm->map_count--; | 628 | mm->map_count--; |
629 | mpol_free(vma_policy(next)); | 629 | mpol_put(vma_policy(next)); |
630 | kmem_cache_free(vm_area_cachep, next); | 630 | kmem_cache_free(vm_area_cachep, next); |
631 | /* | 631 | /* |
632 | * In mprotect's case 6 (see comments on vma_merge), | 632 | * In mprotect's case 6 (see comments on vma_merge), |
@@ -1182,7 +1182,7 @@ munmap_back: | |||
1182 | 1182 | ||
1183 | if (file && vma_merge(mm, prev, addr, vma->vm_end, | 1183 | if (file && vma_merge(mm, prev, addr, vma->vm_end, |
1184 | vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) { | 1184 | vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) { |
1185 | mpol_free(vma_policy(vma)); | 1185 | mpol_put(vma_policy(vma)); |
1186 | kmem_cache_free(vm_area_cachep, vma); | 1186 | kmem_cache_free(vm_area_cachep, vma); |
1187 | fput(file); | 1187 | fput(file); |
1188 | } else { | 1188 | } else { |