All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Jeons <simon.jeons@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	dormando <dormando@rydia.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>,
	Seiji Aguchi <seiji.aguchi@hds.com>,
	Satoru Moriya <satoru.moriya@hds.com>,
	Randy Dunlap <rdunlap@xenotime.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"lwoodman@redhat.com" <lwoodman@redhat.com>,
	Mel Gorman <mel@csn.ul.ie>
Subject: Re: [PATCH] add extra free kbytes tunable
Date: Sat, 09 Mar 2013 09:08:06 +0800	[thread overview]
Message-ID: <513A8B76.5000202@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1303011900430.23383@eggly.anvils>

Hi Hugh,
On 03/02/2013 11:08 AM, Hugh Dickins wrote:
> 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".

In read_swap_cache_async:

SetPageSwapBacked(new_page);
__add_to_swap_cache();
swap_readpage();
ClearPageSwapBacked(new_page);

Why clear PG_swapbacked flag?

>
>>> 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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Simon Jeons <simon.jeons@gmail.com>
To: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	dormando <dormando@rydia.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>,
	Seiji Aguchi <seiji.aguchi@hds.com>,
	Satoru Moriya <satoru.moriya@hds.com>,
	Randy Dunlap <rdunlap@xenotime.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"lwoodman@redhat.com" <lwoodman@redhat.com>,
	Mel Gorman <mel@csn.ul.ie>
Subject: Re: [PATCH] add extra free kbytes tunable
Date: Sat, 09 Mar 2013 09:08:06 +0800	[thread overview]
Message-ID: <513A8B76.5000202@gmail.com> (raw)
In-Reply-To: <alpine.LNX.2.00.1303011900430.23383@eggly.anvils>

Hi Hugh,
On 03/02/2013 11:08 AM, Hugh Dickins wrote:
> 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".

In read_swap_cache_async:

SetPageSwapBacked(new_page);
__add_to_swap_cache();
swap_readpage();
ClearPageSwapBacked(new_page);

Why clear PG_swapbacked flag?

>
>>> 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


  parent reply	other threads:[~2013-03-09  1:08 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12  2:01 extra free kbytes tunable dormando
2013-02-15 22:21 ` Seiji Aguchi
2013-02-15 22:21   ` Seiji Aguchi
2013-02-15 22:25   ` Rik van Riel
2013-02-15 22:25     ` Rik van Riel
2013-02-17 23:48     ` [PATCH] add " dormando
2013-02-17 23:48       ` dormando
2013-02-19 23:29       ` Andrew Morton
2013-02-19 23:29         ` Andrew Morton
2013-02-20  5:19         ` dormando
2013-02-20  5:19           ` dormando
2013-02-22 17:56           ` Johannes Weiner
2013-02-22 17:56             ` Johannes Weiner
2013-02-26 10:47             ` Mel Gorman
2013-02-26 10:47               ` Mel Gorman
2013-02-26 15:13               ` Johannes Weiner
2013-02-26 15:13                 ` Johannes Weiner
2013-02-26 16:25                 ` Mel Gorman
2013-02-26 16:25                   ` Mel Gorman
2013-03-01  9:22             ` Simon Jeons
2013-03-01  9:22               ` Simon Jeons
2013-03-01  9:31               ` Simon Jeons
2013-03-01  9:31                 ` Simon Jeons
2013-03-01 22:33                 ` Hugh Dickins
2013-03-01 22:33                   ` Hugh Dickins
2013-03-02  0:10                   ` Simon Jeons
2013-03-02  0:10                     ` Simon Jeons
2013-03-02  1:42                     ` Hugh Dickins
2013-03-02  1:42                       ` Hugh Dickins
2013-03-02  2:42                       ` Simon Jeons
2013-03-02  2:42                         ` Simon Jeons
2013-03-02  3:08                         ` Hugh Dickins
2013-03-02  3:08                           ` Hugh Dickins
2013-03-02  4:06                           ` Simon Jeons
2013-03-02  4:06                             ` Simon Jeons
2013-03-09  1:08                           ` Simon Jeons [this message]
2013-03-09  1:08                             ` Simon Jeons
2013-02-17 23:54     ` dormando
2013-02-17 23:54       ` dormando
2013-02-15 22:49   ` Satoru Moriya
2013-02-15 22:49     ` Satoru Moriya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=513A8B76.5000202@gmail.com \
    --to=simon.jeons@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dormando@rydia.net \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lwoodman@redhat.com \
    --cc=mel@csn.ul.ie \
    --cc=rdunlap@xenotime.net \
    --cc=riel@redhat.com \
    --cc=satoru.moriya@hds.com \
    --cc=seiji.aguchi@hds.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.