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:
committed by
Linus Torvalds
parent
746b18d421
commit
2b575eb64f
@@ -92,12 +92,8 @@ extern void __split_huge_page_pmd(struct mm_struct *mm, pmd_t *pmd);
|
||||
#define wait_split_huge_page(__anon_vma, __pmd) \
|
||||
do { \
|
||||
pmd_t *____pmd = (__pmd); \
|
||||
spin_unlock_wait(&(__anon_vma)->root->lock); \
|
||||
/* \
|
||||
* spin_unlock_wait() is just a loop in C and so the \
|
||||
* CPU can reorder anything around it. \
|
||||
*/ \
|
||||
smp_mb(); \
|
||||
anon_vma_lock(__anon_vma); \
|
||||
anon_vma_unlock(__anon_vma); \
|
||||
BUG_ON(pmd_trans_splitting(*____pmd) || \
|
||||
pmd_trans_huge(*____pmd)); \
|
||||
} while (0)
|
||||
|
||||
@@ -150,7 +150,7 @@ struct mmu_notifier_ops {
|
||||
* Therefore notifier chains can only be traversed when either
|
||||
*
|
||||
* 1. mmap_sem is held.
|
||||
* 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->lock).
|
||||
* 2. One of the reverse map locks is held (i_mmap_mutex or anon_vma->mutex).
|
||||
* 3. No other concurrent thread can access the list (release)
|
||||
*/
|
||||
struct mmu_notifier {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user