From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751991Ab3CBDJM (ORCPT ); Fri, 1 Mar 2013 22:09:12 -0500 Received: from mail-da0-f41.google.com ([209.85.210.41]:33466 "EHLO mail-da0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751381Ab3CBDJK (ORCPT ); Fri, 1 Mar 2013 22:09:10 -0500 Date: Fri, 1 Mar 2013 19:08:28 -0800 (PST) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Simon Jeons 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 In-Reply-To: <51316727.1040806@gmail.com> Message-ID: 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> <51316727.1040806@gmail.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) 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 On Sat, 2 Mar 2013, Simon Jeons wrote: > 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. A shmem page is swap-backed file-cache, and it may get transferred to or from swap-cache: yes, it's a difficult and confusing case, as I said below. I would never call it "anonymous", but it is counted in /proc/meminfo's Active(anon) or Inactive(anon) rather than in (file), because "anon" there is shorthand for "swap-backed". > > 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. Hugh