linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Yang Shi <yang.shi@linux.alibaba.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: rmap: use VM_BUG_ON() in __page_check_anon_rmap()
Date: Wed, 6 Nov 2019 11:28:48 +0300	[thread overview]
Message-ID: <20191106082848.eukf2jnjqxlvxgnx@box> (raw)
In-Reply-To: <1572973416-18532-1-git-send-email-yang.shi@linux.alibaba.com>

On Wed, Nov 06, 2019 at 01:03:36AM +0800, Yang Shi wrote:
> The __page_check_anon_rmap() just calls two BUG_ON()s protected by
> CONFIG_DEBUG_VM, the #ifdef could be eliminated by using VM_BUG_ON().
> 
> Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
> ---
>  mm/rmap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/rmap.c b/mm/rmap.c
> index d17cbf3..39178eb 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1055,7 +1055,6 @@ static void __page_set_anon_rmap(struct page *page,
>  static void __page_check_anon_rmap(struct page *page,
>  	struct vm_area_struct *vma, unsigned long address)
>  {
> -#ifdef CONFIG_DEBUG_VM
>  	/*
>  	 * The page's anon-rmap details (mapping and index) are guaranteed to
>  	 * be set up correctly at this point.
> @@ -1068,9 +1067,8 @@ static void __page_check_anon_rmap(struct page *page,
>  	 * are initially only visible via the pagetables, and the pte is locked
>  	 * over the call to page_add_new_anon_rmap.
>  	 */
> -	BUG_ON(page_anon_vma(page)->root != vma->anon_vma->root);
> -	BUG_ON(page_to_pgoff(page) != linear_page_index(vma, address));
> -#endif
> +	VM_BUG_ON(page_anon_vma(page)->root != vma->anon_vma->root);
> +	VM_BUG_ON(page_to_pgoff(page) != linear_page_index(vma, address));

Why not VM_BUG_ON_PAGE()?

-- 
 Kirill A. Shutemov

  reply	other threads:[~2019-11-06  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-05 17:03 [PATCH] mm: rmap: use VM_BUG_ON() in __page_check_anon_rmap() Yang Shi
2019-11-06  8:28 ` Kirill A. Shutemov [this message]
2019-11-06 17:42   ` Yang Shi

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=20191106082848.eukf2jnjqxlvxgnx@box \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=yang.shi@linux.alibaba.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).