Re: [PATCH v3 4/5] mutex: Remove new typedefs introduced in patch 2
* Waiman Long wrote: > In response to the review comment from Davidlohr, this patch will > remove the new typedefs introduced by patch 2. It also removes an > unnecessary barrier() call. Please backmerge this fix of patch #2 into patch #2, that reduces the number of patches by one. Thanks, Ingo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 4/5] mutex: Remove new typedefs introduced in patch 2
* Waiman Long waiman.l...@hp.com wrote: In response to the review comment from Davidlohr, this patch will remove the new typedefs introduced by patch 2. It also removes an unnecessary barrier() call. Please backmerge this fix of patch #2 into patch #2, that reduces the number of patches by one. Thanks, Ingo -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/5] mutex: Remove new typedefs introduced in patch 2
In response to the review comment from Davidlohr, this patch will remove the new typedefs introduced by patch 2. It also removes an unnecessary barrier() call. Signed-off-by: Waiman Long --- kernel/mutex.c | 25 +++-- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/kernel/mutex.c b/kernel/mutex.c index 5600bdf..140f113 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -113,18 +113,16 @@ EXPORT_SYMBOL(mutex_lock); * We don't inline mspin_lock() so that perf can correctly account for the * time spent in this lock function. */ -typedef struct mspin_node { - struct mspin_node *next; - intlocked; /* 1 if lock acquired */ -} mspin_node_t; - -typedef mspin_node_t *mspin_lock_t; - -#defineMLOCK(mutex)((mspin_lock_t *)&((mutex)->spin_mlock)) - -static noinline void mspin_lock(mspin_lock_t *lock, mspin_node_t *node) +struct mspin_node { + struct mspin_node *next ; + int locked; /* 1 if lock acquired */ +}; +#defineMLOCK(mutex)((struct mspin_node **)&((mutex)->spin_mlock)) + +static noinline +void mspin_lock(struct mspin_node **lock, struct mspin_node *node) { - mspin_node_t *prev; + struct mspin_node *prev; /* Init node */ node->locked = 0; @@ -143,9 +141,9 @@ static noinline void mspin_lock(mspin_lock_t *lock, mspin_node_t *node) arch_mutex_cpu_relax(); } -static void mspin_unlock(mspin_lock_t *lock, mspin_node_t *node) +static void mspin_unlock(struct mspin_node **lock, struct mspin_node *node) { - mspin_node_t *next = ACCESS_ONCE(node->next); + struct mspin_node *next = ACCESS_ONCE(node->next); if (likely(!next)) { /* @@ -157,7 +155,6 @@ static void mspin_unlock(mspin_lock_t *lock, mspin_node_t *node) while (!(next = ACCESS_ONCE(node->next))) arch_mutex_cpu_relax(); } - barrier(); ACCESS_ONCE(next->locked) = 1; smp_wmb(); } @@ -237,7 +234,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, for (;;) { struct task_struct *owner; - mspin_node_tnode; + struct mspin_node node; /* * If there's an owner, wait for it to either -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 4/5] mutex: Remove new typedefs introduced in patch 2
In response to the review comment from Davidlohr, this patch will remove the new typedefs introduced by patch 2. It also removes an unnecessary barrier() call. Signed-off-by: Waiman Long waiman.l...@hp.com --- kernel/mutex.c | 25 +++-- 1 files changed, 11 insertions(+), 14 deletions(-) diff --git a/kernel/mutex.c b/kernel/mutex.c index 5600bdf..140f113 100644 --- a/kernel/mutex.c +++ b/kernel/mutex.c @@ -113,18 +113,16 @@ EXPORT_SYMBOL(mutex_lock); * We don't inline mspin_lock() so that perf can correctly account for the * time spent in this lock function. */ -typedef struct mspin_node { - struct mspin_node *next; - intlocked; /* 1 if lock acquired */ -} mspin_node_t; - -typedef mspin_node_t *mspin_lock_t; - -#defineMLOCK(mutex)((mspin_lock_t *)((mutex)-spin_mlock)) - -static noinline void mspin_lock(mspin_lock_t *lock, mspin_node_t *node) +struct mspin_node { + struct mspin_node *next ; + int locked; /* 1 if lock acquired */ +}; +#defineMLOCK(mutex)((struct mspin_node **)((mutex)-spin_mlock)) + +static noinline +void mspin_lock(struct mspin_node **lock, struct mspin_node *node) { - mspin_node_t *prev; + struct mspin_node *prev; /* Init node */ node-locked = 0; @@ -143,9 +141,9 @@ static noinline void mspin_lock(mspin_lock_t *lock, mspin_node_t *node) arch_mutex_cpu_relax(); } -static void mspin_unlock(mspin_lock_t *lock, mspin_node_t *node) +static void mspin_unlock(struct mspin_node **lock, struct mspin_node *node) { - mspin_node_t *next = ACCESS_ONCE(node-next); + struct mspin_node *next = ACCESS_ONCE(node-next); if (likely(!next)) { /* @@ -157,7 +155,6 @@ static void mspin_unlock(mspin_lock_t *lock, mspin_node_t *node) while (!(next = ACCESS_ONCE(node-next))) arch_mutex_cpu_relax(); } - barrier(); ACCESS_ONCE(next-locked) = 1; smp_wmb(); } @@ -237,7 +234,7 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass, for (;;) { struct task_struct *owner; - mspin_node_tnode; + struct mspin_node node; /* * If there's an owner, wait for it to either -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/