Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1396003

Re: [PATCH 2/3] mm: thp: microoptimize compound_mapcount()

From "Kirill A. Shutemov" <kirill@shutemov.name>
Newsgroups linux.kernel
Subject Re: [PATCH 2/3] mm: thp: microoptimize compound_mapcount()
Date 2016-05-06 19:40 +0200
Message-ID <rvRTl-13G-9@gated-at.bofh.it> (permalink)
References <rvPy9-7xW-1@gated-at.bofh.it> <rvPya-7xW-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, May 06, 2016 at 05:03:59PM +0200, Andrea Arcangeli wrote:
> compound_mapcount() is only called after PageCompound() has already
> been checked by the caller, so there's no point to check it again. Gcc
> may optimize it away too because it's inline but this will remove the
> runtime check for sure and add it'll add an assert instead.
> 
> Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

> ---
>  include/linux/mm.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index 263f229..726ba80 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -471,8 +471,7 @@ static inline atomic_t *compound_mapcount_ptr(struct page *page)
>  
>  static inline int compound_mapcount(struct page *page)
>  {
> -	if (!PageCompound(page))
> -		return 0;
> +	VM_BUG_ON_PAGE(!PageCompound(page), page);
>  	page = compound_head(page);
>  	return atomic_read(compound_mapcount_ptr(page)) + 1;
>  }

-- 
 Kirill A. Shutemov

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] mm: thp: mapcount updates Andrea Arcangeli <aarcange@redhat.com> - 2016-05-06 17:10 +0200
  [PATCH 2/3] mm: thp: microoptimize compound_mapcount() Andrea Arcangeli <aarcange@redhat.com> - 2016-05-06 17:10 +0200
    Re: [PATCH 2/3] mm: thp: microoptimize compound_mapcount() "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-05-06 19:40 +0200
  [PATCH 1/3] mm: thp: calculate the mapcount correctly for THP pages during WP faults Andrea Arcangeli <aarcange@redhat.com> - 2016-05-06 17:10 +0200
    Re: [PATCH 1/3] mm: thp: calculate the mapcount correctly for THP  pages during WP faults Alex Williamson <alex.williamson@redhat.com> - 2016-05-07 00:20 +0200
    Re: [PATCH 1/3] mm: thp: calculate the mapcount correctly for THP  pages during WP faults Andrew Morton <akpm@linux-foundation.org> - 2016-05-10 00:30 +0200
    [PATCH 1/1] mm: thp: calculate the mapcount correctly for THP pages during WP faults Andrea Arcangeli <aarcange@redhat.com> - 2016-05-10 21:30 +0200
      Re: [1/1] mm: thp: calculate the mapcount correctly for THP pages during WP faults Mike Marciniszyn <mike.marciniszyn@intel.com> - 2016-05-11 23:30 +0200
  [PATCH 3/3] mm: thp: split_huge_pmd_address() comment improvement Andrea Arcangeli <aarcange@redhat.com> - 2016-05-06 17:10 +0200
    Re: [PATCH 3/3] mm: thp: split_huge_pmd_address() comment improvement "Kirill A. Shutemov" <kirill@shutemov.name> - 2016-05-06 19:40 +0200

csiph-web