diff options
author | Rik van Riel <riel@redhat.com> | 2010-08-09 20:18:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:44:55 -0400 |
commit | cba48b98f2348c814316c4b4f411a07a0e4a2bf9 (patch) | |
tree | 49c0426f8d41cb147722305c2c3495dd515c3253 /mm/ksm.c | |
parent | bb4a340e075b7897ece109686bfa177f8518d2db (diff) |
mm: change direct call of spin_lock(anon_vma->lock) to inline function
Subsitute a direct call of spin_lock(anon_vma->lock) with an inline
function doing exactly the same.
This makes it easier to do the substitution to the root anon_vma lock in a
following patch.
We will deal with the handful of special locks (nested, dec_and_lock, etc)
separately.
Signed-off-by: Rik van Riel <riel@redhat.com>
Acked-by: Mel Gorman <mel@csn.ul.ie>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Tested-by: Larry Woodman <lwoodman@redhat.com>
Acked-by: Larry Woodman <lwoodman@redhat.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/ksm.c')
-rw-r--r-- | mm/ksm.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -327,7 +327,7 @@ static void drop_anon_vma(struct rmap_item *rmap_item) | |||
327 | 327 | ||
328 | if (atomic_dec_and_lock(&anon_vma->external_refcount, &anon_vma->lock)) { | 328 | if (atomic_dec_and_lock(&anon_vma->external_refcount, &anon_vma->lock)) { |
329 | int empty = list_empty(&anon_vma->head); | 329 | int empty = list_empty(&anon_vma->head); |
330 | spin_unlock(&anon_vma->lock); | 330 | anon_vma_unlock(anon_vma); |
331 | if (empty) | 331 | if (empty) |
332 | anon_vma_free(anon_vma); | 332 | anon_vma_free(anon_vma); |
333 | } | 333 | } |
@@ -1566,7 +1566,7 @@ again: | |||
1566 | struct anon_vma_chain *vmac; | 1566 | struct anon_vma_chain *vmac; |
1567 | struct vm_area_struct *vma; | 1567 | struct vm_area_struct *vma; |
1568 | 1568 | ||
1569 | spin_lock(&anon_vma->lock); | 1569 | anon_vma_lock(anon_vma); |
1570 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { | 1570 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { |
1571 | vma = vmac->vma; | 1571 | vma = vmac->vma; |
1572 | if (rmap_item->address < vma->vm_start || | 1572 | if (rmap_item->address < vma->vm_start || |
@@ -1589,7 +1589,7 @@ again: | |||
1589 | if (!search_new_forks || !mapcount) | 1589 | if (!search_new_forks || !mapcount) |
1590 | break; | 1590 | break; |
1591 | } | 1591 | } |
1592 | spin_unlock(&anon_vma->lock); | 1592 | anon_vma_unlock(anon_vma); |
1593 | if (!mapcount) | 1593 | if (!mapcount) |
1594 | goto out; | 1594 | goto out; |
1595 | } | 1595 | } |
@@ -1619,7 +1619,7 @@ again: | |||
1619 | struct anon_vma_chain *vmac; | 1619 | struct anon_vma_chain *vmac; |
1620 | struct vm_area_struct *vma; | 1620 | struct vm_area_struct *vma; |
1621 | 1621 | ||
1622 | spin_lock(&anon_vma->lock); | 1622 | anon_vma_lock(anon_vma); |
1623 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { | 1623 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { |
1624 | vma = vmac->vma; | 1624 | vma = vmac->vma; |
1625 | if (rmap_item->address < vma->vm_start || | 1625 | if (rmap_item->address < vma->vm_start || |
@@ -1637,11 +1637,11 @@ again: | |||
1637 | ret = try_to_unmap_one(page, vma, | 1637 | ret = try_to_unmap_one(page, vma, |
1638 | rmap_item->address, flags); | 1638 | rmap_item->address, flags); |
1639 | if (ret != SWAP_AGAIN || !page_mapped(page)) { | 1639 | if (ret != SWAP_AGAIN || !page_mapped(page)) { |
1640 | spin_unlock(&anon_vma->lock); | 1640 | anon_vma_unlock(anon_vma); |
1641 | goto out; | 1641 | goto out; |
1642 | } | 1642 | } |
1643 | } | 1643 | } |
1644 | spin_unlock(&anon_vma->lock); | 1644 | anon_vma_unlock(anon_vma); |
1645 | } | 1645 | } |
1646 | if (!search_new_forks++) | 1646 | if (!search_new_forks++) |
1647 | goto again; | 1647 | goto again; |
@@ -1671,7 +1671,7 @@ again: | |||
1671 | struct anon_vma_chain *vmac; | 1671 | struct anon_vma_chain *vmac; |
1672 | struct vm_area_struct *vma; | 1672 | struct vm_area_struct *vma; |
1673 | 1673 | ||
1674 | spin_lock(&anon_vma->lock); | 1674 | anon_vma_lock(anon_vma); |
1675 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { | 1675 | list_for_each_entry(vmac, &anon_vma->head, same_anon_vma) { |
1676 | vma = vmac->vma; | 1676 | vma = vmac->vma; |
1677 | if (rmap_item->address < vma->vm_start || | 1677 | if (rmap_item->address < vma->vm_start || |
@@ -1688,11 +1688,11 @@ again: | |||
1688 | 1688 | ||
1689 | ret = rmap_one(page, vma, rmap_item->address, arg); | 1689 | ret = rmap_one(page, vma, rmap_item->address, arg); |
1690 | if (ret != SWAP_AGAIN) { | 1690 | if (ret != SWAP_AGAIN) { |
1691 | spin_unlock(&anon_vma->lock); | 1691 | anon_vma_unlock(anon_vma); |
1692 | goto out; | 1692 | goto out; |
1693 | } | 1693 | } |
1694 | } | 1694 | } |
1695 | spin_unlock(&anon_vma->lock); | 1695 | anon_vma_unlock(anon_vma); |
1696 | } | 1696 | } |
1697 | if (!search_new_forks++) | 1697 | if (!search_new_forks++) |
1698 | goto again; | 1698 | goto again; |