From: Andrew Morton <akpm@linux-foundation.org>
To: akpm@linux-foundation.org, Liam.Howlett@oracle.com,
linux-mm@kvack.org, mm-commits@vger.kernel.org,
rostedt@goodmis.org, torvalds@linux-foundation.org,
vbabka@suse.cz, walken.cr@gmail.com, willy@infradead.org
Subject: [patch 5/8] mmap_lock: change trace and locking order
Date: Wed, 08 Sep 2021 18:10:14 -0700 [thread overview]
Message-ID: <20210909011014.JJu-mAZB6%akpm@linux-foundation.org> (raw)
In-Reply-To: <20210908180859.d523d4bb4ad8eec11c61500d@linux-foundation.org>
From: Liam Howlett <liam.howlett@oracle.com>
Subject: mmap_lock: change trace and locking order
Print to the trace log before releasing the lock to avoid racing with
other trace log printers of the same lock type.
Link: https://lkml.kernel.org/r/20210903022041.1843024-1-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michel Lespinasse <walken.cr@gmail.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
include/linux/mmap_lock.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
--- a/include/linux/mmap_lock.h~mmap_lock-change-trace-and-locking-order
+++ a/include/linux/mmap_lock.h
@@ -101,14 +101,14 @@ static inline bool mmap_write_trylock(st
static inline void mmap_write_unlock(struct mm_struct *mm)
{
- up_write(&mm->mmap_lock);
__mmap_lock_trace_released(mm, true);
+ up_write(&mm->mmap_lock);
}
static inline void mmap_write_downgrade(struct mm_struct *mm)
{
- downgrade_write(&mm->mmap_lock);
__mmap_lock_trace_acquire_returned(mm, false, true);
+ downgrade_write(&mm->mmap_lock);
}
static inline void mmap_read_lock(struct mm_struct *mm)
@@ -140,8 +140,8 @@ static inline bool mmap_read_trylock(str
static inline void mmap_read_unlock(struct mm_struct *mm)
{
- up_read(&mm->mmap_lock);
__mmap_lock_trace_released(mm, false);
+ up_read(&mm->mmap_lock);
}
static inline bool mmap_read_trylock_non_owner(struct mm_struct *mm)
@@ -155,8 +155,8 @@ static inline bool mmap_read_trylock_non
static inline void mmap_read_unlock_non_owner(struct mm_struct *mm)
{
- up_read_non_owner(&mm->mmap_lock);
__mmap_lock_trace_released(mm, false);
+ up_read_non_owner(&mm->mmap_lock);
}
static inline void mmap_assert_locked(struct mm_struct *mm)
_
next prev parent reply other threads:[~2021-09-09 1:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 1:08 incoming Andrew Morton
2021-09-09 1:10 ` [patch 1/8] mm/hmm: bypass devmap pte when all pfn requested flags are fulfilled Andrew Morton
2021-09-09 1:10 ` [patch 2/8] mm/hugetlb: initialize hugetlb_usage in mm_init Andrew Morton
2021-09-09 1:10 ` [patch 3/8] mm,vmscan: fix divide by zero in get_scan_count Andrew Morton
2021-09-09 1:10 ` [patch 4/8] mm/page_alloc.c: avoid accessing uninitialized pcp page migratetype Andrew Morton
2021-09-09 1:10 ` Andrew Morton [this message]
2021-09-09 12:56 ` [patch 5/8] mmap_lock: change trace and locking order Liam Howlett
2021-09-09 1:10 ` [patch 6/8] mm/kmemleak: allow __GFP_NOLOCKDEP passed to kmemleak's gfp Andrew Morton
2021-09-09 1:10 ` [patch 7/8] mm/mempolicy: fix a race between offset_il_node and mpol_rebind_task Andrew Morton
2021-09-09 1:10 ` [patch 8/8] nds32/setup: remove unused memblock_region variable in setup_memory() Andrew Morton
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=20210909011014.JJu-mAZB6%akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=vbabka@suse.cz \
--cc=walken.cr@gmail.com \
--cc=willy@infradead.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).