linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mel Gorman <mgorman@techsingularity.net>
To: Wei Yang <richard.weiyang@gmail.com>
Cc: akpm@linux-foundation.org, mhocko@suse.com, linux-mm@kvack.org
Subject: Re: [PATCH] mm: get pfn by page_to_pfn() instead of save in page->private
Date: Thu, 18 Oct 2018 15:53:42 +0100	[thread overview]
Message-ID: <20181018145342.GP5819@techsingularity.net> (raw)
In-Reply-To: <20181018141926.zjiebfjcodthvagg@master>

On Thu, Oct 18, 2018 at 02:19:26PM +0000, Wei Yang wrote:
> On Thu, Oct 18, 2018 at 02:39:17PM +0100, Mel Gorman wrote:
> >On Thu, Oct 18, 2018 at 09:04:29PM +0800, Wei Yang wrote:
> >> This is not necessary to save the pfn to page->private.
> >> 
> >> The pfn could be retrieved by page_to_pfn() directly.
> >> 
> >> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> >
> >page_to_pfn is not free which is why it's cached.
> >
> 
> Hi, Mel
> 
> Thanks for your response.
> 
> Not free means the access to mem_section?
> 

That's memory model specific but in some cases yes, it's accessing
mem_section.

> I have thought about the cache thing, so we assume the list is not that
> long, and the cache could hold those page->private for the whole loop?
> 

The intent was to avoid multiple page->pfn translations.

> In my understand, it the cache has limited size, if more data accessed
> the cache will be overwritten.
> 
> And another thing is:
> 
> In case of CONFIG_SPARSEMEM_VMEMMAP, would this be a little different?

Yes because the lookup has a different cost

> Becase we get pfn by a simple addition. Which I think no need to cache
> it?
> 

Because SPARSEMEM_VMEMMAP is not always used but also because it's
harmless to cache even in the SPARSEMEM_VMEMMAP case.

-- 
Mel Gorman
SUSE Labs

      reply	other threads:[~2018-10-18 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 13:04 [PATCH] mm: get pfn by page_to_pfn() instead of save in page->private Wei Yang
2018-10-18 13:10 ` Matthew Wilcox
2018-10-18 13:15 ` Michal Hocko
2018-10-18 14:10   ` Wei Yang
2018-10-18 16:30     ` Michal Hocko
2018-10-19  3:32       ` Wei Yang
2018-10-18 13:39 ` Mel Gorman
2018-10-18 14:19   ` Wei Yang
2018-10-18 14:53     ` Mel Gorman [this message]

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=20181018145342.GP5819@techsingularity.net \
    --to=mgorman@techsingularity.net \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=richard.weiyang@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).