Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

vdso/gettimeofday: Move the unlikely() into vdso_read_retry()

All callers of vdso_read_retry() test its return value with unlikely().
Move the unlikely into the helper to make the code easier to read.
This is equivalent to the retry function of non-vDSO seqlocks.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260227-vdso-cleanups-v1-4-c848b4bc4850@linutronix.de

authored by

Thomas Weißschuh and committed by
Borislav Petkov (AMD)
0c02d6df a657bebd

+6 -6
+1 -1
include/vdso/helpers.h
··· 53 53 54 54 smp_rmb(); 55 55 seq = READ_ONCE(vc->seq); 56 - return seq != start; 56 + return unlikely(seq != start); 57 57 } 58 58 59 59 static __always_inline void vdso_write_seq_begin(struct vdso_clock *vc)
+5 -5
lib/vdso/gettimeofday.c
··· 135 135 136 136 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) 137 137 return false; 138 - } while (unlikely(vdso_read_retry(vc, seq))); 138 + } while (vdso_read_retry(vc, seq)); 139 139 140 140 /* Add the namespace offset */ 141 141 sec += offs->sec; ··· 163 163 164 164 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) 165 165 return false; 166 - } while (unlikely(vdso_read_retry(vc, seq))); 166 + } while (vdso_read_retry(vc, seq)); 167 167 168 168 vdso_set_timespec(ts, sec, ns); 169 169 ··· 188 188 seq = vdso_read_begin(vc); 189 189 sec = vdso_ts->sec; 190 190 nsec = vdso_ts->nsec; 191 - } while (unlikely(vdso_read_retry(vc, seq))); 191 + } while (vdso_read_retry(vc, seq)); 192 192 193 193 /* Add the namespace offset */ 194 194 sec += offs->sec; ··· 212 212 213 213 ts->tv_sec = vdso_ts->sec; 214 214 ts->tv_nsec = vdso_ts->nsec; 215 - } while (unlikely(vdso_read_retry(vc, seq))); 215 + } while (vdso_read_retry(vc, seq)); 216 216 217 217 return true; 218 218 } ··· 244 244 245 245 if (!vdso_get_timestamp(vd, vc, VDSO_BASE_AUX, &sec, &ns)) 246 246 return false; 247 - } while (unlikely(vdso_read_retry(vc, seq))); 247 + } while (vdso_read_retry(vc, seq)); 248 248 249 249 vdso_set_timespec(ts, sec, ns); 250 250