linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yangtao Li <tiny.windzz@gmail.com>
To: akpm@linux-foundation.org, mhocko@suse.com, rientjes@google.com,
	dan.j.williams@intel.com, linux@dominikbrodowski.net,
	dave.hansen@linux.intel.com, dwmw@amazon.co.uk,
	mhocko@kernel.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Yangtao Li <tiny.windzz@gmail.com>
Subject: [PATCH] mm: mmap: remove verify_mm_writelocked()
Date: Thu,  8 Nov 2018 12:48:56 -0500	[thread overview]
Message-ID: <20181108174856.10811-1-tiny.windzz@gmail.com> (raw)

We should get rid of this function. It no longer serves its purpose.This
is a historical artifact from 2005 where do_brk was called outside of
the core mm.We do have a proper abstraction in vm_brk_flags and that one
does the locking properly.So there is no need to use this function.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 mm/mmap.c | 16 ----------------
 1 file changed, 16 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index f7cd9cb966c0..1cee506494d2 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2910,16 +2910,6 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
 	return ret;
 }
 
-static inline void verify_mm_writelocked(struct mm_struct *mm)
-{
-#ifdef CONFIG_DEBUG_VM
-	if (unlikely(down_read_trylock(&mm->mmap_sem))) {
-		WARN_ON(1);
-		up_read(&mm->mmap_sem);
-	}
-#endif
-}
-
 /*
  *  this is really a simplified "do_mmap".  it only handles
  *  anonymous maps.  eventually we may be able to do some
@@ -2946,12 +2936,6 @@ static int do_brk_flags(unsigned long addr, unsigned long len, unsigned long fla
 	if (error)
 		return error;
 
-	/*
-	 * mm->mmap_sem is required to protect against another thread
-	 * changing the mappings in case we sleep.
-	 */
-	verify_mm_writelocked(mm);
-
 	/*
 	 * Clear old maps.  this also does some error checking for us
 	 */
-- 
2.17.0


             reply	other threads:[~2018-11-08 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-08 17:48 Yangtao Li [this message]
2018-11-08 17:53 ` [PATCH] mm: mmap: remove verify_mm_writelocked() Michal Hocko
2018-11-14 22:20 ` David Rientjes

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=20181108174856.10811-1-tiny.windzz@gmail.com \
    --to=tiny.windzz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=dwmw@amazon.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@dominikbrodowski.net \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    /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).