linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Wei Yang <richard.weiyang@gmail.com>
To: akpm@linux-foundation.org, mhocko@suse.com
Cc: linux-mm@kvack.org, Wei Yang <richard.weiyang@gmail.com>
Subject: [PATCH] mm, page_alloc: skip to set lowmem_reserve[] for empty zones
Date: Tue, 13 Nov 2018 11:11:15 +0800	[thread overview]
Message-ID: <20181113031115.18050-1-richard.weiyang@gmail.com> (raw)
In-Reply-To: <20181112071404.13620-1-richard.weiyang@gmail.com>

lowmem_reserve[] is used to make sure to keep some memory when
allocating memory for a higher zone. In case one zone is empty, no
managed_pages, this zone will never picked up by page allocator. Which
means its lowmem_reserve[] is never used.

Also, since its managed_pages is 0, it will not contribute to lower
zone's lowmem_reserve[] in case there is non empty lower zone.

This patch skip the zones to save some cycles.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 mm/page_alloc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index a919ba5cb3c8..495feff1e5e4 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7291,6 +7291,9 @@ static void setup_per_zone_lowmem_reserve(void)
 				idx--;
 				lower_zone = pgdat->node_zones + idx;
 
+				if (!lower_zone->managed_pages)
+					continue;
+
 				if (sysctl_lowmem_reserve_ratio[idx] < 1) {
 					sysctl_lowmem_reserve_ratio[idx] = 0;
 					lower_zone->lowmem_reserve[j] = 0;
-- 
2.15.1

      parent reply	other threads:[~2018-11-13  3:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-12  7:14 [PATCH] mm, page_alloc: skip zone who has no managed_pages in calculate_totalreserve_pages() Wei Yang
2018-11-12  8:09 ` Michal Hocko
2018-11-12 14:26   ` Wei Yang
2018-11-12 14:40     ` Michal Hocko
2018-11-13  1:39       ` Wei Yang
2018-11-13  8:08         ` Michal Hocko
2018-11-13  8:16           ` Wei Yang
2018-11-13  9:07             ` Michal Hocko
2018-11-13  9:14               ` Wei Yang
2018-11-14  7:43               ` Wei Yang
2018-11-14  7:48                 ` Michal Hocko
2018-11-14  8:20                   ` Wei Yang
2018-11-14  8:54                     ` Michal Hocko
2018-11-13  3:11 ` Wei Yang [this message]

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=20181113031115.18050-1-richard.weiyang@gmail.com \
    --to=richard.weiyang@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox