On Wed, Jun 30, 2021 at 02:45:33PM +0200, Michal Hocko wrote: > On Wed 30-06-21 13:31:17, Matthew Wilcox wrote: > > On Wed, Jun 30, 2021 at 02:20:38PM +0200, Michal Hocko wrote: > > > On Wed 30-06-21 12:22:48, Matthew Wilcox wrote: > > > > We need to decide what 'NR_ANON_THPS' means in a folio-based world where > > > > we have folios of all orders. Does it count only the number of pages > > > > in folios >= HPAGE_PMD_SIZE? Or does it count the number of pages in > > > > folios > PAGE_SIZE? > > > > > > At this stage we only have PMD based, right? I believe it would be > > > simpler to stick with that at the moment and change that to a more > > > generic way along with other places which need updating. > > > > > > Wrt. counters they do count pages so in this case this shouldn't be a > > > problem. But we do have counters for pmd mappings and that might need > > > some care. > > > > Looking at how these are reported: > > > > show_val_kb(m, "AnonHugePages: ", > > global_node_page_state(NR_ANON_THPS)); > > show_val_kb(m, "ShmemHugePages: ", > > global_node_page_state(NR_SHMEM_THPS)); > > show_val_kb(m, "ShmemPmdMapped: ", > > global_node_page_state(NR_SHMEM_PMDMAPPED)); > > show_val_kb(m, "FileHugePages: ", > > global_node_page_state(NR_FILE_THPS)); > > show_val_kb(m, "FilePmdMapped: ", > > global_node_page_state(NR_FILE_PMDMAPPED)); > > > > it specifically refers to 'HugePages', so I think we need to only > > count folios with order >= PMD_ORDER. > > Why? The presented value is in kB. It gives us a cumulative number of > transparent large pages. Sure breakdown to respective orders would be > impossible in general but the same would be the case if order > PMD_ORDER. > > I am not really sure how useful that information is in practice but that > is a different story. The scenario I'm thinking about is a situation where we have gigabytes of memory in the page cache in 16k-64k chunks and we'll see FileHugePages: 5219348 kB FilePmdMapped: 0 kB which might cause the slightly-too-clever user to think there's a problem.