linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linxu Fang <fanglinxu@huawei.com>
To: <osalvador@suse.de>
Cc: <akpm@linux-foundation.org>, <fanglinxu@huawei.com>,
	<linux-mm@kvack.org>, <mhocko@suse.com>,
	<pavel.tatashin@microsoft.com>, <vbabka@suse.cz>
Subject: Re: [PATCH V2] mm: fix node spanned pages when we have a node with only zone_movable
Date: Mon, 8 Apr 2019 12:18:48 +0800	[thread overview]
Message-ID: <1554697128-17696-1-git-send-email-fanglinxu@huawei.com> (raw)
In-Reply-To: <20190405125430.vawudxjcxhbarseg@d104.suse.de>

> Uhmf, I have to confess that this whole thing about kernelcore and movablecore
> makes me head spin.

> I agree that clamping the range to the node's start_pfn/end_pfn is the right
> thing to do.

> On the other hand, I cannot figure out why these two statements from
> zone_spanned_pages_in_node() do not help in setting the right values.

> *zone_end_pfn = min(*zone_end_pfn, node_end_pfn);
> *zone_start_pfn = max(*zone_start_pfn, node_start_pfn);

> If I take one of your examples:

> Node 0:
> node_start_pfn=1        node_end_pfn=2822144
> DMA      zone_low=1        zone_high=4096
> DMA32    zone_low=4096     zone_high=1048576
> Normal   zone_low=1048576  zone_high=7942144
> Movable  zone_low=0        zone_high=0

> *zone_end_pfn should be set to 2822144, and so zone_end_pfn - zone_start_pfn
> should return the right value?
> Or is it because we have the wrong values before calling
> adjust_zone_range_for_zone_movable() and the whole thing gets messed up there?

> Please, note that the patch looks correct to me, I just want to understand
> why those two statements do not help here.


Of course, the following statements have similar functions as clamp

* zone_end_pfn = min (* zone_end_pfn, node_end_pfn);
* zone_start_pfn = max (* zone_start_pfn, node_start_pfn);

> Or is it because we have the wrong values before calling
> adjust_zone_range_for_zone_movable() and the whole thing gets messed up there?

Yes, we have the wrong values before calling adjust_zone_range_for_zone_movable() 
and the whole thing gets messed up there

Let's focus on the process of adjust_zone_range_for_zone_movable, in the last
conditional statement:

/* Check if this whole range is within ZONE_MOVABLE*/
} Other if (* zone_start_pfn >= zone_movable_pfn [nid])
* zone_start_pfn = zone_end_pfn;

For node 1, when zone_type is ZONE_NORMAL, if there is no clamp when entering 
adjustment_zone_range_for_zone_movable, then *zone_start_pfn does not satisfy the 
condition and will not be corrected, this is the root cause of BUG.

This fix only considers the minimum risk changes of this point without affecting
the results of other values, such as spanned pages, present pages and absent pages
of every node.

Perhaps, a series of optimizations can also be made. Thank you for your review.


      reply	other threads:[~2019-04-08  4:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-04  9:38 Linxu Fang
2019-04-04 19:14 ` Andrew Morton
2019-04-08  4:26   ` Linxu Fang
2019-04-05 12:54 ` Oscar Salvador
2019-04-08  4:18   ` Linxu Fang [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=1554697128-17696-1-git-send-email-fanglinxu@huawei.com \
    --to=fanglinxu@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=osalvador@suse.de \
    --cc=pavel.tatashin@microsoft.com \
    --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