mm-commits.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* + mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch added to -mm tree
@ 2022-04-01  2:46 Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-04-01  2:46 UTC (permalink / raw)
  To: mm-commits, hch, eb, akpm


The patch titled
     Subject: mm/mmap.c: use mmap_assert_write_locked() instead of open coding it
has been added to the -mm tree.  Its filename is
     mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Rolf Eike Beer <eb@emlix.com>
Subject: mm/mmap.c: use mmap_assert_write_locked() instead of open coding it

In case the lock is actually not held at this point.

Link: https://lkml.kernel.org/r/5827758.TJ1SttVevJ@mobilepool36.emlix.com
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mmap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/mmap.c~mm-use-mmap_assert_write_locked-instead-of-open-coding-it
+++ a/mm/mmap.c
@@ -3561,7 +3561,7 @@ int mm_take_all_locks(struct mm_struct *
 	struct vm_area_struct *vma;
 	struct anon_vma_chain *avc;
 
-	BUG_ON(mmap_read_trylock(mm));
+	mmap_assert_write_locked(mm);
 
 	mutex_lock(&mm_all_locks_mutex);
 
@@ -3641,7 +3641,7 @@ void mm_drop_all_locks(struct mm_struct
 	struct vm_area_struct *vma;
 	struct anon_vma_chain *avc;
 
-	BUG_ON(mmap_read_trylock(mm));
+	mmap_assert_write_locked(mm);
 	BUG_ON(!mutex_is_locked(&mm_all_locks_mutex));
 
 	for (vma = mm->mmap; vma; vma = vma->vm_next) {
_

Patches currently in -mm which might be from eb@emlix.com are

mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

* + mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch added to -mm tree
@ 2022-03-28 20:29 Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-03-28 20:29 UTC (permalink / raw)
  To: mm-commits, eb, akpm


The patch titled
     Subject: mm/mmap.c: use mmap_assert_write_locked() instead of open coding it
has been added to the -mm tree.  Its filename is
     mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch

This patch should soon appear at
    https://ozlabs.org/~akpm/mmots/broken-out/mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch
and later at
    https://ozlabs.org/~akpm/mmotm/broken-out/mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Rolf Eike Beer <eb@emlix.com>
Subject: mm/mmap.c: use mmap_assert_write_locked() instead of open coding it

In case the lock is actually not held at this point this also avoids a
stale lock reference if built with NDEBUG.

Link: https://lkml.kernel.org/r/5827758.TJ1SttVevJ@mobilepool36.emlix.com
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/mmap.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/mm/mmap.c~mm-use-mmap_assert_write_locked-instead-of-open-coding-it
+++ a/mm/mmap.c
@@ -3561,7 +3561,7 @@ int mm_take_all_locks(struct mm_struct *
 	struct vm_area_struct *vma;
 	struct anon_vma_chain *avc;
 
-	BUG_ON(mmap_read_trylock(mm));
+	mmap_assert_write_locked(mm);
 
 	mutex_lock(&mm_all_locks_mutex);
 
@@ -3641,7 +3641,7 @@ void mm_drop_all_locks(struct mm_struct
 	struct vm_area_struct *vma;
 	struct anon_vma_chain *avc;
 
-	BUG_ON(mmap_read_trylock(mm));
+	mmap_assert_write_locked(mm);
 	BUG_ON(!mutex_is_locked(&mm_all_locks_mutex));
 
 	for (vma = mm->mmap; vma; vma = vma->vm_next) {
_

Patches currently in -mm which might be from eb@emlix.com are

mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-01  2:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-01  2:46 + mm-use-mmap_assert_write_locked-instead-of-open-coding-it.patch added to -mm tree Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2022-03-28 20:29 Andrew Morton

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