Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934457AbbEOLdg (ORCPT ); Fri, 15 May 2015 07:33:36 -0400 Received: from cantor2.suse.de ([195.135.220.15]:53699 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754317AbbEOLdf (ORCPT ); Fri, 15 May 2015 07:33:35 -0400 Message-ID: <5555D98B.7010900@suse.cz> Date: Fri, 15 May 2015 13:33:31 +0200 From: Vlastimil Babka User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: "Kirill A. Shutemov" 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: [PATCHv5 01/28] mm, proc: adjust PSS calculation References: <1429823043-157133-1-git-send-email-kirill.shutemov@linux.intel.com> <1429823043-157133-2-git-send-email-kirill.shutemov@linux.intel.com> <5554AD4D.9040000@suse.cz> <20150515105621.GA6250@node.dhcp.inet.fi> In-Reply-To: <20150515105621.GA6250@node.dhcp.inet.fi> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1922 Lines: 47 On 05/15/2015 12:56 PM, Kirill A. Shutemov wrote: > On Thu, May 14, 2015 at 04:12:29PM +0200, Vlastimil Babka wrote: >> On 04/23/2015 11:03 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: Vlastimil Babka >> >> (some nitpicks below) >> >>> --- >>> fs/proc/task_mmu.c | 43 ++++++++++++++++++++++--------------------- >>> 1 file changed, 22 insertions(+), 21 deletions(-) >>> >>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c >>> index 956b75d61809..95bc384ee3f7 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_nr_pages(page) : 1; >> >> Why not just HPAGE_PMD_NR instead of hpage_nr_pages(page)? > > Okay, makes sense. Compiler is smart enough to optimize away HPAGE_PMD_NR > for THP=n. (HPAGE_PMD_NR is BUILD_BUG() for THP=n) Ah, BUILD_BUG()... I'm not sure we can rely on optimization to avoid BUILD_BUG(), what if somebody compiles with all optimizations off? So why not replace BUILD_BUG() with "1", or create a variant of HPAGE_PMD_NR that does that, for this case and patch 3. Seems better than testing PageTransHuge everywhere... -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/