From: "Kirill A. Shutemov" <kirill@shutemov.name> To: Andrea Arcangeli <aarcange@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com> Subject: Re: [PATCH 2/3] mm: thp: microoptimize compound_mapcount() Date: Fri, 6 May 2016 20:33:30 +0300 [thread overview] Message-ID: <20160506173330.GA9879@node.shutemov.name> (raw) In-Reply-To: <1462547040-1737-3-git-send-email-aarcange@redhat.com> 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
WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name> To: Andrea Arcangeli <aarcange@redhat.com> Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Alex Williamson <alex.williamson@redhat.com> Subject: Re: [PATCH 2/3] mm: thp: microoptimize compound_mapcount() Date: Fri, 6 May 2016 20:33:30 +0300 [thread overview] Message-ID: <20160506173330.GA9879@node.shutemov.name> (raw) In-Reply-To: <1462547040-1737-3-git-send-email-aarcange@redhat.com> 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 -- 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>
next prev parent reply other threads:[~2016-05-06 17:33 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2016-05-06 15:03 [PATCH 0/3] mm: thp: mapcount updates Andrea Arcangeli 2016-05-06 15:03 ` Andrea Arcangeli 2016-05-06 15:03 ` [PATCH 1/3] mm: thp: calculate the mapcount correctly for THP pages during WP faults Andrea Arcangeli 2016-05-06 15:03 ` Andrea Arcangeli 2016-05-06 22:10 ` Alex Williamson 2016-05-06 22:10 ` Alex Williamson 2016-05-09 22:26 ` Andrew Morton 2016-05-09 22:26 ` Andrew Morton 2016-05-10 19:21 ` [PATCH 1/1] " Andrea Arcangeli 2016-05-10 19:21 ` Andrea Arcangeli [not found] ` <1462908082-12657-1-git-send-email-aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2016-05-11 21:26 ` [1/1] " Mike Marciniszyn 2016-05-11 21:26 ` Mike Marciniszyn 2016-05-11 21:26 ` Mike Marciniszyn 2016-05-12 16:32 ` [PATCH 1/1] " Andrea Arcangeli 2016-05-12 16:32 ` Andrea Arcangeli 2016-05-12 16:32 ` Andrea Arcangeli [not found] ` <1463070742-18401-1-git-send-email-aarcange-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 2016-05-12 18:48 ` [1/1] " Mike Marciniszyn 2016-05-12 18:48 ` Mike Marciniszyn 2016-05-12 18:48 ` Mike Marciniszyn 2016-05-06 15:03 ` [PATCH 2/3] mm: thp: microoptimize compound_mapcount() Andrea Arcangeli 2016-05-06 15:03 ` Andrea Arcangeli 2016-05-06 17:33 ` Kirill A. Shutemov [this message] 2016-05-06 17:33 ` Kirill A. Shutemov 2016-05-06 15:04 ` [PATCH 3/3] mm: thp: split_huge_pmd_address() comment improvement Andrea Arcangeli 2016-05-06 15:04 ` Andrea Arcangeli 2016-05-06 17:33 ` Kirill A. Shutemov 2016-05-06 17:33 ` Kirill A. Shutemov
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=20160506173330.GA9879@node.shutemov.name \ --to=kirill@shutemov.name \ --cc=aarcange@redhat.com \ --cc=akpm@linux-foundation.org \ --cc=alex.williamson@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.