From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756095AbbFVKWj (ORCPT ); Mon, 22 Jun 2015 06:22:39 -0400 Received: from mta-out1.inet.fi ([62.71.2.229]:52047 "EHLO johanna3.rokki.sonera.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752340AbbFVKWh (ORCPT ); Mon, 22 Jun 2015 06:22:37 -0400 RazorGate-KAS: Rate: 5 RazorGate-KAS: {RECEIVED: dynamic ip detected} RazorGate-KAS: Envelope from: RazorGate-KAS: Version: 5.5.3 RazorGate-KAS: LuaCore: 80 2014-11-10_18-01-23 260f8afb9361da3c7edfd3a8e3a4ca908191ad29 RazorGate-KAS: Method: none RazorGate-KAS: Lua profiles 69136 [Nov 12 2014] RazorGate-KAS: Status: not_detected Date: Mon, 22 Jun 2015 13:22:06 +0300 From: "Kirill A. Shutemov" To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Andrew Morton , Andrea Arcangeli , Hugh Dickins , Dave Hansen , Mel Gorman , Rik van Riel , Christoph Lameter , Naoya Horiguchi , Steve Capper , "Aneesh Kumar K.V" , Johannes Weiner , Michal Hocko , Jerome Marchand , Sasha Levin , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCHv6 26/36] mm: rework mapcount accounting to enable 4k mapping of THPs Message-ID: <20150622102206.GB7934@node.dhcp.inet.fi> References: <1433351167-125878-1-git-send-email-kirill.shutemov@linux.intel.com> <1433351167-125878-27-git-send-email-kirill.shutemov@linux.intel.com> <55783FDA.3080700@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55783FDA.3080700@suse.cz> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2015 at 03:47:06PM +0200, Vlastimil Babka wrote: > On 06/03/2015 07:05 PM, Kirill A. Shutemov wrote: > >@@ -415,8 +428,17 @@ static inline void page_mapcount_reset(struct page *page) > > > > static inline int page_mapcount(struct page *page) > > { > >+ int ret; > > VM_BUG_ON_PAGE(PageSlab(page), page); > >- return atomic_read(&page->_mapcount) + 1; > >+ > >+ ret = atomic_read(&page->_mapcount) + 1; > >+ if (PageCompound(page)) { > >+ page = compound_head(page); > >+ ret += compound_mapcount(page); > > compound_mapcount() means another PageCompound() and compound_head(), which > you just did. I've tried this to see the effect on a function that "calls" > (inlines) page_mapcount() once: > > - ret += compound_mapcount(page); > + ret += atomic_read(compound_mapcount_ptr(page)) + 1; > > bloat-o-meter on compaction.o: > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-59 (-59) > function old new delta > isolate_migratepages_block 1769 1710 -59 Okay, fair enough. > >diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > >index 74b7cece1dfa..a8d47c1edf6a 100644 > >--- a/include/linux/page-flags.h > >+++ b/include/linux/page-flags.h > >@@ -127,6 +127,9 @@ enum pageflags { > > > > /* SLOB */ > > PG_slob_free = PG_private, > >+ > >+ /* THP. Stored in first tail page's flags */ > >+ PG_double_map = PG_private_2, > > Well, not just THP. Any user of compound pages must make sure not to use > PG_private_2 on the first tail page. At least where the page is going to be > user-mapped. And same thing about fields that are in union with > compound_mapcount. Should that be documented more prominently somewhere? I would substitute "THP" for "Compound pages". > I guess there's no such user so far, right? I believe so. -- Kirill A. Shutemov -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in Please read the FAQ at http://www.tux.org/lkml/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by kanga.kvack.org (Postfix) with ESMTP id 9DA9E6B0032 for ; Mon, 22 Jun 2015 06:22:27 -0400 (EDT) Received: by wicnd19 with SMTP id nd19so71847179wic.1 for ; Mon, 22 Jun 2015 03:22:27 -0700 (PDT) Received: from johanna3.rokki.sonera.fi (mta-out1.inet.fi. [62.71.2.230]) by mx.google.com with ESMTP id iz2si1358216wic.101.2015.06.22.03.22.25 for ; Mon, 22 Jun 2015 03:22:26 -0700 (PDT) Date: Mon, 22 Jun 2015 13:22:06 +0300 From: "Kirill A. Shutemov" Subject: Re: [PATCHv6 26/36] mm: rework mapcount accounting to enable 4k mapping of THPs Message-ID: <20150622102206.GB7934@node.dhcp.inet.fi> References: <1433351167-125878-1-git-send-email-kirill.shutemov@linux.intel.com> <1433351167-125878-27-git-send-email-kirill.shutemov@linux.intel.com> <55783FDA.3080700@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55783FDA.3080700@suse.cz> Sender: owner-linux-mm@kvack.org List-ID: To: Vlastimil Babka Cc: "Kirill A. Shutemov" , Andrew Morton , Andrea Arcangeli , Hugh Dickins , Dave Hansen , Mel Gorman , Rik van Riel , Christoph Lameter , Naoya Horiguchi , Steve Capper , "Aneesh Kumar K.V" , Johannes Weiner , Michal Hocko , Jerome Marchand , Sasha Levin , linux-kernel@vger.kernel.org, linux-mm@kvack.org On Wed, Jun 10, 2015 at 03:47:06PM +0200, Vlastimil Babka wrote: > On 06/03/2015 07:05 PM, Kirill A. Shutemov wrote: > >@@ -415,8 +428,17 @@ static inline void page_mapcount_reset(struct page *page) > > > > static inline int page_mapcount(struct page *page) > > { > >+ int ret; > > VM_BUG_ON_PAGE(PageSlab(page), page); > >- return atomic_read(&page->_mapcount) + 1; > >+ > >+ ret = atomic_read(&page->_mapcount) + 1; > >+ if (PageCompound(page)) { > >+ page = compound_head(page); > >+ ret += compound_mapcount(page); > > compound_mapcount() means another PageCompound() and compound_head(), which > you just did. I've tried this to see the effect on a function that "calls" > (inlines) page_mapcount() once: > > - ret += compound_mapcount(page); > + ret += atomic_read(compound_mapcount_ptr(page)) + 1; > > bloat-o-meter on compaction.o: > add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-59 (-59) > function old new delta > isolate_migratepages_block 1769 1710 -59 Okay, fair enough. > >diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h > >index 74b7cece1dfa..a8d47c1edf6a 100644 > >--- a/include/linux/page-flags.h > >+++ b/include/linux/page-flags.h > >@@ -127,6 +127,9 @@ enum pageflags { > > > > /* SLOB */ > > PG_slob_free = PG_private, > >+ > >+ /* THP. Stored in first tail page's flags */ > >+ PG_double_map = PG_private_2, > > Well, not just THP. Any user of compound pages must make sure not to use > PG_private_2 on the first tail page. At least where the page is going to be > user-mapped. And same thing about fields that are in union with > compound_mapcount. Should that be documented more prominently somewhere? I would substitute "THP" for "Compound pages". > I guess there's no such user so far, right? I believe so. -- 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: email@kvack.org