From: Chinwen Chang <chinwen.chang@mediatek.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
Chinwen Chang <chinwen.chang@mediatek.com>
Subject: [RESEND, PATCH v4 1/3] mmap locking API: add mmap_lock_is_contended()
Date: Mon, 5 Oct 2020 10:40:12 +0800 [thread overview]
Message-ID: <1601865614-4918-2-git-send-email-chinwen.chang@mediatek.com> (raw)
In-Reply-To: <1601865614-4918-1-git-send-email-chinwen.chang@mediatek.com>
Add new API to query if someone wants to acquire mmap_lock
for write attempts.
Using this instead of rwsem_is_contended makes it more tolerant
of future changes to the lock type.
Change-Id: Idb21478bb0580ba72b9926aba3bbc4b1f75deec2
Signed-off-by: Chinwen Chang <chinwen.chang@mediatek.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Michel Lespinasse <walken@google.com>
---
include/linux/mmap_lock.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/mmap_lock.h b/include/linux/mmap_lock.h
index 0707671..18e7eae 100644
--- a/include/linux/mmap_lock.h
+++ b/include/linux/mmap_lock.h
@@ -87,4 +87,9 @@ static inline void mmap_assert_write_locked(struct mm_struct *mm)
VM_BUG_ON_MM(!rwsem_is_locked(&mm->mmap_lock), mm);
}
+static inline int mmap_lock_is_contended(struct mm_struct *mm)
+{
+ return rwsem_is_contended(&mm->mmap_lock);
+}
+
#endif /* _LINUX_MMAP_LOCK_H */
--
1.9.1
next prev parent reply other threads:[~2020-10-05 2:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 2:40 [RESEND,PATCH v4 0/3] Try to release mmap_lock temporarily in smaps_rollup Chinwen Chang
2020-10-05 2:40 ` Chinwen Chang [this message]
2020-10-05 2:40 ` [RESEND, PATCH v4 2/3] mm: smaps*: extend smap_gather_stats to support specified beginning Chinwen Chang
2020-10-05 2:40 ` [RESEND, PATCH v4 3/3] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock Chinwen Chang
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=1601865614-4918-2-git-send-email-chinwen.chang@mediatek.com \
--to=chinwen.chang@mediatek.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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