Skip to content

Commit c42ba5a

Browse files
t-8chKAGA-KOKO
authored andcommitted
futex: Store time as ktime_t in restart block
The futex core uses ktime_t to represent times, use that also for the restart block. This allows the simplification of the accessors. Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20251110-restart-block-expiration-v1-2-5d39cc93df4f@linutronix.de
1 parent cd91b50 commit c42ba5a

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

include/linux/restart_block.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct restart_block {
3232
u32 val;
3333
u32 flags;
3434
u32 bitset;
35-
u64 time;
35+
ktime_t time;
3636
u32 __user *uaddr2;
3737
} futex;
3838
/* For nanosleep */

kernel/futex/waitwake.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,12 +738,11 @@ int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, ktime_t *abs_time
738738
static long futex_wait_restart(struct restart_block *restart)
739739
{
740740
u32 __user *uaddr = restart->futex.uaddr;
741-
ktime_t t, *tp = NULL;
741+
ktime_t *tp = NULL;
742+
743+
if (restart->futex.flags & FLAGS_HAS_TIMEOUT)
744+
tp = &restart->futex.time;
742745

743-
if (restart->futex.flags & FLAGS_HAS_TIMEOUT) {
744-
t = restart->futex.time;
745-
tp = &t;
746-
}
747746
restart->fn = do_no_restart_syscall;
748747

749748
return (long)futex_wait(uaddr, restart->futex.flags,

0 commit comments

Comments
 (0)