]> www.infradead.org Git - users/dwmw2/linux.git/commit
proc: meminfo: estimate available memory more conservatively
authorJohannes Weiner <hannes@cmpxchg.org>
Thu, 14 Jan 2016 23:20:18 +0000 (15:20 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Tue, 13 Aug 2019 11:39:27 +0000 (12:39 +0100)
commitb6c00d28303041dd969a2ec1b75c5b28646ca8eb
treecfde1310383b6c20db6dc0771bd26df7a716e0cd
parent05429983fa0fa3bfa1b8436beb63913d9d4aad1a
proc: meminfo: estimate available memory more conservatively

commit 84ad5802a33a4964a49b8f7d24d80a214a096b19 upstream.

The MemAvailable item in /proc/meminfo is to give users a hint of how
much memory is allocatable without causing swapping, so it excludes the
zones' low watermarks as unavailable to userspace.

However, for a userspace allocation, kswapd will actually reclaim until
the free pages hit a combination of the high watermark and the page
allocator's lowmem protection that keeps a certain amount of DMA and
DMA32 memory from userspace as well.

Subtract the full amount we know to be unavailable to userspace from the
number of free pages when calculating MemAvailable.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Acked-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/proc/meminfo.c