Re: The usage of page_mapping() in architecture code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Feb 11, 2018 at 04:39:07PM +0800, Huang, Ying wrote:
> Hi, Russell,
> 
> Russell King - ARM Linux <linux@xxxxxxxxxxxxxxx> 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux