Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752090Ab3CBCs3 (ORCPT ); Fri, 1 Mar 2013 21:48:29 -0500 Received: from mail-ia0-f181.google.com ([209.85.210.181]:51678 "EHLO mail-ia0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751744Ab3CBCs2 (ORCPT ); Fri, 1 Mar 2013 21:48:28 -0500 Message-ID: <51316727.1040806@gmail.com> Date: Sat, 02 Mar 2013 10:42:47 +0800 From: Simon Jeons User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130221 Thunderbird/17.0.3 MIME-Version: 1.0 To: Hugh Dickins CC: Johannes Weiner , dormando , Andrew Morton , Rik van Riel , Seiji Aguchi , Satoru Moriya , Randy Dunlap , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "lwoodman@redhat.com" , Mel Gorman Subject: Re: [PATCH] add extra free kbytes tunable References: <511EB5CB.2060602@redhat.com> <20130219152936.f079c971.akpm@linux-foundation.org> <20130222175634.GA4824@cmpxchg.org> <51307354.5000401@gmail.com> <51307583.2020006@gmail.com> <5131438B.4090507@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; 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: 2252 Lines: 48 On 03/02/2013 09:42 AM, Hugh Dickins wrote: > On Sat, 2 Mar 2013, Simon Jeons wrote: >> In function __add_to_swap_cache if add to radix tree successfully will result >> in increase NR_FILE_PAGES, why? This is anonymous page instead of file backed >> page. > Right, that's hard to understand without historical background. > > I think the quick answer would be that we used to (and still do) think > of file-cache and swap-cache as two halves of page-cache. And then when shmem page should be treated as file-cache or swap-cache? It is strange since it is consist of anonymous pages and these pages establish files. > someone changed the way stats were gathered, they couldn't very well > name the stat for page-cache pages NR_PAGE_PAGES, so they called it > NR_FILE_PAGES - but it still included swap. > > We have tried down the years to keep the info shown in /proc/meminfo > (for example, but it is the prime example) consistent across releases, > while adding new lines and new distinctions. > > But it has often been hard to find good enough short enough names for > those new distinctions: when 2.6.28 split the LRUs between file-backed > and swap-backed, it used "anon" for swap-backed in /proc/meminfo. > > So you'll find that shmem and swap are counted as file in some places > and anon in others, and it's hard to grasp which is where and why, > without remembering the history. > > I notice that fs/proc/meminfo.c:meminfo_proc_show() subtracts > total_swapcache_pages from the NR_FILE_PAGES count for /proc/meminfo: > so it's undoing what you observe __add_to_swap_cache() to be doing. > > It's quite possible that if you went through all the users of > NR_FILE_PAGES, you'd find it makes much more sense to leave out > the swap-cache pages, and just add those on where needed. > > But you might find a few places where it's hard to decide whether > the swap-cache pages were ever intended to be included or not, and > hard to decide if it's safe to change those numbers now or not. > > Hugh -- 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/