linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Anshuman Khandual <khandual@linux.vnet.ibm.com>, linux-mm@kvack.org
Cc: akpm@linux-foundation.org
Subject: Re: [PATCH] mm/mempolicy: Move VMA address bound checks inside mpol_misplaced()
Date: Fri, 1 Sep 2017 11:05:44 +0200	[thread overview]
Message-ID: <268bbc32-7c1a-cdb8-039a-f1ea5d75b009@suse.cz> (raw)
In-Reply-To: <20170901070228.19954-1-khandual@linux.vnet.ibm.com>

On 09/01/2017 09:02 AM, Anshuman Khandual wrote:
> The VMA address bound checks are applicable to all memory policy modes,
> not just MPOL_INTERLEAVE.

But only MPOL_INTERLEAVE actually uses addr and vma->vm_start.

> Hence move it to the front and make it common.
> 
> Signed-off-by: Anshuman Khandual <khandual@linux.vnet.ibm.com>

I would just remove them instead. Together with the BUG_ON(!vma). Looks
like just leftover from development.

> ---
>  mm/mempolicy.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/mempolicy.c b/mm/mempolicy.c
> index 618ab12..7ec6694 100644
> --- a/mm/mempolicy.c
> +++ b/mm/mempolicy.c
> @@ -2173,6 +2173,8 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
>  	int ret = -1;
>  
>  	BUG_ON(!vma);
> +	BUG_ON(addr >= vma->vm_end);
> +	BUG_ON(addr < vma->vm_start);
>  
>  	pol = get_vma_policy(vma, addr);
>  	if (!(pol->flags & MPOL_F_MOF))
> @@ -2180,9 +2182,6 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
>  
>  	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);
> 

--
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  9:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-01  7:02 Anshuman Khandual
2017-09-01  9:05 ` Vlastimil Babka [this message]
2017-09-01 12:17   ` Anshuman Khandual
2017-09-01 12:21     ` Anshuman Khandual
2017-09-01 13:01       ` [PATCH] mm/mempolicy: Remove BUG_ON() checks for VMA " Anshuman Khandual
2017-09-01 13:16         ` 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=268bbc32-7c1a-cdb8-039a-f1ea5d75b009@suse.cz \
    --to=vbabka@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=khandual@linux.vnet.ibm.com \
    --cc=linux-mm@kvack.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