[PATCH 0/2] mm: reduce /proc/pagetypeinfo ovehead

From: Michal Hocko
Date: Fri Oct 25 2019 - 03:26:30 EST

Waiman Long has reported [1] that reading /proc/pagetypeinfo can
severely interfere with the system and it might lead even to hard lockup
detector firing up on a very large machines. Nevertheless small machines
are not completely fine either because the operation requires to take
the zone->lock IRQ safe spinlock and thus to interfere with both the IRQ
delivery and the page allocator. The file is world readable which makes
this kinda bad.

The immediate danger is addressed by making the file root readable only.
This is a debugging aid so general audience shouldn't require it for a
general operation. This is done in the first patch.

The potentially excessive time spent for free_list iteration is handled
by capping the iteration loop. This should be fine for existing usecases
because low numbers are usually of the primary interest. This is
implemented in patch 2.

I am reposting these two patches with dropped RFC (previously posted
[2]) and asking for inclusion. I have also dropped Mel's Ack from the
second patch because there were quite some changes since he reviewed.

[1] http://lkml.kernel.org/r/20191022162156.17316-1-longman@xxxxxxxxxx
[2] http://lkml.kernel.org/r/20191023102737.32274-1-mhocko@xxxxxxxxxx