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>
This commit is contained in:

committed by
Linus Torvalds

parent
3b11630063
commit
f0be3d32b0
@@ -232,7 +232,7 @@ static struct vm_area_struct *remove_vma(struct vm_area_struct *vma)
|
||||
vma->vm_ops->close(vma);
|
||||
if (vma->vm_file)
|
||||
fput(vma->vm_file);
|
||||
mpol_free(vma_policy(vma));
|
||||
mpol_put(vma_policy(vma));
|
||||
kmem_cache_free(vm_area_cachep, vma);
|
||||
return next;
|
||||
}
|
||||
@@ -626,7 +626,7 @@ again: remove_next = 1 + (end > next->vm_end);
|
||||
if (file)
|
||||
fput(file);
|
||||
mm->map_count--;
|
||||
mpol_free(vma_policy(next));
|
||||
mpol_put(vma_policy(next));
|
||||
kmem_cache_free(vm_area_cachep, next);
|
||||
/*
|
||||
* In mprotect's case 6 (see comments on vma_merge),
|
||||
@@ -1182,7 +1182,7 @@ munmap_back:
|
||||
|
||||
if (file && vma_merge(mm, prev, addr, vma->vm_end,
|
||||
vma->vm_flags, NULL, file, pgoff, vma_policy(vma))) {
|
||||
mpol_free(vma_policy(vma));
|
||||
mpol_put(vma_policy(vma));
|
||||
kmem_cache_free(vm_area_cachep, vma);
|
||||
fput(file);
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user