* [PATCH v2] locking/qspinlock: Use __this_cpu_dec instead
@ 2016-06-14 6:37 Pan Xinhui
2016-06-27 12:56 ` [tip:locking/core] locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec() tip-bot for Pan Xinhui
0 siblings, 1 reply; 2+ messages in thread
From: Pan Xinhui @ 2016-06-14 6:37 UTC (permalink / raw)
To: linux-kernel; +Cc: peterz, mingo, Waiman.Long, Pan Xinhui
queued_spin_lock_slowpath should not worry about another
queued_spin_lock_slowpath which runs in interrupt changes node->count by
accident because node->count keeps the same value everytime we
enter/leave queued_spin_lock_slowpath.
On some archs this_cpu_dec will save/restore irq flags, this will give a
heavy work load. Lets use __this_cpu_dec instead.
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
---
change from v1:
replace this_cpu_ptr with __this_cpu_dec
---
kernel/locking/qspinlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 99f31e4..9fd1a1e 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -492,7 +492,7 @@ release:
/*
* release the node
*/
- this_cpu_dec(mcs_nodes[0].count);
+ __this_cpu_dec(mcs_nodes[0].count);
}
EXPORT_SYMBOL(queued_spin_lock_slowpath);
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [tip:locking/core] locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec()
2016-06-14 6:37 [PATCH v2] locking/qspinlock: Use __this_cpu_dec instead Pan Xinhui
@ 2016-06-27 12:56 ` tip-bot for Pan Xinhui
0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Pan Xinhui @ 2016-06-27 12:56 UTC (permalink / raw)
To: linux-tip-commits
Cc: mingo, torvalds, efault, hpa, peterz, tglx, xinhui.pan, linux-kernel
Commit-ID: 0dceeaf599e6d9b8bd908ba4bd3dfee84aa26be2
Gitweb: http://git.kernel.org/tip/0dceeaf599e6d9b8bd908ba4bd3dfee84aa26be2
Author: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
AuthorDate: Tue, 14 Jun 2016 14:37:27 +0800
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 27 Jun 2016 11:37:41 +0200
locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec()
queued_spin_lock_slowpath() should not worry about another
queued_spin_lock_slowpath() running in interrupt context and
changing node->count by accident, because node->count keeps
the same value every time we enter/leave queued_spin_lock_slowpath().
On some architectures this_cpu_dec() will save/restore irq flags,
which has high overhead. Use the much cheaper __this_cpu_dec() instead.
Signed-off-by: Pan Xinhui <xinhui.pan@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman.Long@hpe.com
Link: http://lkml.kernel.org/r/1465886247-3773-1-git-send-email-xinhui.pan@linux.vnet.ibm.com
[ Rewrote changelog. ]
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/locking/qspinlock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/locking/qspinlock.c b/kernel/locking/qspinlock.c
index 7306555..b2caec7 100644
--- a/kernel/locking/qspinlock.c
+++ b/kernel/locking/qspinlock.c
@@ -619,7 +619,7 @@ release:
/*
* release the node
*/
- this_cpu_dec(mcs_nodes[0].count);
+ __this_cpu_dec(mcs_nodes[0].count);
}
EXPORT_SYMBOL(queued_spin_lock_slowpath);
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-06-27 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-14 6:37 [PATCH v2] locking/qspinlock: Use __this_cpu_dec instead Pan Xinhui
2016-06-27 12:56 ` [tip:locking/core] locking/qspinlock: Use __this_cpu_dec() instead of full-blown this_cpu_dec() tip-bot for Pan Xinhui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).