linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Anshuman Khandual <khandual@linux.vnet.ibm.com>
To: linux-mm@kvack.org
Cc: akpm@linux-foundation.org, vbabka@suse.cz
Subject: [PATCH] mm/mempolicy: Remove BUG_ON() checks for VMA inside mpol_misplaced()
Date: Fri,  1 Sep 2017 18:31:37 +0530	[thread overview]
Message-ID: <20170901130137.7617-1-khandual@linux.vnet.ibm.com> (raw)
In-Reply-To: <b28e0081-6e10-2d55-7414-afb0574a11a1@linux.vnet.ibm.com>

VMA and its address bounds checks are too late in this function.
They must have been verified earlier in the page fault sequence.
Hence just remove them.

Suggested-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>
---
 mm/mempolicy.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 618ab12..3509b84 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2172,17 +2172,12 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
 	int polnid = -1;
 	int ret = -1;
 
-	BUG_ON(!vma);
-
 	pol = get_vma_policy(vma, addr);
 	if (!(pol->flags & MPOL_F_MOF))
 		goto out;
 
 	switch (pol->mode) {
 	case MPOL_INTERLEAVE:
-		BUG_ON(addr >= vma->vm_end);
-		BUG_ON(addr < vma->vm_start);
-
 		pgoff = vma->vm_pgoff;
 		pgoff += (addr - vma->vm_start) >> PAGE_SHIFT;
 		polnid = offset_il_node(pol, vma, pgoff);
-- 
1.8.5.2

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2017-09-01 13:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  7:02 [PATCH] mm/mempolicy: Move VMA address bound checks inside mpol_misplaced() Anshuman Khandual
2017-09-01  9:05 ` Vlastimil Babka
2017-09-01 12:17   ` Anshuman Khandual
2017-09-01 12:21     ` Anshuman Khandual
2017-09-01 13:01       ` Anshuman Khandual [this message]
2017-09-01 13:16         ` [PATCH] mm/mempolicy: Remove BUG_ON() checks for VMA " Vlastimil Babka

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=20170901130137.7617-1-khandual@linux.vnet.ibm.com \
    --to=khandual@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=vbabka@suse.cz \
    /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).