]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
futex: Store time as ktime_t in restart block
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Mon, 10 Nov 2025 09:38:52 +0000 (10:38 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Fri, 14 Nov 2025 15:29:53 +0000 (16:29 +0100)
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
include/linux/restart_block.h
kernel/futex/waitwake.c

index 7e50bbc94e476c599eb1185e02b6e87854fc3eb8..4f9316e7590d95e03ca48975482416b9fb2ae8f0 100644 (file)
@@ -32,7 +32,7 @@ struct restart_block {
                        u32 val;
                        u32 flags;
                        u32 bitset;
-                       u64 time;
+                       ktime_t time;
                        u32 __user *uaddr2;
                } futex;
                /* For nanosleep */
index e2bbe5509ec27a18785227358d4ff8d8f913ddc1..1c2dd03f11ec4e5d34d1a9f67ef01e05604b3bac 100644 (file)
@@ -738,12 +738,11 @@ int futex_wait(u32 __user *uaddr, unsigned int flags, u32 val, ktime_t *abs_time
 static long futex_wait_restart(struct restart_block *restart)
 {
        u32 __user *uaddr = restart->futex.uaddr;
-       ktime_t t, *tp = NULL;
+       ktime_t *tp = NULL;
+
+       if (restart->futex.flags & FLAGS_HAS_TIMEOUT)
+               tp = &restart->futex.time;
 
-       if (restart->futex.flags & FLAGS_HAS_TIMEOUT) {
-               t = restart->futex.time;
-               tp = &t;
-       }
        restart->fn = do_no_restart_syscall;
 
        return (long)futex_wait(uaddr, restart->futex.flags,