Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752240AbcDQC21 (ORCPT ); Sat, 16 Apr 2016 22:28:27 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36484 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751975AbcDQC20 (ORCPT ); Sat, 16 Apr 2016 22:28:26 -0400 Date: Sat, 16 Apr 2016 19:28:22 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: "Kirill A. Shutemov" cc: Hugh Dickins , Andrew Morton , "Kirill A. Shutemov" , Andrea Arcangeli , Andres Lagar-Cavilla , Yang Shi , Ning Qu , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 01/31] huge tmpfs: prepare counts in meminfo, vmstat and SysRq-m In-Reply-To: <20160411110545.GD22996@node.shutemov.name> Message-ID: References: <20160411110545.GD22996@node.shutemov.name> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) 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: 2847 Lines: 68 On Mon, 11 Apr 2016, Kirill A. Shutemov wrote: > On Tue, Apr 05, 2016 at 02:12:26PM -0700, Hugh Dickins wrote: > > ShmemFreeHoles will show the wastage from using huge pages for small, or > > sparsely occupied, or unrounded files: wastage not included in Shmem or > > MemFree, but will be freed under memory pressure. (But no count for the > > partially occupied portions of huge pages: seems less important, but > > could be added.) > > And here first difference in interfaces comes: I don't have an > equivalent in my implementation, as I don't track such information. > It looks like an implementation detail for team-pages based huge tmpfs. It's an implementation detail insofar as that you've not yet implemented the equivalent with compound pages - and I think you're hoping never to do so. Of course, nobody wants ShmemFreeHoles as such, but they do want the filesize flexibility that comes with them. And they may be an important detail if free memory is vanishing into a black hole. They are definitely a peculiar category, which is itself a strong reason for making them visible in some way. But I don't think I'd mind if we decided they're not quite up to /proc/meminfo standards, and should be shown somewhere else instead. [Quiet sob.] But if we do move them out of /proc/meminfo, I'll argue that they should then be added in to the user-visible MemFree (though not to the internal NR_FREE_PAGES): at different times I've felt differently on that, and when MemAvailable came in, then it was so clear that they belong in that category, that I didn't want them in MemFree; but if they're not themselves high-level visible in /proc/meminfo, then I think that probably they should go into MemFree. But really, here, we want distro advice rather than my musings. > > We don't track anything similar for anon-THP. The case just doesn't arise with anon THP (or didn't arise before your recent changes anyway): the object could only be a pmd-mapped entity, and always showing AnonFreeHoles 0kB is just boring. > > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -3830,6 +3830,11 @@ out: > > } > > > > #define K(x) ((x) << (PAGE_SHIFT-10)) > > +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > > +#define THPAGE_PMD_NR HPAGE_PMD_NR > > +#else > > +#define THPAGE_PMD_NR 0 /* Avoid BUILD_BUG() */ > > +#endif > > I've just put THP-related counters on separate line and wrap it into > #ifdef. Time and time again I get very annoyed by that BUILD_BUG() buried inside HPAGE_PMD_NR. I expect you do too. But it's true that it does sometimes alert us to some large chunk of code that ought to be slightly reorganized to get it optimized away. So I never quite summon up the courage to un-BUILD_BUG it. I think we need a secret definition that only you and I know, THPAGE_PMD_NR or whatever, to get around it on occasion. Hugh