Re: [v3 PATCH] mm: ksm: do not block on page lock when searching stable tree

From: John Hubbard
Date: Wed Jan 30 2019 - 13:14:31 EST


On 1/30/19 9:47 AM, Yang Shi wrote:
[...]
>>> @@ -1673,7 +1688,12 @@ static struct page *stable_tree_search(struct page *page)
>>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * It would be more elegant to return stable_node
>>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ * than kpage, but that involves more changes.
>>> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ */
>>> -ÂÂÂÂÂÂÂÂÂÂÂ tree_page = get_ksm_page(stable_node_dup, true);
>>> +ÂÂÂÂÂÂÂÂÂÂÂ tree_page = get_ksm_page(stable_node_dup,
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ GET_KSM_PAGE_TRYLOCK);
>>> +
>>> +ÂÂÂÂÂÂÂÂÂÂÂ if (PTR_ERR(tree_page) == -EBUSY)
>>> +ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ return ERR_PTR(-EBUSY);
>>
>> or just:
>>
>> ÂÂÂÂif (PTR_ERR(tree_page) == -EBUSY)
>> ÂÂÂÂÂÂÂ return tree_page;
>>
>> right?
>
> Either looks fine to me. Returning errno may look more explicit? Anyway I really don't have preference.

Yes, either one is fine. I like to see less code on the screen, all else being equal,
but it's an extremely minor point, and sometimes being explicit instead is better anyway.



thanks,
--
John Hubbard
NVIDIA