Skip to content

Commit 53a42b6

Browse files
danglin44hdeller
authored andcommitted
parisc: Switch to more fine grained lws locks
Increase the number of lws locks to 256 entries (instead of 16) and choose lock entry based on bits 3-11 (instead of 4-7) of the relevant address. With this change we archieve more fine-grained locking in futex syscalls and thus reduce the number of possible stalls. Signed-off-by: John David Anglin <dave.anglin@bell.net> Signed-off-by: Helge Deller <deller@gmx.de>
1 parent 2a7d4ee commit 53a42b6

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

‎arch/parisc/include/asm/futex.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static inline void
1616
_futex_spin_lock_irqsave(u32 __user *uaddr, unsigned long int *flags)
1717
{
1818
extern u32 lws_lock_start[];
19-
long index = ((long)uaddr & 0xf0) >> 2;
19+
long index = ((long)uaddr & 0x3f8) >> 1;
2020
arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
2121
local_irq_save(*flags);
2222
arch_spin_lock(s);
@@ -26,7 +26,7 @@ static inline void
2626
_futex_spin_unlock_irqrestore(u32 __user *uaddr, unsigned long int *flags)
2727
{
2828
extern u32 lws_lock_start[];
29-
long index = ((long)uaddr & 0xf0) >> 2;
29+
long index = ((long)uaddr & 0x3f8) >> 1;
3030
arch_spinlock_t *s = (arch_spinlock_t *)&lws_lock_start[index];
3131
arch_spin_unlock(s);
3232
local_irq_restore(*flags);

‎arch/parisc/kernel/syscall.S‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,8 +571,8 @@ lws_compare_and_swap:
571571
ldil L%lws_lock_start, %r20
572572
ldo R%lws_lock_start(%r20), %r28
573573

574-
/* Extract four bits from r26 and hash lock (Bits 4-7) */
575-
extru %r26, 27, 4, %r20
574+
/* Extract eight bits from r26 and hash lock (Bits 3-11) */
575+
extru %r26, 28, 8, %r20
576576

577577
/* Find lock to use, the hash is either one of 0 to
578578
15, multiplied by 16 (keep it 16-byte aligned)
@@ -761,8 +761,8 @@ cas2_lock_start:
761761
ldil L%lws_lock_start, %r20
762762
ldo R%lws_lock_start(%r20), %r28
763763

764-
/* Extract four bits from r26 and hash lock (Bits 4-7) */
765-
extru %r26, 27, 4, %r20
764+
/* Extract eight bits from r26 and hash lock (Bits 3-11) */
765+
extru %r26, 28, 8, %r20
766766

767767
/* Find lock to use, the hash is either one of 0 to
768768
15, multiplied by 16 (keep it 16-byte aligned)
@@ -950,7 +950,7 @@ END(sys_call_table64)
950950
.align L1_CACHE_BYTES
951951
ENTRY(lws_lock_start)
952952
/* lws locks */
953-
.rept 16
953+
.rept 256
954954
/* Keep locks aligned at 16-bytes */
955955
.word 1
956956
.word 0

0 commit comments

Comments
 (0)