From nobody Sat Feb 7 18:20:06 2026 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB341342C99 for ; Fri, 19 Dec 2025 15:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766158137; cv=none; b=kINllojmTJ3mf/9tZgdBoPbXB7qDQwpFfyomf6ap7SVh/LuwkzEdh9R8yMYyNsalElIv9tKhgYPSjN4CRA9Or3t6POaDer5SY2MeGcKol58hFF1wrxgQ6a5GjkfMvegVneBpMIeLdJ5y0bLtPC3z1QlR46N9kwEG+CJf/tBE0E8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766158137; c=relaxed/simple; bh=oZ82UdA/h3/6OgCOv92FKAAhxksLJQ4XGZagHgx7CF4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=DWxDfBdfqxvQciWhXk37+CJKLN97fYHLt9nq+KGTPRdAjKiBL8aqVisF04OHk9pZ4OmoN0QGTa8daIiMumdjhEPnOU0OS2rbwotgoPR9vKfIbyNxpiVb8qSc+RsUXes9vj7MDW9ekCcOsnQk7TJgwtf+jkX0qm05Xj3KWv8W6x0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=KDiiuP35; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2GvMpX8v; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=KDiiuP35; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=2GvMpX8v; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="KDiiuP35"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2GvMpX8v"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="KDiiuP35"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="2GvMpX8v" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4EFCF5BD33; Fri, 19 Dec 2025 15:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766158130; h=from:from:reply-to: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=/bate9nWnzJ8mzlYN/J78rK3o1NjHpiTtb4fzQ+9pA0=; b=KDiiuP350lQtfnf3AiRx1VvnXzRzvpKAaSv+ghXWLfyNu46BbPVPEo0jvXWImLWVDFHH9b z6luXnx5bwdTPusjGf+FZfSFtarAPdBEnAHujiVtHish3yDadQGzWR8U1eI6m/Tny1+6kA TBieBDHToMQMj5GCddXVlDmzqaoXOOo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766158130; h=from:from:reply-to: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=/bate9nWnzJ8mzlYN/J78rK3o1NjHpiTtb4fzQ+9pA0=; b=2GvMpX8veF0+lpOi3s9k2YkQS8ASs9+BJEEDwCIFln55atuXrbey0HtxRSR/abMBTpojLB d+qhSUTiKLF1NlBQ== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1766158130; h=from:from:reply-to: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=/bate9nWnzJ8mzlYN/J78rK3o1NjHpiTtb4fzQ+9pA0=; b=KDiiuP350lQtfnf3AiRx1VvnXzRzvpKAaSv+ghXWLfyNu46BbPVPEo0jvXWImLWVDFHH9b z6luXnx5bwdTPusjGf+FZfSFtarAPdBEnAHujiVtHish3yDadQGzWR8U1eI6m/Tny1+6kA TBieBDHToMQMj5GCddXVlDmzqaoXOOo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1766158130; h=from:from:reply-to: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=/bate9nWnzJ8mzlYN/J78rK3o1NjHpiTtb4fzQ+9pA0=; b=2GvMpX8veF0+lpOi3s9k2YkQS8ASs9+BJEEDwCIFln55atuXrbey0HtxRSR/abMBTpojLB d+qhSUTiKLF1NlBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id CBB713EA63; Fri, 19 Dec 2025 15:28:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id XzAaLzFvRWn3RQAAD6G6ig (envelope-from ); Fri, 19 Dec 2025 15:28:49 +0000 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Carlos=20L=C3=B3pez?= , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long Subject: [PATCH] locking/mutex: define conditional guard for for mutex_lock_killable() Date: Fri, 19 Dec 2025 16:25:49 +0100 Message-ID: <20251219152548.3861707-2-clopez@suse.de> X-Mailer: git-send-email 2.51.0 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 X-Spamd-Result: default: False [-1.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_SHORT(-0.20)[-0.996]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; RCVD_TLS_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[suse.de,infradead.org,redhat.com,kernel.org,gmail.com]; RCVD_COUNT_TWO(0.00)[2]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:email,imap1.dmz-prg2.suse.org:helo] X-Spam-Level: X-Spam-Flag: NO X-Spam-Score: -1.80 Allow using guards with mutex_lock_killable(), just like we currently do with mutex_lock_interruptable(), e.g. scoped_guard(mutex_killable, &my_mutex) { ... } Signed-off-by: Carlos L=C3=B3pez --- include/linux/mutex.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/mutex.h b/include/linux/mutex.h index bf535f0118bb..931a139e6176 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -253,6 +253,7 @@ extern int atomic_dec_and_mutex_lock(atomic_t *cnt, str= uct mutex *lock); DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T)) DEFINE_GUARD_COND(mutex, _try, mutex_trylock(_T)) DEFINE_GUARD_COND(mutex, _intr, mutex_lock_interruptible(_T), _RET =3D=3D = 0) +DEFINE_GUARD_COND(mutex, _killable, mutex_lock_killable(_T), _RET =3D=3D 0) =20 extern unsigned long mutex_get_owner(struct mutex *lock); =20 --=20 2.51.0