From: Oscar Salvador <osalvador@techadventures.net>
To: Pasha Tatashin <Pavel.Tatashin@microsoft.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"mhocko@suse.com" <mhocko@suse.com>,
"vbabka@suse.cz" <vbabka@suse.cz>,
"sfr@canb.auug.org.au" <sfr@canb.auug.org.au>,
"iamjoonsoo.kim@lge.com" <iamjoonsoo.kim@lge.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Oscar Salvador <osalvador@suse.de>
Subject: Re: [PATCH] mm/page_alloc: Clean up check_for_memory
Date: Fri, 31 Aug 2018 14:24:01 +0200 [thread overview]
Message-ID: <20180831122401.GA2123@techadventures.net> (raw)
In-Reply-To: <332d9ea1-cdd0-6bb6-8e83-28af25096637@microsoft.com>
On Thu, Aug 30, 2018 at 01:55:29AM +0000, Pasha Tatashin wrote:
> I would re-write the above function like this:
> static void check_for_memory(pg_data_t *pgdat, int nid)
> {
> enum zone_type zone_type;
>
> for (zone_type = 0; zone_type < ZONE_MOVABLE; zone_type++) {
> if (populated_zone(&pgdat->node_zones[zone_type])) {
> node_set_state(nid, zone_type <= ZONE_NORMAL ?
> N_NORMAL_MEMORY: N_HIGH_MEMORY);
> break;
> }
> }
> }
Hi Pavel,
the above would not work fine.
You set either N_NORMAL_MEMORY or N_HIGH_MEMORY, but a node can have both
types of memory at the same time (on CONFIG_HIGHMEM systems).
N_HIGH_MEMORY stands for regular or high memory
while N_NORMAL_MEMORY stands only for regular memory,
that is why we set it only in case the zone is <= ZONE_NORMAL.
> zone_type <= ZONE_MOVABLE - 1
> is the same as:
> zone_type < ZONE_MOVABLE
This makes sense.
--
Oscar Salvador
SUSE L3
next prev parent reply other threads:[~2018-08-31 12:24 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 21:01 [PATCH] mm/page_alloc: Clean up check_for_memory Oscar Salvador
2018-08-28 21:35 ` Andrew Morton
2018-08-29 20:34 ` Oscar Salvador
2018-08-30 1:55 ` Pasha Tatashin
2018-08-31 12:24 ` Oscar Salvador [this message]
2018-08-31 14:04 ` Pasha Tatashin
2018-08-31 20:45 ` Oscar Salvador
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=20180831122401.GA2123@techadventures.net \
--to=osalvador@techadventures.net \
--cc=Pavel.Tatashin@microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=osalvador@suse.de \
--cc=sfr@canb.auug.org.au \
--cc=vbabka@suse.cz \
/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;
as well as URLs for NNTP newsgroup(s).