[lkml]   [2017]   [Jun]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] mm, memory_hotplug: support movable_node for hotplugable nodes
On Thu 15-06-17 11:29:27, Wei Yang wrote:
> >+static inline bool movable_pfn_range(int nid, struct zone *default_zone,
> >+ unsigned long start_pfn, unsigned long nr_pages)
> >+{
> >+ if (!allow_online_pfn_range(nid, start_pfn, nr_pages,
> >+ return true;
> >+
> >+ if (!movable_node_is_enabled())
> >+ return false;
> >+
> >+ return !zone_intersects(default_zone, start_pfn, nr_pages);
> >+}
> >+
> To be honest, I don't understand this clearly.
> move_pfn_range() will choose and move the range to a zone based on the
> online_type, where we have two cases:
> 1. ONLINE_MOVABLE -> ZONE_MOVABLE will be chosen
> 2. ONLINE_KEEP -> ZONE_NORMAL is the default while ZONE_MOVABLE will be
> chosen in case movable_pfn_range() returns true.
> There are three conditions in movable_pfn_range():
> 1. Not allowed in kernel_zone, returns true
> 2. Movable_node not enabled, return false
> 3. Range [start_pfn, start_pfn + nr_pages) doesn't intersect with
> default_zone, return true
> The first one is inherited from original code, so lets look at the other two.
> Number 3 is easy to understand, if the hot-added range is already part of
> ZONE_NORMAL, use it.
> Number 2 makes me confused. If movable_node is not enabled, ZONE_NORMAL will
> be chosen. If movable_node is enabled, it still depends on other two
> condition. So how a memory_block is onlined to ZONE_MOVABLE because
> movable_node is enabled?

This is simple. If the movable_node is set then ONLINE_KEEP defaults to
the movable zone unless the range is already covered by a kernel zone
(read Normal zone most of the time).

> What I see is you would forbid a memory_block to be
> onlined to ZONE_MOVABLE when movable_node is not enabled.

Please note that this is ONLINE_KEEP not ONLINE_MOVABLE and as such the
movable zone is used only if we are withing the movable zone range
already (test 1).

> Instead of you would
> online a memory_block to ZONE_MOVABLE when movable_node is enabled, which is
> implied in your change log.
> BTW, would you mind giving me these two information?
> 1. Which branch your code is based on? I have cloned your
> git(//, while still see
> some difference.

yes this is based on the mmotm tree (use since-4.11 or auto-latest

> 2. Any example or test case I could try your patch and see the difference? It
> would be better if it could run in qemu+kvm.

Michal Hocko

 \ /
  Last update: 2017-06-15 10:25    [W:0.194 / U:1.180 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site