Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Chinwen Chang <chinwen.chang@mediatek.com>
To: Matthias Brugger <matthias.bgg@gmail.com>,
	Michel Lespinasse <walken@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Daniel Jordan <daniel.m.jordan@oracle.com>,
	Davidlohr Bueso <dbueso@suse.de>,
	Chinwen Chang <chinwen.chang@mediatek.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	"Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	Steven Price <steven.price@arm.com>,
	Song Liu <songliubraving@fb.com>,
	Jimmy Assarsson <jimmyassarsson@gmail.com>,
	Huang Ying <ying.huang@intel.com>,
	Daniel Kiss <daniel.kiss@arm.com>,
	Laurent Dufour <ldufour@linux.ibm.com>
Cc: <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-fsdevel@vger.kernel.org>, <wsd_upstream@mediatek.com>
Subject: [PATCH v4 1/3] mmap locking API: add mmap_lock_is_contended()
Date: Tue, 18 Aug 2020 09:58:16 +0800	[thread overview]
Message-ID: <1597715898-3854-2-git-send-email-chinwen.chang@mediatek.com> (raw)
In-Reply-To: <1597715898-3854-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.

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

  reply	other threads:[~2020-08-18  1:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-18  1:58 [PATCH v4 0/3] Try to release mmap_lock temporarily in smaps_rollup Chinwen Chang
2020-08-18  1:58 ` Chinwen Chang [this message]
2020-08-18  1:58 ` [PATCH v4 2/3] mm: smaps*: extend smap_gather_stats to support specified beginning Chinwen Chang
2020-08-18  1:58 ` [PATCH v4 3/3] mm: proc: smaps_rollup: do not stall write attempts on mmap_lock Chinwen Chang
2020-08-19  7:37   ` Steven Price

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=1597715898-3854-2-git-send-email-chinwen.chang@mediatek.com \
    --to=chinwen.chang@mediatek.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=daniel.kiss@arm.com \
    --cc=daniel.m.jordan@oracle.com \
    --cc=dbueso@suse.de \
    --cc=jgg@ziepe.ca \
    --cc=jimmyassarsson@gmail.com \
    --cc=ldufour@linux.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=songliubraving@fb.com \
    --cc=steven.price@arm.com \
    --cc=vbabka@suse.cz \
    --cc=walken@google.com \
    --cc=willy@infradead.org \
    --cc=wsd_upstream@mediatek.com \
    --cc=ying.huang@intel.com \
    --subject='Re: [PATCH v4 1/3] mmap locking API: add mmap_lock_is_contended()' \
    /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

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).