From: qiang.zhang@windriver.com
To: peterz@infradead.org, mingo@redhat.com, will@kernel.org,
longman@redhat.com, boqun.feng@gmail.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal
Date: Sat, 15 May 2021 10:30:10 +0800 [thread overview]
Message-ID: <20210515023010.102985-1-qiang.zhang@windriver.com> (raw)
From: Zqiang <qiang.zhang@windriver.com>
Clear MUTEX_FLAGS when call mutex_lock_interruptible()
interrupted by a signal and the lock->wait_list is empty.
Signed-off-by: Zqiang <qiang.zhang@windriver.com>
---
kernel/locking/mutex.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/kernel/locking/mutex.c b/kernel/locking/mutex.c
index cb6b112ce155..4ac354ca092b 100644
--- a/kernel/locking/mutex.c
+++ b/kernel/locking/mutex.c
@@ -1081,6 +1081,8 @@ __mutex_lock_common(struct mutex *lock, long state, unsigned int subclass,
err:
__set_current_state(TASK_RUNNING);
mutex_remove_waiter(lock, &waiter, current);
+ if (likely(list_empty(&lock->wait_list)))
+ __mutex_clear_flag(lock, MUTEX_FLAGS);
err_early_kill:
spin_unlock(&lock->wait_lock);
debug_mutex_free_waiter(&waiter);
--
2.25.1
next reply other threads:[~2021-05-15 2:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-15 2:30 qiang.zhang [this message]
2021-05-15 10:11 ` [PATCH] locking/mutex: clear MUTEX_FLAGS if wait_list is empty due to signal Peter Zijlstra
2021-05-15 19:02 ` Waiman Long
2021-05-16 4:18 qiang.zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210515023010.102985-1-qiang.zhang@windriver.com \
--to=qiang.zhang@windriver.com \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).