Skip to contentSkip to conversation

arm: Add for atomic half word exchange

RFC Sarbojit Ganguly 3 participants 3 messages May 20, 2015

lore
Share & tools
lore
#0 lore raw

Yes, the main advantage of Qspinlock code can be observed in NUMA but when I tested in an embedded system, a slight advantage was observed.

------- Original Message -------
Sender : Peter Zijlstra<[email protected]> Date : May 19, 2015 21:43 (GMT+09:00)
Title : Re: [RFC] arm: Add for atomic half word exchange

Quoted 4 lines · Sarbojit Ganguly
Quoted 3 lines · On Tuesday 19 May 2015 09:39:33 Sarbojit Ganguly wrote:

Since 16 bit half word exchange was not there and MCS based qspinlock by Waiman's xchg_tail() requires an atomic exchange on a half word, here is a small modification to __xchg() code.

Can you actually see a performance improvement with the qspinlock code on ARM ?

The real improvements on x86 were on NUMA systems; although there were real improvements on light loads as well.

Note that ARM (or any load-store arch) could get rid of all the cmpxchg loops in that code. Although I suppose we replaced the most common ones with these unconditional atomics already -- like that xchg16 -- so implementing those with ll/sc, as you did, should be near optimal.

?????
??? ?? ?? ??
----------------------------------------------------------------------+

The Tao lies beyond Yin and Yang. It is silent and still as a pool of water.      |
It does not seek fame, therefore nobody knows its presence.                       |
It does not seek fortune, for it is complete within itself.                       |
It exists beyond space and time.                                                  |

----------------------------------------------------------------------+ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ¥Šwÿº{.nÇ+‰·¥Š{±þG«�éÿŠ{ayºʇڙë,j­¢f£¢·hš�ï�êÿ‘êçz_è®(­éšŽŠÝ¢j"�ú¶m§ÿÿ¾«þG«�éÿ¢¸?™¨è­Ú&£ø§~�á¶iO•æ¬z·švØ^¶m§ÿÿà ÿ¶ìÿ¢¸?–I¥

#1 lore raw
Quoted 18 lines · On Wednesday 20 May 2015 05:09:35 Sarbojit Ganguly wrote:
Quoted 18 lines

------- Original Message -------
Sender : Peter Zijlstra<[email protected]> Date : May 19, 2015 21:43 (GMT+09:00)
Title : Re: [RFC] arm: Add for atomic half word exchange

Quoted 4 lines · Sarbojit Ganguly
Quoted 3 lines · On Tuesday 19 May 2015 09:39:33 Sarbojit Ganguly wrote:

Since 16 bit half word exchange was not there and MCS based qspinlock by Waiman's xchg_tail() requires an atomic exchange on a half word, here is a small modification to __xchg() code.

Can you actually see a performance improvement with the qspinlock code on ARM ?

The real improvements on x86 were on NUMA systems; although there were real improvements on light loads as well.

Quoted 7 lines
Quoted 4 lines

Note that ARM (or any load-store arch) could get rid of all the cmpxchg loops in that code. Although I suppose we replaced the most common ones with these unconditional atomics already -- like that xchg16 -- so implementing those with ll/sc, as you did, should be near optimal.

Yes, the main advantage of Qspinlock code can be observed in NUMA but when I tested in an embedded system, a slight advantage was observed.

Is this a multi-cluster SMP system? Those can behave like NUMA machines in some ways.

We could easily limit the use of 16-bit xchg() to ARMv7 machines by using

select ARCH_USE_QUEUED_SPINLOCKS if !SMP_ON_UP

or

select ARCH_USE_QUEUED_SPINLOCKS if !CPU_V6

when enabling the qspinlock implementation.

Arnd

#2 lore raw
In reply to Sarbojit Ganguly
Quoted 2 lines · Sarbojit Ganguly

Yes, the main advantage of Qspinlock code can be observed in NUMA but when I tested in an embedded system, a slight advantage was observed.

OK, great!

This is the first !x86 port I'm aware of and a load-store arch at that, so its good to hear our efforts at making it generic actually paid off.