* [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive()
@ 2021-02-10 8:52 Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 1/2] " Sebastian Andrzej Siewior
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-02-10 8:52 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Andy Whitcroft,
Joe Perches, Thomas Gleixner
Remove mutex_trylock_recursive() from the API and tell checkpatch not to
check it for it anymore.
Sebastian
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] locking/mutex: Kill mutex_trylock_recursive()
2021-02-10 8:52 [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Sebastian Andrzej Siewior
@ 2021-02-10 8:52 ` Sebastian Andrzej Siewior
2021-02-10 13:59 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 9:17 ` [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Peter Zijlstra
2 siblings, 1 reply; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-02-10 8:52 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Andy Whitcroft,
Joe Perches, Thomas Gleixner, Sebastian Andrzej Siewior
There are not users of mutex_trylock_recursive() in tree as of
v5.11-rc7.
Remove it.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
include/linux/mutex.h | 25 -------------------------
kernel/locking/mutex.c | 10 ----------
2 files changed, 35 deletions(-)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index dcd185cbfe793..0cd631a197276 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -199,29 +199,4 @@ extern void mutex_unlock(struct mutex *lock);
extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
-/*
- * These values are chosen such that FAIL and SUCCESS match the
- * values of the regular mutex_trylock().
- */
-enum mutex_trylock_recursive_enum {
- MUTEX_TRYLOCK_FAILED = 0,
- MUTEX_TRYLOCK_SUCCESS = 1,
- MUTEX_TRYLOCK_RECURSIVE,
-};
-
-/**
- * mutex_trylock_recursive - trylock variant that allows recursive locking
- * @lock: mutex to be locked
- *
- * This function should not be used, _ever_. It is purely for hysterical GEM
- * raisins, and once those are gone this will be removed.
- *
- * Returns:
- * - MUTEX_TRYLOCK_FAILED - trylock failed,
- * - MUTEX_TRYLOCK_SUCCESS - lock acquired,
- * - MUTEX_TRYLOCK_RECURSIVE - we already owned the lock.
- */
-extern /* __deprecated */ __must_check enum mutex_trylock_recursive_enum
-mutex_trylock_recursive(struct mutex *lock);
-
#endif /* __LINUX_MUTEX_H */
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 5352ce50a97e3..adb9350907688 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -86,16 +86,6 @@ bool mutex_is_locked(struct mutex *lock)
}
EXPORT_SYMBOL(mutex_is_locked);
-__must_check enum mutex_trylock_recursive_enum
-mutex_trylock_recursive(struct mutex *lock)
-{
- if (unlikely(__mutex_owner(lock) == current))
- return MUTEX_TRYLOCK_RECURSIVE;
-
- return mutex_trylock(lock);
-}
-EXPORT_SYMBOL(mutex_trylock_recursive);
-
static inline unsigned long __owner_flags(unsigned long owner)
{
return owner & MUTEX_FLAGS;
--
2.30.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive()
2021-02-10 8:52 [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 1/2] " Sebastian Andrzej Siewior
@ 2021-02-10 8:52 ` Sebastian Andrzej Siewior
2021-02-10 12:40 ` Joe Perches
2021-02-10 13:59 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-02-10 9:17 ` [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Peter Zijlstra
2 siblings, 2 replies; 7+ messages in thread
From: Sebastian Andrzej Siewior @ 2021-02-10 8:52 UTC (permalink / raw)
To: linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Andy Whitcroft,
Joe Perches, Thomas Gleixner, Sebastian Andrzej Siewior
mutex_trylock_recursive() has been removed from the tree, there is no
need to check for it.
Remove traces of mutex_trylock_recursive()'s existence.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
scripts/checkpatch.pl | 6 ------
1 file changed, 6 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 1afe3af1cc097..4b2775fd31d9d 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7062,12 +7062,6 @@ sub process {
}
}
-# check for mutex_trylock_recursive usage
- if ($line =~ /mutex_trylock_recursive/) {
- ERROR("LOCKING",
- "recursive locking is bad, do not use this ever.\n" . $herecurr);
- }
-
# check for lockdep_set_novalidate_class
if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
$line =~ /__lockdep_no_validate__\s*\)/ ) {
--
2.30.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive()
2021-02-10 8:52 [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 1/2] " Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive() Sebastian Andrzej Siewior
@ 2021-02-10 9:17 ` Peter Zijlstra
2 siblings, 0 replies; 7+ messages in thread
From: Peter Zijlstra @ 2021-02-10 9:17 UTC (permalink / raw)
To: Sebastian Andrzej Siewior
Cc: linux-kernel, Ingo Molnar, Will Deacon, Andy Whitcroft,
Joe Perches, Thomas Gleixner
On Wed, Feb 10, 2021 at 09:52:46AM +0100, Sebastian Andrzej Siewior wrote:
> Remove mutex_trylock_recursive() from the API and tell checkpatch not to
> check it for it anymore.
W00t!!
Thanks!
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive()
2021-02-10 8:52 ` [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive() Sebastian Andrzej Siewior
@ 2021-02-10 12:40 ` Joe Perches
2021-02-10 13:59 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 0 replies; 7+ messages in thread
From: Joe Perches @ 2021-02-10 12:40 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, linux-kernel
Cc: Peter Zijlstra, Ingo Molnar, Will Deacon, Andy Whitcroft,
Thomas Gleixner
On Wed, 2021-02-10 at 09:52 +0100, Sebastian Andrzej Siewior wrote:
> mutex_trylock_recursive() has been removed from the tree, there is no
> need to check for it.
>
> Remove traces of mutex_trylock_recursive()'s existence.
Yay. Assuming patch 1 is applied, thanks.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> scripts/checkpatch.pl | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 1afe3af1cc097..4b2775fd31d9d 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -7062,12 +7062,6 @@ sub process {
> }
> }
>
>
> -# check for mutex_trylock_recursive usage
> - if ($line =~ /mutex_trylock_recursive/) {
> - ERROR("LOCKING",
> - "recursive locking is bad, do not use this ever.\n" . $herecurr);
> - }
> -
> # check for lockdep_set_novalidate_class
> if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
> $line =~ /__lockdep_no_validate__\s*\)/ ) {
^ permalink raw reply [flat|nested] 7+ messages in thread
* [tip: locking/core] checkpatch: Don't check for mutex_trylock_recursive()
2021-02-10 8:52 ` [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 12:40 ` Joe Perches
@ 2021-02-10 13:59 ` tip-bot2 for Sebastian Andrzej Siewior
1 sibling, 0 replies; 7+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-02-10 13:59 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sebastian Andrzej Siewior, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 6c80408a8a0360fa9223b8c21c0ab8ef42e88bfe
Gitweb: https://git.kernel.org/tip/6c80408a8a0360fa9223b8c21c0ab8ef42e88bfe
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Wed, 10 Feb 2021 09:52:48 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 10 Feb 2021 14:44:40 +01:00
checkpatch: Don't check for mutex_trylock_recursive()
mutex_trylock_recursive() has been removed from the tree, there is no
need to check for it.
Remove traces of mutex_trylock_recursive()'s existence.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210210085248.219210-3-bigeasy@linutronix.de
---
scripts/checkpatch.pl | 6 ------
1 file changed, 6 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92e888e..15f7f4f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -7069,12 +7069,6 @@ sub process {
}
}
-# check for mutex_trylock_recursive usage
- if ($line =~ /mutex_trylock_recursive/) {
- ERROR("LOCKING",
- "recursive locking is bad, do not use this ever.\n" . $herecurr);
- }
-
# check for lockdep_set_novalidate_class
if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
$line =~ /__lockdep_no_validate__\s*\)/ ) {
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [tip: locking/core] locking/mutex: Kill mutex_trylock_recursive()
2021-02-10 8:52 ` [PATCH 1/2] " Sebastian Andrzej Siewior
@ 2021-02-10 13:59 ` tip-bot2 for Sebastian Andrzej Siewior
0 siblings, 0 replies; 7+ messages in thread
From: tip-bot2 for Sebastian Andrzej Siewior @ 2021-02-10 13:59 UTC (permalink / raw)
To: linux-tip-commits
Cc: Sebastian Andrzej Siewior, Peter Zijlstra (Intel), x86, linux-kernel
The following commit has been merged into the locking/core branch of tip:
Commit-ID: 0f319d49a4167e402b01b2b56639386f0b6846ba
Gitweb: https://git.kernel.org/tip/0f319d49a4167e402b01b2b56639386f0b6846ba
Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
AuthorDate: Wed, 10 Feb 2021 09:52:47 +01:00
Committer: Peter Zijlstra <peterz@infradead.org>
CommitterDate: Wed, 10 Feb 2021 14:44:40 +01:00
locking/mutex: Kill mutex_trylock_recursive()
There are not users of mutex_trylock_recursive() in tree as of
v5.11-rc7.
Remove it.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20210210085248.219210-2-bigeasy@linutronix.de
---
include/linux/mutex.h | 25 -------------------------
kernel/locking/mutex.c | 10 ----------
2 files changed, 35 deletions(-)
diff --git a/include/linux/mutex.h b/include/linux/mutex.h
index dcd185c..0cd631a 100644
--- a/include/linux/mutex.h
+++ b/include/linux/mutex.h
@@ -199,29 +199,4 @@ extern void mutex_unlock(struct mutex *lock);
extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
-/*
- * These values are chosen such that FAIL and SUCCESS match the
- * values of the regular mutex_trylock().
- */
-enum mutex_trylock_recursive_enum {
- MUTEX_TRYLOCK_FAILED = 0,
- MUTEX_TRYLOCK_SUCCESS = 1,
- MUTEX_TRYLOCK_RECURSIVE,
-};
-
-/**
- * mutex_trylock_recursive - trylock variant that allows recursive locking
- * @lock: mutex to be locked
- *
- * This function should not be used, _ever_. It is purely for hysterical GEM
- * raisins, and once those are gone this will be removed.
- *
- * Returns:
- * - MUTEX_TRYLOCK_FAILED - trylock failed,
- * - MUTEX_TRYLOCK_SUCCESS - lock acquired,
- * - MUTEX_TRYLOCK_RECURSIVE - we already owned the lock.
- */
-extern /* __deprecated */ __must_check enum mutex_trylock_recursive_enum
-mutex_trylock_recursive(struct mutex *lock);
-
#endif /* __LINUX_MUTEX_H */
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index 5352ce5..adb9350 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -86,16 +86,6 @@ bool mutex_is_locked(struct mutex *lock)
}
EXPORT_SYMBOL(mutex_is_locked);
-__must_check enum mutex_trylock_recursive_enum
-mutex_trylock_recursive(struct mutex *lock)
-{
- if (unlikely(__mutex_owner(lock) == current))
- return MUTEX_TRYLOCK_RECURSIVE;
-
- return mutex_trylock(lock);
-}
-EXPORT_SYMBOL(mutex_trylock_recursive);
-
static inline unsigned long __owner_flags(unsigned long owner)
{
return owner & MUTEX_FLAGS;
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-10 14:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 8:52 [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 1/2] " Sebastian Andrzej Siewior
2021-02-10 13:59 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-02-10 8:52 ` [PATCH 2/2] checkpatch: Don't check for mutex_trylock_recursive() Sebastian Andrzej Siewior
2021-02-10 12:40 ` Joe Perches
2021-02-10 13:59 ` [tip: locking/core] " tip-bot2 for Sebastian Andrzej Siewior
2021-02-10 9:17 ` [PATCH 0/2] locking/mutex: Kill mutex_trylock_recursive() Peter Zijlstra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.