Skip to contentSkip to conversation

rtmutex_api: remove definition of mutex_lock_killable_nested

PATCH In review Paolo Bonzini 2 participants 2 messages May 30, 2025

Subsystems (2)
lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 rtmutex_api: remove definition of mutex_lock_killable_nested

Commit fb49f07ba1d9 ("locking/mutex: implement mutex_lock_killable_nest_lock") removed the "extern" declaration of mutex_lock_killable_nested from include/linux/mutex.h, and replaced it with a macro since it could be treated as a special case of _mutex_lock_killable. It also removed a definition of the function in kernel/locking/mutex.c.

However, it left the definition in place in kernel/locking/rtmutex_api.c, which causes a failure when building with CONFIG_RT_MUTEXES=y. Drop it as well now.

Fixes fb49f07ba1d9 ("locking/mutex: implement mutex_lock_killable_nest_lock")
Cc Peter Zijlstra <[email protected]>
---
 kernel/locking/rtmutex_api.c | 7 -------
 1 file changed, 7 deletions(-)
kernel/locking/rtmutex_api.c +0 -7
index 191e4720e546..0c26b52dd417 100644
@@ -544,13 +544,6 @@ int __sched mutex_lock_interruptible_nested(struct mutex *lock,
 }
 EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested);
 
-int __sched mutex_lock_killable_nested(struct mutex *lock,
-					    unsigned int subclass)
-{
-	return __mutex_lock_common(lock, TASK_KILLABLE, subclass, NULL, _RET_IP_);
-}
-EXPORT_SYMBOL_GPL(mutex_lock_killable_nested);
-
 void __sched mutex_lock_io_nested(struct mutex *lock, unsigned int subclass)
 {
 	int token;
Signature · 1 line
2.43.5
#1 lore raw

Hi,

Quoted 6 lines · Paolo Bonzini

Commit fb49f07ba1d9 ("locking/mutex: implement mutex_lock_killable_nest_lock") removed the "extern" declaration of mutex_lock_killable_nested from include/linux/mutex.h, and replaced it with a macro since it could be treated as a special case of _mutex_lock_killable. It also removed a definition of the function in kernel/locking/mutex.c.

Quoted 8 lines

However, it left the definition in place in kernel/locking/rtmutex_api.c, which causes a failure when building with CONFIG_RT_MUTEXES=y. Drop it as well now.

Fixes fb49f07ba1d9 ("locking/mutex: implement mutex_lock_killable_nest_lock")
Cc Peter Zijlstra <[email protected]>

This patch fixes part of the build errors that I was seeing, but I still have these:

In file included from ../include/uapi/linux/posix_types.h:5,

                 from ../include/uapi/linux/types.h:14,
                 from ../include/linux/types.h:6,
                 from ../include/linux/kasan-checks.h:5,
                 from ../include/asm-generic/rwonce.h:26,
                 from ./arch/x86/include/generated/asm/rwonce.h:1,
                 from ../include/linux/compiler.h:390,
                 from ../include/linux/export.h:5,
                 from ../include/linux/linkage.h:7,
                 from ../include/linux/preempt.h:10,
                 from ../include/linux/spinlock.h:56,
                 from ../kernel/locking/rtmutex_api.c:5:
../include/linux/stddef.h:8:14: error: expected declaration specifiers or ‘...’ before ‘(’ token
    8 | #define NULL ((void *)0)
      |              ^

../include/linux/mutex.h:215:60: note: in expansion of macro ‘NULL’
215 | #define mutex_trylock(lock) _mutex_trylock_nest_lock(lock, NULL)
| ^~~~
../kernel/locking/rtmutex_api.c:589:13: note: in expansion of macro ‘mutex_trylock’
589 | int __sched mutex_trylock(struct mutex *lock)

      |             ^~~~~~~~~~~~~
../kernel/locking/rtmutex_api.c:602:15: error: ‘mutex_trylock’ undeclared here (not in a function); did you mean ‘ww_mutex_trylock’?
  602 | EXPORT_SYMBOL(mutex_trylock);
      |               ^~~~~~~~~~~~~

../include/linux/export.h:76:23: note: in definition of macro ‘__EXPORT_SYMBOL’
76 | extern typeof(sym) sym; \
| ^~~
../include/linux/export.h:89:41: note: in expansion of macro ‘_EXPORT_SYMBOL’

   89 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
      |                                         ^~~~~~~~~~~~~~
../kernel/locking/rtmutex_api.c:602:1: note: in expansion of macro ‘EXPORT_SYMBOL’
  602 | EXPORT_SYMBOL(mutex_trylock);
      | ^~~~~~~~~~~~~
Quoted 22 lines
---
 kernel/locking/rtmutex_api.c | 7 -------
 1 file changed, 7 deletions(-)
kernel/locking/rtmutex_api.c +0 -7
index 191e4720e546..0c26b52dd417 100644
@@ -544,13 +544,6 @@ int __sched mutex_lock_interruptible_nested(struct mutex *lock,
 }
 EXPORT_SYMBOL_GPL(mutex_lock_interruptible_nested);
 
-int __sched mutex_lock_killable_nested(struct mutex *lock,
-					    unsigned int subclass)
-{
-	return __mutex_lock_common(lock, TASK_KILLABLE, subclass, NULL, _RET_IP_);
-}
-EXPORT_SYMBOL_GPL(mutex_lock_killable_nested);
-
 void __sched mutex_lock_io_nested(struct mutex *lock, unsigned int subclass)
 {
 	int token;
Signature · 1 line
~Randy