Re: [RFC] mm: show message when updating min_free_kbytes in thp

Andrew Morton
2014-01-15T00:35:36Z

On Tue, 14 Jan 2014 16:25:10 -0800 (PST) David Rientjes <rientjes@google.com> wrote:

> On Tue, 14 Jan 2014, Andrew Morton wrote:
>
> > This is all a bit nasty, isn't it? THP goes and alters min_free_kbytes
> > to improve its own reliability, but min_free_kbytes is also
> > user-modifiable. And over many years we have trained a *lot* of users
> > to alter min_free_kbytes. Often to prevent nasty page allocation
> > failure warnings from net drivers.
> >
>
> I can vouch for kernel logs that are spammed with tons of net page
> allocation failure warnings, in fact we're going through and adding
> __GFP_NOWARN to most of these.
>
> > So there are probably quite a lot of people out there who are manually
> > rubbing out THP's efforts. And there may also be people who are
> > setting min_free_kbytes to a value which is unnecessarily high for more
> > recent kernels.
> >
>
> Indeed, we have initscripts that modified min_free_kbytes before thp was
> introduced but luckily they were comparing their newly computed value to
> the existing value and only writing if the new value is greater.
> Hopefully most users are doing the same thing.

I've been waiting 10+ years for us to decide to delete that warning due
to the false positives. Hasn't happened yet, and the warning does
find bugs/issues/misconfigurations/etc.

But I do worry this has led to users unnecessarily increasing
min_free_kbytes just to shut the warnings up. Net result: they have
less memory available for cache, etc.

> Would it be overkill to save the kernel default both with and without thp
> and then doing a WARN_ON_ONCE() if a user-written value is ever less?

Well, min_free_kbytes is a userspace thing, not a kernel thing - maybe
THP shouldn't be dinking with it. What effect is THP trying to achieve
and can we achieve it by other/better means?