linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* Re: + mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch added to -mm tree
       [not found] ` <20150915145232.fb74148815fa79bfeaad88bc@linux-foundation.org>
@ 2015-09-15 23:06   ` Dave Hansen
  0 siblings, 0 replies; only message in thread
From: Dave Hansen @ 2015-09-15 23:06 UTC (permalink / raw)
  To: Andrew Morton, liuchangcheng, fandd, guz.fnst, hutao,
	isimatu.yasuaki, laijs, qiuxishi, tangchen, toshi.kani, wangnan0,
	yanxiaofeng, yinghai, zhangyanfei, Linux-MM

On 09/15/2015 02:52 PM, Andrew Morton wrote:
>>  /*
>>   * If movable zone has already been setup, newly added memory should be check.
>>   * If its address is higher than movable zone, it should be added as movable.
>> + * And if system boots up with movable_node and config CONFIG_MOVABLE_NOD and
>> + * added memory does not overlap the zone before MOVABLE_ZONE,
>> + * the memory is added as movable
>>   * Without this check, movable zone may overlap with other zone.
>>   */
>>  static int should_add_memory_movable(int nid, u64 start, u64 size)
>> @@ -1208,6 +1211,11 @@ static int should_add_memory_movable(int
>>  	unsigned long start_pfn = start >> PAGE_SHIFT;
>>  	pg_data_t *pgdat = NODE_DATA(nid);
>>  	struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE;
>> +	struct zone *pre_zone = pgdat->node_zones + (ZONE_MOVABLE - 1);
>> +
>> +	if (movable_node_is_enabled()
>> +	&& zone_end_pfn(pre_zone) <= start_pfn)
>> +		return 1;

This check seems goofy to me.  According to the description, we're
looking at a node here which has all of its zones empty.  So it
definitely has zone->spanned_pages=0.  zone_end_pfn() is looking at
zone->zone_start_pfn too, which is also 0, presumably.

So why is it bothering to look at the pfns if they're potentially
"garbage"?  It seems like we really want something like this:

	if (all_node_zones_empty(pgdat)) {
		/*
		 * We usually want a ZONE_NORMAL before we add a
		 * ZONE_MOVABLE since ZONE_MOVABLE is mildly crippled.
		 * We only want ZONE_MOVABLE first when 'movable_node'
		 * mode is on.
		 */
		return movable_node_is_enabled();
	}

Either way, this is a behavior change.  It's one that is triggered by a
config option plus a boot option, but it might surprise some users.  Is
this new behavior documented?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-15 23:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <55f89282.Ea4OBESeo1emyCz7%akpm@linux-foundation.org>
     [not found] ` <20150915145232.fb74148815fa79bfeaad88bc@linux-foundation.org>
2015-09-15 23:06   ` + mm-memory-hot-add-memory-can-not-be-added-to-movable-zone-defaultly.patch added to -mm tree Dave Hansen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox