From nobody Sat Feb 7 04:47:19 2026 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 AC8CE23A9BD for ; Mon, 2 Feb 2026 17:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770051919; cv=none; b=csf1AN2RBNdCPsLUAeUwruV5tDdao2m2BmZBW8RL9Zm+XTC1jaGO/Z1yaPTikMa6JxC4bJpD6fz3YeJ1se1LO+6RX6jlLAtTC6xD58/R3hwjl46N2my5bkqa189wUYjwgceZ+6ynLLNrWzpToBjFxhpQKo2l/8JcQKXTe5waTLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770051919; c=relaxed/simple; bh=qFrhiLrEqstvhIiH9EeQC0quRqARawDbhew/Y2/UYLI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=WYHBLN31wVBp+ts7l+jWI55RR2+A9n/eo7IMPdCYOBoTPEFIVr/gpGPVtrf0DR+bhtGUaC9GcdFOj2vikXNbMqCUdCHy+B0JbMPO3ENYX+4WO5G4eK+8I4qXTaea4kwikuBxMj6yLheY35IcdKzZqP+3Lp3s69adl+hw3vQbNys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de; spf=pass smtp.mailfrom=wiredspace.de; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b=34z5GOaQ; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wiredspace.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wiredspace.de header.i=@wiredspace.de header.b="34z5GOaQ" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wiredspace.de; s=key1; t=1770051915; 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; bh=5aK7VYn5DbqDUI192vSKeBgPLokX65bsPtUKpTgYaGs=; b=34z5GOaQEB6a4lwClJIT6nllOz1m5Cn3QGxXYmzRRH1XDU+Ia61ulnXYPTGb/Mu681Ub2G pfXAhh0uf/FSWBmIqxX7XcTt1LRd12Oj/kv8zVvW1fsUyAlVwwnZ24naskHOz9NEmWefgw NnqpLgG4aOS1F5OXxoXm3ce82IL+40c= From: =?utf-8?q?Thomas_B=C3=B6hler?= Date: Mon, 02 Feb 2026 18:04:43 +0100 Subject: [PATCH] rtmutex: Introduce __cleanup() based infrastructure 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: <20260202-rt_mutex-guard-v1-1-1c078dbeee57@wiredspace.de> X-B4-Tracking: v=1; b=H4sIACrZgGkC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDIKFbVBKfW1qSWqGbXppYlKKblJZoaGpokWSSZmisBNRUUJSallkBNjA 6trYWAJfEN35gAAAA X-Change-ID: 20260202-rt_mutex-guard-bfa1518b4f13 To: Sebastian Andrzej Siewior , Clark Williams , Steven Rostedt Cc: linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, =?utf-8?q?Thomas_B=C3=B6hler?= X-Migadu-Flow: FLOW_OUT Commit 54da6a092431 ("locking: Introduce __cleanup() based infrastructure") introduced lock guards for mutexes in include/linux/mutex.h, but, presumably as PREEMPT_RT wasn't merged at the time, the guard for rt_mutex was never created. Do this now so this infrastructure exists for rt_mutex as well. Signed-off-by: Thomas B=C3=B6hler --- include/linux/rtmutex.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h index ede4c6bf6f22..3c766eba2c7d 100644 --- a/include/linux/rtmutex.h +++ b/include/linux/rtmutex.h @@ -17,6 +17,7 @@ #include #include #include +#include =20 extern int max_lock_depth; =20 @@ -129,4 +130,8 @@ extern int rt_mutex_trylock(struct rt_mutex *lock); =20 extern void rt_mutex_unlock(struct rt_mutex *lock); =20 +DEFINE_GUARD(rt_mutex, struct rt_mutex *, rt_mutex_lock(_T), rt_mutex_unlo= ck(_T)) +DEFINE_GUARD_COND(rt_mutex, _try, rt_mutex_trylock(_T)) +DEFINE_GUARD_COND(rt_mutex, _intr, rt_mutex_lock_interruptible(_T), _RET = =3D=3D 0) + #endif --- base-commit: 18f7fcd5e69a04df57b563360b88be72471d6b62 change-id: 20260202-rt_mutex-guard-bfa1518b4f13 Best regards, --=20 Thomas B=C3=B6hler