Skip to content

Commit b097d5e

Browse files
committed
futex: Get rid of the val2 conditional dance
There is no point in checking which FUTEX operand treats the utime pointer as 'val2' argument because that argument to do_futex() is only used by exactly these operands. So just handing it in unconditionally is not making any difference, but removes a lot of pointless gunk. Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cdf78db commit b097d5e

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

kernel/futex.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,7 +3764,6 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
37643764
{
37653765
struct timespec64 ts;
37663766
ktime_t t, *tp = NULL;
3767-
u32 val2 = 0;
37683767
int cmd = op & FUTEX_CMD_MASK;
37693768

37703769
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
@@ -3784,15 +3783,8 @@ SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
37843783
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
37853784
tp = &t;
37863785
}
3787-
/*
3788-
* requeue parameter in 'utime' if cmd == FUTEX_*_REQUEUE_*.
3789-
* number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
3790-
*/
3791-
if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
3792-
cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
3793-
val2 = (u32) (unsigned long) utime;
37943786

3795-
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
3787+
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
37963788
}
37973789

37983790
#ifdef CONFIG_COMPAT
@@ -3960,7 +3952,6 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
39603952
{
39613953
struct timespec64 ts;
39623954
ktime_t t, *tp = NULL;
3963-
int val2 = 0;
39643955
int cmd = op & FUTEX_CMD_MASK;
39653956

39663957
if (utime && (cmd == FUTEX_WAIT || cmd == FUTEX_LOCK_PI ||
@@ -3978,11 +3969,8 @@ SYSCALL_DEFINE6(futex_time32, u32 __user *, uaddr, int, op, u32, val,
39783969
t = timens_ktime_to_host(CLOCK_MONOTONIC, t);
39793970
tp = &t;
39803971
}
3981-
if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
3982-
cmd == FUTEX_CMP_REQUEUE_PI || cmd == FUTEX_WAKE_OP)
3983-
val2 = (int) (unsigned long) utime;
39843972

3985-
return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
3973+
return do_futex(uaddr, op, val, tp, uaddr2, (unsigned long)utime, val3);
39863974
}
39873975
#endif /* CONFIG_COMPAT_32BIT_TIME */
39883976

0 commit comments

Comments
 (0)