From: jiasheng <jiasheng@iscas.ac.cn>
To: linux-kernel@vger.kernel.org
Cc: jiasheng <jiasheng@iscas.ac.cn>
Subject: [PATCH 10/10] seqlock: Add do_read_seqcount_retry() in front of seqcount_lockdep_reader_access() in read_seqbegin()
Date: Thu, 2 Sep 2021 03:37:56 +0000 [thread overview]
Message-ID: <1630553876-484166-1-git-send-email-jiasheng@iscas.ac.cn> (raw)
We have found that in the complied files seqcount_lockdep_reader_access()
appear more than 20 times, and under at least 90% circumstances
that do_read_seqcount_retry() and seqcount_lockdep_reader_access()
appear in pairs.
For example, they appear together in the irqfd_wakeup()
of the file complie from 'virt/kvm/eventfd.c'.
But we have found that in the read_seqbegin(), there is only
seqcount_lockdep_reader_access() instead of the pair.
Therefore, we consider that the do_read_seqcount_retry()
might be forgotten.
Signed-off-by: jiasheng <jiasheng@iscas.ac.cn>
---
include/linux/seqlock.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index f61e34f..14169ce 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -837,8 +837,10 @@ typedef struct {
*/
static inline unsigned read_seqbegin(const seqlock_t *sl)
{
- unsigned ret = read_seqcount_begin(&sl->seqcount);
-
+ unsigned int ret = 0;
+
+ if (read_seqcount_retry(&sl->seqcount, ret))
+ ret = read_seqcount_begin(&sl->seqcount);
kcsan_atomic_next(0); /* non-raw usage, assume closing read_seqretry() */
kcsan_flat_atomic_begin();
return ret;
--
2.7.4
next reply other threads:[~2021-09-02 3:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-02 3:37 jiasheng [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-02 2:16 [PATCH 10/10] seqlock: Add do_read_seqcount_retry() in front of seqcount_lockdep_reader_access() in read_seqbegin() jiasheng
2021-09-02 2:28 ` Eric Dumazet
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=1630553876-484166-1-git-send-email-jiasheng@iscas.ac.cn \
--to=jiasheng@iscas.ac.cn \
--cc=linux-kernel@vger.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).