Re: [PATCH] mm: always consider THP when adjusting min_free_kbytes

From: Khalid Aziz
Date: Tue Feb 04 2020 - 18:37:59 EST


On Tue, 2020-02-04 at 13:42 -0800, Mike Kravetz wrote:
> On 2/4/20 12:33 PM, David Rientjes wrote:
> >
> > So it looks like this is fixing an obvious correctness issue but
> > also now
> > requires users to rewrite the sysctl if they want to decrease the
> > min
> > watermark.
>
> Moving the call to khugepaged_adjust_min_free_kbytes as described
> above
> would avoid the THP adjustment unless we were going to overwrite the
> user defined value. Now, I am not sure overwriting the user defined
> value
> as is done today is actually the correct thing to do.
>
> Thoughts?
> Perhaps we should never overwrite a user defined value?

We might need to override user defined value if it is too low but
overriding it silently is not quite right. We should print a warning
at least. On the other hand, a user setting min_free_kbytes should know
what they are doing and if they set it too low, they have been warned
in the sysctl documentation. I would say we never override user defined
value but print a warning if the value is too low and kernel would have
adjusted it if it were not for the user defined value.

--
Khalid