On Thu, Feb 01, 2018 at 03:27:52PM +0300, Kirill A. Shutemov wrote: > On Wed, Jan 31, 2018 at 12:42:45PM -0500, Jerome Glisse wrote: > > The overall idea i have is that in any place in the kernel (except memory reclaim > > but that's ok) we can either get mapping or buffer_head information without relying > > on struct page and if we have either one and a struct page then we can find the > > other one. > > Why is it okay for reclaim? > > And what about physical memory scanners that doesn't have any side information > about the page they step onto? Reclaim is only interested in unmapping and reclaiming, KSM already provide special function for unmapping (rmap walk) so it is just about extending that for file back page. For physical memory scanners it depends on what their individual objectives are. I have not reviewed them but had the feeling that i could add special KSM helpers to achieve aims of each one of them. The mapping information is not lost, it would just not be easily accessible for those write protected pages. Cheers, Jérôme