Thread (40 messages) 40 messages, 7 authors, 2021-01-01

Re: [patch 10/19] preempt: Cleanup the macro maze a bit

From: Peter Zijlstra <peterz@infradead.org>
Date: 2020-11-17 10:22:15
Also in: linux-um, lkml

On Mon, Nov 16, 2020 at 06:42:19PM +0100, Thomas Gleixner wrote:
On Mon, Nov 16 2020 at 13:17, Peter Zijlstra wrote:
quoted
On Fri, Nov 13, 2020 at 03:02:17PM +0100, Thomas Gleixner wrote:
quoted
-#define irq_count()	(preempt_count() & (HARDIRQ_MASK | SOFTIRQ_MASK \
-				 | NMI_MASK))
+#define irq_count()	(nmi_count() | hardirq_count() | softirq_count())
quoted
+#define in_task()		(!(in_nmi() | in_hardirq() | in_serving_softirq()))
-#define in_task()		(!(preempt_count() & \
-				   (NMI_MASK | HARDIRQ_MASK | SOFTIRQ_OFFSET)))
How horrible is the code-gen? Because preempt_count() is
raw_cpu_read_4() and at least some old compilers will refuse to CSE it
(consider the this_cpu_read_stable mess).
I looked at gcc8 and 10 output and the compilers are smart enough to
fold it for the !RT case. But yeah ...
If recent GCC is smart enough I suppose it doesn't matter, thanks!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help