Re: [PATCH -mm -v4 03/21] mm, THP, swap: Support PMD swap mapping in swap_duplicate()

From: Dave Hansen
Date: Tue Jul 10 2018 - 09:51:08 EST


> Yes. Boolean parameter isn't good at most times. Matthew Wilcox
> suggested to use
>
> swap_duplicate(&entry, HPAGE_PMD_NR);
>
> vs.
>
> swap_duplicate(&entry, 1);
>
> He thinks this makes the interface more flexible to support other swap
> entry size in the future. What do you think about that?

That looks great to me too.

>>> if (likely(!non_swap_entry(entry))) {
>>> - if (swap_duplicate(entry) < 0)
>>> + if (swap_duplicate(&entry, false) < 0)
>>> return entry.val;
>>>
>>> /* make sure dst_mm is on swapoff's mmlist. */
>>
>> I'll also point out that in a multi-hundred-line patch, adding arguments
>> to a existing function would not be something I'd try to include in the
>> patch. I'd break it out separately unless absolutely necessary.
>
> You mean add another patch, which only adds arguments to the function,
> but not change the body of the function?

Yes. Or, just add the non-THP-swap version first.