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.
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?
Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/