linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com,
	khlebnikov@openvz.org, riel@redhat.com, mgorman@suse.de,
	mhocko@suse.cz, hughd@google.com, vbabka@suse.cz,
	walken@google.com, minchan@kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 3/3] Convert a few VM_BUG_ON callers to VM_BUG_ON_VMA
Date: Fri, 29 Aug 2014 15:17:19 -0400	[thread overview]
Message-ID: <20140829191719.GC12774@nhori.bos.redhat.com> (raw)
In-Reply-To: <1409324059-28692-3-git-send-email-sasha.levin@oracle.com>

On Fri, Aug 29, 2014 at 10:54:19AM -0400, Sasha Levin wrote:
> Trivially convert a few VM_BUG_ON calls to VM_BUG_ON_VMA to extract
> more information when they trigger.
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
...
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 3e8491c..5fbd0fe 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
...
> @@ -897,7 +897,7 @@ void page_move_anon_rmap(struct page *page,
>  	struct anon_vma *anon_vma = vma->anon_vma;
>  
>  	VM_BUG_ON_PAGE(!PageLocked(page), page);
> -	VM_BUG_ON(!anon_vma);
> +	VM_BUG_ON_VMA(!anon_vma, vma);

>  	VM_BUG_ON_PAGE(page->index != linear_page_index(vma, address), page);

This line contains both of vma and page.
But I'm not sure that introducing another macro like VM_BUG_ON_PAGE_AND_VMA()
is worth doing. So it's ok for me to keep it untouched.

>  
>  	anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON;
> @@ -1024,7 +1024,7 @@ void do_page_add_anon_rmap(struct page *page,
>  void page_add_new_anon_rmap(struct page *page,
>  	struct vm_area_struct *vma, unsigned long address)
>  {
> -	VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end);
> +	VM_BUG_ON_VMA(address < vma->vm_start || address >= vma->vm_end, vma);
>  	SetPageSwapBacked(page);
>  	atomic_set(&page->_mapcount, 0); /* increment count (starts at -1) */
>  	if (PageTransHuge(page))
> @@ -1666,7 +1666,7 @@ static int rmap_walk_file(struct page *page, struct rmap_walk_control *rwc)
>  	 * structure at mapping cannot be freed and reused yet,
>  	 * so we can safely take mapping->i_mmap_mutex.
>  	 */
> -	VM_BUG_ON(!PageLocked(page));
> +	VM_BUG_ON_PAGE(!PageLocked(page), page);

This is not the replacement with VM_BUG_ON_VMA(), but it's fine :)

Reviewed-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>

Thanks,
Naoya Horiguchi

--
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:[~2014-08-29 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-29 14:54 [PATCH 1/3] Introduce dump_vma Sasha Levin
2014-08-29 14:54 ` [PATCH 2/3] Introduce VM_BUG_ON_VMA Sasha Levin
2014-08-29 18:51   ` Naoya Horiguchi
2014-08-29 14:54 ` [PATCH 3/3] Convert a few VM_BUG_ON callers to VM_BUG_ON_VMA Sasha Levin
2014-08-29 19:17   ` Naoya Horiguchi [this message]
2014-08-29 19:32     ` Sasha Levin
2014-08-29 18:51 ` [PATCH 1/3] Introduce dump_vma Naoya Horiguchi
2014-08-29 19:37 ` 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=20140829191719.GC12774@nhori.bos.redhat.com \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=khlebnikov@openvz.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.cz \
    --cc=minchan@kernel.org \
    --cc=riel@redhat.com \
    --cc=sasha.levin@oracle.com \
    --cc=vbabka@suse.cz \
    --cc=walken@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