[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130930114406.GZ3081@twins.programming.kicks-ass.net>
Date: Mon, 30 Sep 2013 13:44:06 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ingo Molnar <mingo@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Waiman Long <Waiman.Long@...com>, Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Rik van Riel <riel@...hat.com>,
Peter Hurley <peter@...leysoftware.com>,
Davidlohr Bueso <davidlohr.bueso@...com>,
Alex Shi <alex.shi@...el.com>,
Tim Chen <tim.c.chen@...ux.intel.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Matthew R Wilcox <matthew.r.wilcox@...el.com>,
Dave Hansen <dave.hansen@...el.com>,
Michel Lespinasse <walken@...gle.com>,
Andi Kleen <andi@...stfloor.org>,
"Chandramouleeswaran, Aswin" <aswin@...com>,
"Norton, Scott J" <scott.norton@...com>
Subject: Re: [PATCH, v2] anon_vmas: Convert the rwsem to an rwlock_t
On Sat, Sep 28, 2013 at 09:52:07PM +0200, Ingo Molnar wrote:
> Index: tip/mm/mmap.c
> ===================================================================
> --- tip.orig/mm/mmap.c
> +++ tip/mm/mmap.c
> @@ -2955,15 +2955,15 @@ static void vm_lock_anon_vma(struct mm_s
> * The LSB of head.next can't change from under us
> * because we hold the mm_all_locks_mutex.
> */
> - down_write_nest_lock(&anon_vma->root->rwsem, &mm->mmap_sem);
> + write_lock(&anon_vma->root->rwlock);
Tssk, you should know better...
But yes; this is the most horrid site; however I think it was mostly
file based VMAs that caused the immense amount of locks taken since this
is only done 'very' early on in the life of KVM.
I can't remember how early; I hope almost instantly and certainly before
spawning all the various vcpu threads as that would create all the
thread stacks which are anon and would indeed blow up the non-preempt
time here.
So if we keep i_mmap_mutex -- and I hope we do; that unmap_mutex horror
wasn't pretty at all -- see commit 97a894136 . The below shouldn't be
too bad I think/hope.
---
--- a/include/linux/rwlock.h
+++ b/include/linux/rwlock.h
@@ -64,6 +64,19 @@ do { \
#define write_lock(lock) _raw_write_lock(lock)
#define read_lock(lock) _raw_read_lock(lock)
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+# define write_lock_nest_lock(lock, nest_lock) \
+do { \
+ typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \
+ preempt_disable(); \
+ lock_acquire_exclusive(&lock->dep_map, 0, 0, \
+ &(nest_lock)->dep_map, _RET_IP_); \
+ LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); \
+} while (0)
+#else
+# define write_lock_nest_lock(lock, nest_lock) write_lock(lock)
+#endif
+
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
#define read_lock_irqsave(lock, flags) \
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2955,7 +2955,7 @@ static void vm_lock_anon_vma(struct mm_s
* The LSB of head.next can't change from under us
* because we hold the mm_all_locks_mutex.
*/
- write_lock(&anon_vma->root->rwlock);
+ write_lock_nest_lock(&anon_vma->root->rwlock);
/*
* We can safely modify head.next after taking the
* anon_vma->root->rwlock. If some other vma in this mm shares
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists