All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] proc: meminfo: estimate available memory more conservatively
Date: Thu, 3 Dec 2015 17:46:09 +0100	[thread overview]
Message-ID: <20151203164609.GC9271@dhcp22.suse.cz> (raw)
In-Reply-To: <1448913622-24198-2-git-send-email-hannes@cmpxchg.org>

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, 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>

WARNING: multiple messages have this Message-ID (diff)
From: Michal Hocko <mhocko@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] proc: meminfo: estimate available memory more conservatively
Date: Thu, 3 Dec 2015 17:46:09 +0100	[thread overview]
Message-ID: <20151203164609.GC9271@dhcp22.suse.cz> (raw)
In-Reply-To: <1448913622-24198-2-git-send-email-hannes@cmpxchg.org>

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

  reply	other threads:[~2015-12-03 16:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-30 20:00 [PATCH 1/2] mm: page_alloc: generalize the dirty balance reserve Johannes Weiner
2015-11-30 20:00 ` Johannes Weiner
2015-11-30 20:00 ` [PATCH 2/2] proc: meminfo: estimate available memory more conservatively Johannes Weiner
2015-11-30 20:00   ` Johannes Weiner
2015-12-03 16:46   ` Michal Hocko [this message]
2015-12-03 16:46     ` Michal Hocko
2015-12-03 16:39 ` [PATCH 1/2] mm: page_alloc: generalize the dirty balance reserve Michal Hocko
2015-12-03 16:39   ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20151203164609.GC9271@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.