Re: [PATCH] mremap: Increase LATENCY_LIMIT of mremap to reduce the number of TLB shootdowns

From: Nadav Amit
Date: Wed Jun 06 2018 - 14:20:15 EST


Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, Jun 06, 2018 at 08:55:15AM -0700, Nadav Amit wrote:
>>> -#define LATENCY_LIMIT (64 * PAGE_SIZE)
>>> +#define LATENCY_LIMIT (PMD_SIZE)
>>>
>>> unsigned long move_page_tables(struct vm_area_struct *vma,
>>> unsigned long old_addr, struct vm_area_struct *new_vma,
>>
>> This LATENCY_LIMIT is only used in move_page_tables() in the following
>> manner:
>>
>> next = (new_addr + PMD_SIZE) & PMD_MASK;
>> if (extent > next - new_addr)
>> extent = next - new_addr;
>> if (extent > LATENCY_LIMIT)
>> extent = LATENCY_LIMIT;
>>
>> If LATENCY_LIMIT is to be changed to PMD_SIZE, then IIUC the last condition
>> is not required, and LATENCY_LIMIT can just be removed (assuming there is no
>> underflow case that hides somewhere).
>
> I see no problem removing it other than we may forget that we ever limited
> PTE lock hold times for any reason. I'm skeptical it will matter unless
> mremap-intensive workloads are a lot more common than I believe.

I have no opinion regarding the behavior change. It is just that code with
no effect is oftentimes confusing. A comment (if needed) can replace the
code, and git history would provide how it was once supported.