From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932965AbbFVKD1 (ORCPT ); Mon, 22 Jun 2015 06:03:27 -0400 Received: from mta-out1.inet.fi ([62.71.2.229]:57906 "EHLO johanna4.rokki.sonera.fi" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752481AbbFVKDS (ORCPT ); Mon, 22 Jun 2015 06:03:18 -0400 RazorGate-KAS: Rate: 5 RazorGate-KAS: {RECEIVED: dynamic ip detected} RazorGate-KAS: Envelope from: RazorGate-KAS: Version: 5.5.3 RazorGate-KAS: LuaCore: 215 2015-05-29_17-31-22 60ae4a1b4d01d14f868b20a55aced8d7df7b2e28 RazorGate-KAS: Method: none RazorGate-KAS: Lua profiles 78662 [Jun 02 2015] RazorGate-KAS: Status: not_detected Date: Mon, 22 Jun 2015 13:02:45 +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 01/36] mm, proc: adjust PSS calculation Message-ID: <20150622100245.GA7934@node.dhcp.inet.fi> References: <1433351167-125878-1-git-send-email-kirill.shutemov@linux.intel.com> <1433351167-125878-2-git-send-email-kirill.shutemov@linux.intel.com> <5576DC1D.6010800@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5576DC1D.6010800@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 Tue, Jun 09, 2015 at 02:29:17PM +0200, Vlastimil Babka wrote: > On 06/03/2015 07:05 PM, Kirill A. Shutemov wrote: > >With new refcounting all subpages of the compound page are not nessessary > >have the same mapcount. We need to take into account mapcount of every > >sub-page. > > > >Signed-off-by: Kirill A. Shutemov > >Tested-by: Sasha Levin > >Acked-by: Jerome Marchand > >Acked-by: Vlastimil Babka > >--- > > fs/proc/task_mmu.c | 48 +++++++++++++++++++++++++++++++----------------- > > 1 file changed, 31 insertions(+), 17 deletions(-) > > > >diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c > >index 58be92e11939..f9b285761bc0 100644 > >--- a/fs/proc/task_mmu.c > >+++ b/fs/proc/task_mmu.c > >@@ -449,9 +449,10 @@ struct mem_size_stats { > > }; > > > > static void smaps_account(struct mem_size_stats *mss, struct page *page, > >- unsigned long size, bool young, bool dirty) > >+ bool compound, bool young, bool dirty) > > { > >- int mapcount; > >+ int i, nr = compound ? HPAGE_PMD_NR : 1; > >+ unsigned long size = nr * PAGE_SIZE; > > > > if (PageAnon(page)) > > mss->anonymous += size; > >@@ -460,23 +461,36 @@ static void smaps_account(struct mem_size_stats *mss, struct page *page, > > /* Accumulate the size in pages that have been accessed. */ > > if (young || PageReferenced(page)) > > mss->referenced += size; > >- mapcount = page_mapcount(page); > >- if (mapcount >= 2) { > >- u64 pss_delta; > > > >- if (dirty || PageDirty(page)) > >- mss->shared_dirty += size; > >- else > >- mss->shared_clean += size; > >- pss_delta = (u64)size << PSS_SHIFT; > >- do_div(pss_delta, mapcount); > >- mss->pss += pss_delta; > >- } else { > >+ /* > >+ * page_count(page) == 1 guarantees the page is mapped exactly once. > >+ * If any subpage of the compound page mapped with PTE it would elevate > >+ * page_count(). > >+ */ > >+ if (page_count(page) == 1) { > > if (dirty || PageDirty(page)) > > mss->private_dirty += size; > > else > > mss->private_clean += size; > >- mss->pss += (u64)size << PSS_SHIFT; > > Deleting the line above was a mistake, right? Yep :-/ -- 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/