Hi Sasha, On Tue, Dec 17, 2013 at 10:32:53PM -0500, Sasha Levin wrote: >On 12/17/2013 10:23 PM, Wanpeng Li wrote: >>- mlock_vma_page(page); /* no-op if already mlocked */ >>- if (page == check_page) >>+ if (page != check_page && trylock_page(page)) { >>+ mlock_vma_page(page); /* no-op if already mlocked */ >>+ unlock_page(page); >>+ } else if (page == check_page) { >>+ mlock_vma_page(page); /* no-op if already mlocked */ >> ret = SWAP_MLOCK; >>+ } > >Previously, if page != check_page and the page was locked, we'd call mlock_vma_page() >anyways. With this change, we don't. In fact, we'll just skip that entire block not doing >anything. Thanks for pointing out. ;-) > >If that's something that's never supposed to happen, can we add a > > VM_BUG_ON(page != check_page && PageLocked(page)) > >Just to cover this new code path? > How about this one?