Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751430AbbG1WPV (ORCPT ); Tue, 28 Jul 2015 18:15:21 -0400 Received: from mail-pd0-f173.google.com ([209.85.192.173]:33418 "EHLO mail-pd0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750791AbbG1WPT (ORCPT ); Tue, 28 Jul 2015 18:15:19 -0400 Date: Tue, 28 Jul 2015 15:15:17 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Mike Kravetz cc: =?UTF-8?Q?J=C3=B6rn_Engel?= , "linux-mm@kvack.org" , linux-kernel Subject: Re: hugetlb pages not accounted for in rss In-Reply-To: <55B7F0F8.8080909@oracle.com> Message-ID: References: <55B6BE37.3010804@oracle.com> <20150728183248.GB1406@Sligo.logfs.org> <55B7F0F8.8080909@oracle.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2125 Lines: 48 On Tue, 28 Jul 2015, Mike Kravetz wrote: > > > The easiest way to resolve this issue would be to remove the test and > > > perhaps document that hugetlb pages are not accounted for in rss. > > > However, it does seem like a big oversight that hugetlb pages are not > > > accounted for in rss. From a quick scan of the code it appears THP > > > pages are properly accounted for. > > > > > > Thoughts? > > > > Unsurprisingly I agree that hugepages should count towards rss. Keeping > > the test in keeps us honest. Actually fixing the issue would make us > > honest and correct. > > > > Increasingly we have tiny processes (by rss) that actually consume large > > fractions of total memory. Makes rss somewhat useless as a measure of > > anything. > > I'll take a look at what it would take to get the accounting in place. I'm not sure that I would agree that accounting hugetlb pages in rss would always be appropriate. For reserved hugetlb pages, not surplus, the hugetlb pages are always resident even when unmapped. Unmapping the memory is not going to cause them to be freed. That's different from thp where the hugepages are actually freed when you do munmap(). The oom killer looks at rss as the metric to determine which process to kill that will result in a large amount of memory freeing. If hugetlb pages are accounted in rss, this may lead to unnecessary killing since little memory may be freed as a result. For that reason, we've added hugetlb statistics to the oom killer output since we've been left wondering in the past where all the memory on the system went :) We also have a separate hugetlb cgroup that tracks hugetlb memory usage rather than memcg. Starting to account hugetlb pages in rss may lead to breakage in userspace and I would agree with your earlier suggestion that just removing any test for rss would be appropriate. -- 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/