Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1280241 > unrolled thread

[PATCH 2/2] proc: meminfo: estimate available memory more conservatively

Started byJohannes Weiner <hannes@cmpxchg.org>
First post2015-11-30 21:10 +0100
Last post2015-12-03 17:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 2/2] proc: meminfo: estimate available memory more conservatively Johannes Weiner <hannes@cmpxchg.org> - 2015-11-30 21:10 +0100
    Re: [PATCH 2/2] proc: meminfo: estimate available memory more  conservatively Michal Hocko <mhocko@kernel.org> - 2015-12-03 17:50 +0100

#1280241 — [PATCH 2/2] proc: meminfo: estimate available memory more conservatively

FromJohannes Weiner <hannes@cmpxchg.org>
Date2015-11-30 21:10 +0100
Subject[PATCH 2/2] proc: meminfo: estimate available memory more conservatively
Message-ID<qACVP-8dD-5@gated-at.bofh.it>
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>
---
 fs/proc/meminfo.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
index 9155a5a..df4661a 100644
--- a/fs/proc/meminfo.c
+++ b/fs/proc/meminfo.c
@@ -57,11 +57,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
 	/*
 	 * Estimate the amount of memory available for userspace allocations,
 	 * without causing swapping.
-	 *
-	 * Free memory cannot be taken below the low watermark, before the
-	 * system starts swapping.
 	 */
-	available = i.freeram - wmark_low;
+	available = i.freeram - totalreserve_pages;
 
 	/*
 	 * Not all the page cache can be freed, otherwise the system will
-- 
2.6.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1283187 — Re: [PATCH 2/2] proc: meminfo: estimate available memory more conservatively

FromMichal Hocko <mhocko@kernel.org>
Date2015-12-03 17:50 +0100
SubjectRe: [PATCH 2/2] proc: meminfo: estimate available memory more conservatively
Message-ID<qBFeX-7CN-33@gated-at.bofh.it>
In reply to#1280241
On Mon 30-11-15 15:00:22, Johannes Weiner wrote:
> 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.

I am not sure this will make a big or even noticeable difference in the
real life but it makes sense.

> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  fs/proc/meminfo.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/proc/meminfo.c b/fs/proc/meminfo.c
> index 9155a5a..df4661a 100644
> --- a/fs/proc/meminfo.c
> +++ b/fs/proc/meminfo.c
> @@ -57,11 +57,8 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
>  	/*
>  	 * Estimate the amount of memory available for userspace allocations,
>  	 * without causing swapping.
> -	 *
> -	 * Free memory cannot be taken below the low watermark, before the
> -	 * system starts swapping.
>  	 */
> -	available = i.freeram - wmark_low;
> +	available = i.freeram - totalreserve_pages;
>  
>  	/*
>  	 * Not all the page cache can be freed, otherwise the system will
> -- 
> 2.6.2
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web