linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc: make the annotations of available memory more accurate
@ 2022-06-22  6:47 cgel.zte
  2022-06-22 18:43 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-06-22  6:47 UTC (permalink / raw)
  To: akpm, willy; +Cc: linux-mm, linux-kernel, Yang Yang

From: Yang Yang <yang.yang29@zte.com.cn>

Not all the systems use swap, so estimating available memory would
help to prevent swapping or OOM of system that not use swap.

And we need to reserve some page cache to prevent swapping or
thrashing. If somebody is accessing the pages in pagecache,
and if too much would be freed, most accesses might mean
reading data from disk, i.e. thrashing.

Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
---
 mm/page_alloc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e538dde2c1c0..233f68d31cdd 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5889,14 +5889,14 @@ long si_mem_available(void)
 
 	/*
 	 * Estimate the amount of memory available for userspace allocations,
-	 * without causing swapping.
+	 * without causing swapping or OOM.
 	 */
 	available = global_zone_page_state(NR_FREE_PAGES) - totalreserve_pages;
 
 	/*
 	 * Not all the page cache can be freed, otherwise the system will
-	 * start swapping. Assume at least half of the page cache, or the
-	 * low watermark worth of cache, needs to stay.
+	 * start swapping or thrashing. Assume at least half of the page
+	 * cache, or the low watermark worth of cache, needs to stay.
 	 */
 	pagecache = pages[LRU_ACTIVE_FILE] + pages[LRU_INACTIVE_FILE];
 	pagecache -= min(pagecache / 2, wmark_low);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm/page_alloc: make the annotations of available memory more accurate
  2022-06-22  6:47 [PATCH] mm/page_alloc: make the annotations of available memory more accurate cgel.zte
@ 2022-06-22 18:43 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2022-06-22 18:43 UTC (permalink / raw)
  To: cgel.zte; +Cc: willy, linux-mm, linux-kernel, Yang Yang

On Wed, 22 Jun 2022 06:47:13 +0000 cgel.zte@gmail.com wrote:

> From: Yang Yang <yang.yang29@zte.com.cn>
> 
> Not all the systems use swap, so estimating available memory would
> help to prevent swapping or OOM of system that not use swap.
> 
> And we need to reserve some page cache to prevent swapping or
> thrashing. If somebody is accessing the pages in pagecache,
> and if too much would be freed, most accesses might mean
> reading data from disk, i.e. thrashing.
> 
> Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>

This should include your signoff, as described in
Documentation/process/submitting-patches.rst.

And we'd like a full name for that signoff please, not simply a bare
email address.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-22 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22  6:47 [PATCH] mm/page_alloc: make the annotations of available memory more accurate cgel.zte
2022-06-22 18:43 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).