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. Best Regards, Huang, Ying -- 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>