Re: [PATCH v3 6/9] mm, memory_hotplug: do not associate hotadded memory to zones until online

From: Vlastimil Babka
Date: Thu Apr 20 2017 - 06:51:51 EST


On 04/20/2017 11:06 AM, Michal Hocko wrote:
> On Thu 20-04-17 10:25:27, Vlastimil Babka wrote:
>>> + * intersection with the given zone
>>> + */
>>> +static inline bool zone_intersects(struct zone *zone,
>>> + unsigned long start_pfn, unsigned long nr_pages)
>>> +{
>>
>> I'm looking at your current mmotm tree branch, which looks like this:
>>
>> + * Return true if [start_pfn, start_pfn + nr_pages) range has a non-mpty
>> + * intersection with the given zone
>> + */
>> +static inline bool zone_intersects(struct zone *zone,
>> + unsigned long start_pfn, unsigned long nr_pages)
>> +{
>> + if (zone_is_empty(zone))
>> + return false;
>> + if (zone->zone_start_pfn <= start_pfn && start_pfn < zone_end_pfn(zone))
>> + return true;
>> + if (start_pfn + nr_pages > zone->zone_start_pfn)
>> + return true;
>>
>> A false positive is possible here, when start_pfn >= zone_end_pfn(zone)?
>
> Ohh, right. Looks better?

Yeah.

You can add for the whole patch

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

But I can't guarantee some corner case won't surface. The hotplug code
is far from straightforward :(