[ups this got stuck in the outgoing queue] On Tue 26-09-17 15:07:05, Michal Hocko wrote: > On Fri 22-09-17 11:46:30, Shaohua Li wrote: > > From: Shaohua Li <shli@xxxxxx> > > > > MADV_FREE clears pte dirty bit and then marks the page lazyfree (clear > > SwapBacked). There is no lock to prevent the page is added to swap cache > > between these two steps by page reclaim. If the page is added to swap > > cache, marking the page lazyfree will confuse page fault if the page is > > reclaimed and refault. > > Could you be more specific how exactly what kind of the confusion is the > result? I suspect you are talking about VM_BUG_ON_PAGE in > __add_to_swap_cache right? I completely mixed reclaim and the #PF path here > I am also not sure how that would actually happen to be honest. If we > raced with the reclaim then the page should have been isolated and so > PageLRU is no longer true. Or am I missing something? And here I've completely missed that the swapcache page will go back to the LRU. Stupid me. Your new changelog [1] explained it all. Thanks and sorry for these stupid questions. [1] http://lkml.kernel.org/r/6537ef3814398c0073630b03f176263bc81f0902.1506446061.git.shli@xxxxxx -- Michal Hocko SUSE Labs