mm: convert anon_vma->lock to a mutex
Straightforward conversion of anon_vma->lock to a mutex. Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Acked-by: Hugh Dickins <hughd@google.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: David Miller <davem@davemloft.net> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Russell King <rmk@arm.linux.org.uk> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Richard Weinberger <richard@nod.at> Cc: Tony Luck <tony.luck@intel.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Mel Gorman <mel@csn.ul.ie> Cc: Nick Piggin <npiggin@kernel.dk> Cc: Namhyung Kim <namhyung@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
746b18d421
commit
2b575eb64f
6 changed files with 21 additions and 25 deletions
|
@ -7,7 +7,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/memcontrol.h>
|
||||
|
||||
/*
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
struct anon_vma {
|
||||
struct anon_vma *root; /* Root of this anon_vma tree */
|
||||
spinlock_t lock; /* Serialize access to vma list */
|
||||
struct mutex mutex; /* Serialize access to vma list */
|
||||
/*
|
||||
* The refcount is taken on an anon_vma when there is no
|
||||
* guarantee that the vma of page tables will exist for
|
||||
|
@ -64,7 +64,7 @@ struct anon_vma_chain {
|
|||
struct vm_area_struct *vma;
|
||||
struct anon_vma *anon_vma;
|
||||
struct list_head same_vma; /* locked by mmap_sem & page_table_lock */
|
||||
struct list_head same_anon_vma; /* locked by anon_vma->lock */
|
||||
struct list_head same_anon_vma; /* locked by anon_vma->mutex */
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
|
@ -93,24 +93,24 @@ static inline void vma_lock_anon_vma(struct vm_area_struct *vma)
|
|||
{
|
||||
struct anon_vma *anon_vma = vma->anon_vma;
|
||||
if (anon_vma)
|
||||
spin_lock(&anon_vma->root->lock);
|
||||
mutex_lock(&anon_vma->root->mutex);
|
||||
}
|
||||
|
||||
static inline void vma_unlock_anon_vma(struct vm_area_struct *vma)
|
||||
{
|
||||
struct anon_vma *anon_vma = vma->anon_vma;
|
||||
if (anon_vma)
|
||||
spin_unlock(&anon_vma->root->lock);
|
||||
mutex_unlock(&anon_vma->root->mutex);
|
||||
}
|
||||
|
||||
static inline void anon_vma_lock(struct anon_vma *anon_vma)
|
||||
{
|
||||
spin_lock(&anon_vma->root->lock);
|
||||
mutex_lock(&anon_vma->root->mutex);
|
||||
}
|
||||
|
||||
static inline void anon_vma_unlock(struct anon_vma *anon_vma)
|
||||
{
|
||||
spin_unlock(&anon_vma->root->lock);
|
||||
mutex_unlock(&anon_vma->root->mutex);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue