linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: "Huang, Ying" <ying.huang@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Minchan Kim <minchan@kernel.org>, Michal Hocko <mhocko@suse.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@techsingularity.net>,
	Dave Hansen <dave.hansen@intel.com>,
	Chen Liqin <liqin.linux@gmail.com>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	"James E.J. Bottomley" <jejb@parisc-linux.org>,
	Guan Xuetao <gxt@mprc.pku.edu.cn>,
	"David S. Miller" <davem@davemloft.net>,
	Chris Zankel <chris@zankel.net>,
	Vineet Gupta <vgupta@synopsys.com>,
	Ley Foon Tan <lftan@altera.com>,
	Ralf Baechle <ralf@linux-mips.org>,
	Andi Kleen <ak@linux.intel.com>,
	linux-mm@kvack.org, Andrea Arcangeli <aarcange@redhat.com>,
	Hugh Dickins <hughd@google.com>
Subject: Re: The usage of page_mapping() in architecture code
Date: Sun, 11 Feb 2018 13:21:29 +0000	[thread overview]
Message-ID: <20180211132128.GN9418@n2100.armlinux.org.uk> (raw)
In-Reply-To: <87fu67yl78.fsf@yhuang-dev.intel.com>

On Sun, Feb 11, 2018 at 04:39:07PM +0800, Huang, Ying wrote:
> Hi, Russell,
> 
> Russell King - ARM Linux <linux@armlinux.org.uk> writes:
> 
> > On Sun, Feb 11, 2018 at 02:43:39PM +0800, Huang, Ying wrote:
> [snip]
> >> 
> >> 
> >> if page is an anonymous page in swap cache, "mapping &&
> >> !mapping_mapped()" will be true, so we will delay flushing.  But if my
> >> understanding of the code were correct, we should call
> >> flush_kernel_dcache() because the kernel may access the page during
> >> swapping in/out.
> >> 
> >> The code in other architectures follow the similar logic.  Would it be
> >> better for page_mapping() here to return NULL for anonymous pages even
> >> if they are in swap cache?  Of course we need to change the function
> >> name.  page_file_mapping() appears a good name, but that has been used
> >> already.  Any suggestion?
> >
> > flush_dcache_page() does nothing for anonymous pages (see cachetlb.txt,
> > it's only defined to do anything for page cache pages.)
> >
> > flush_anon_page() deals with anonymous pages.
> 
> Thanks for your information!  But I found this isn't followed exactly in
> the code.  For example, in get_mergeable_page() in mm/ksm.c,
> 
> 	if (PageAnon(page)) {
> 		flush_anon_page(vma, page, addr);
> 		flush_dcache_page(page);
> 	} else {
> 		put_page(page);
> 
> flush_dcache_page() is called for anonymous pages too.

... and flush_dcache_page() will be a no-op here, as per its
documentation.  Any flushing required here will have been taken care of
with flush_anon_page().

If flush_dcache_page() were to do flushing here, it would repeat the
flushing that flush_anon_page() has just done, so its pointless.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

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

      reply	other threads:[~2018-02-11 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  6:43 Huang, Ying
2018-02-11  6:47 ` Huang, Ying
2018-02-11  8:17 ` Russell King - ARM Linux
2018-02-11  8:39   ` Huang, Ying
2018-02-11 13:21     ` Russell King - ARM Linux [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=20180211132128.GN9418@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=chris@zankel.net \
    --cc=dave.hansen@intel.com \
    --cc=davem@davemloft.net \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jejb@parisc-linux.org \
    --cc=lftan@altera.com \
    --cc=linux-mm@kvack.org \
    --cc=liqin.linux@gmail.com \
    --cc=mgorman@techsingularity.net \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=ralf@linux-mips.org \
    --cc=vgupta@synopsys.com \
    --cc=ying.huang@intel.com \
    --cc=ysato@users.sourceforge.jp \
    /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