From nobody Thu Apr 9 13:31:44 2026 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC2DD36BCFB for ; Fri, 27 Feb 2026 06:43:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772174611; cv=none; b=Qp/OaCVNMfCysEmgzu+x+0pgeMLtJq1b/ZOXRsyLd1uH8ONjLAsxmuVwLoykjloWN9JtP5///h8+KtTZRB65Gtcjx1rMf9WUnV6tp1+0xQZ8WCvJ7EQsWoOVSBTkneJ3kWHxPmtSrvzVd4i+Rkos5S3aRCu9iJZcahmQeNBUSfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772174611; c=relaxed/simple; bh=B728YZhNcQvokXW742SAlvfLm7RygQwiwjUvQYwGf8c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A516FmfiHPiP0ID+KLSSPxaGVz/oZPgvSoAKK0wTzvwGoB2JTtC7T8D7xXcjuErxJIMItRYHanZLSVUIku9IKJqXiXHaXkSj2oaJ6LWZU4/S7muGzpDQ0hgzzqdy3Z5v5Q6CnocIHy/mWG1GMoL33by07/cACCiRbkIROn7yKqE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=FX3SsBcZ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ottWXq27; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FX3SsBcZ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ottWXq27" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1772174608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LjM8Alndx+Wez0AGXYd0pbIxbZzf0Fg1Fhsub7+n4I8=; b=FX3SsBcZgcFl759LZXKMCEQOTdEw7DWReT6ts4KCvEi15Av7R5iuKyU4mt9HLZuYd2tfV9 4B+iSPyw9OQvxkwOAuVi/84RxAf35Ud8TiFX2LWEWnffZ304FywJJTGtpY3Kq9/XX+LgD0 3e8t/ocGuvXEvMkCSMpJZ7uRFYUpzQAxvxIJXAf/J+0SDspRbmwbGF46ck6XYCDyqxZnOT j3N/ANwBcy1d8pV7tUw2vajXMzlaJ0WTyvgyXVsvg3Bf36KtF0nocjlUhct1Wrw4s2A5Dr 0/bjxR8tBe2+AdfTXOsEcy0fCboHg0/SHVCp35hb7/KSg3qOV7+VmgFmKFFOtQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1772174608; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LjM8Alndx+Wez0AGXYd0pbIxbZzf0Fg1Fhsub7+n4I8=; b=ottWXq27KqkuhupCjCMXF5RF3e59ZAuV4HGzNICDKjzWYcY6ZqatoqRtGP+BlRoeitQxLf gWD3GO00t7y5SXDA== Date: Fri, 27 Feb 2026 07:43:23 +0100 Subject: [PATCH 4/4] vdso/gettimeofday: Move the unlikely() into vdso_read_retry() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260227-vdso-cleanups-v1-4-c848b4bc4850@linutronix.de> References: <20260227-vdso-cleanups-v1-0-c848b4bc4850@linutronix.de> In-Reply-To: <20260227-vdso-cleanups-v1-0-c848b4bc4850@linutronix.de> To: Andy Lutomirski , Thomas Gleixner , Vincenzo Frascino Cc: linux-kernel@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1772174604; l=2574; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=B728YZhNcQvokXW742SAlvfLm7RygQwiwjUvQYwGf8c=; b=1kTbqImzaDlvx3uzl0XB8gKmpSEIskfBXpSS52zpPq5SfPtloRda3JyfBZSHpSUJoB8NfBWni 3m4nDEvtmMGDGaYJhrFC0p5DOSzhWan4P7CoRBf5SpQcTSlAVf1tqSO X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= 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=C3=9Fschuh --- include/vdso/helpers.h | 2 +- lib/vdso/gettimeofday.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/vdso/helpers.h b/include/vdso/helpers.h index 3dd67ed85c2e..9e967c2c6d20 100644 --- a/include/vdso/helpers.h +++ b/include/vdso/helpers.h @@ -53,7 +53,7 @@ static __always_inline u32 vdso_read_retry(const struct v= dso_clock *vc, =20 smp_rmb(); seq =3D READ_ONCE(vc->seq); - return seq !=3D start; + return unlikely(seq !=3D start); } =20 static __always_inline void vdso_write_seq_begin(struct vdso_clock *vc) diff --git a/lib/vdso/gettimeofday.c b/lib/vdso/gettimeofday.c index 2faed7851635..efd1b82af614 100644 --- a/lib/vdso/gettimeofday.c +++ b/lib/vdso/gettimeofday.c @@ -135,7 +135,7 @@ bool do_hres_timens(const struct vdso_time_data *vdns, = const struct vdso_clock * =20 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 /* Add the namespace offset */ sec +=3D offs->sec; @@ -163,7 +163,7 @@ bool do_hres(const struct vdso_time_data *vd, const str= uct vdso_clock *vc, =20 if (!vdso_get_timestamp(vd, vc, clk, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 vdso_set_timespec(ts, sec, ns); =20 @@ -188,7 +188,7 @@ bool do_coarse_timens(const struct vdso_time_data *vdns= , const struct vdso_clock seq =3D vdso_read_begin(vc); sec =3D vdso_ts->sec; nsec =3D vdso_ts->nsec; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 /* Add the namespace offset */ sec +=3D offs->sec; @@ -212,7 +212,7 @@ bool do_coarse(const struct vdso_time_data *vd, const s= truct vdso_clock *vc, =20 ts->tv_sec =3D vdso_ts->sec; ts->tv_nsec =3D vdso_ts->nsec; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 return true; } @@ -244,7 +244,7 @@ bool do_aux(const struct vdso_time_data *vd, clockid_t = clock, struct __kernel_ti =20 if (!vdso_get_timestamp(vd, vc, VDSO_BASE_AUX, &sec, &ns)) return false; - } while (unlikely(vdso_read_retry(vc, seq))); + } while (vdso_read_retry(vc, seq)); =20 vdso_set_timespec(ts, sec, ns); =20 --=20 2.53.0