Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964878AbdDTKvs (ORCPT ); Thu, 20 Apr 2017 06:51:48 -0400 Received: from mx2.suse.de ([195.135.220.15]:38629 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S941628AbdDTKvq (ORCPT ); Thu, 20 Apr 2017 06:51:46 -0400 Subject: Re: [PATCH v3 6/9] mm, memory_hotplug: do not associate hotadded memory to zones until online To: Michal Hocko , Dan Williams References: <20170410110351.12215-1-mhocko@kernel.org> <20170410110351.12215-7-mhocko@kernel.org> <20170410162547.GM4618@dhcp22.suse.cz> <49b6c3e2-0e68-b77e-31d6-f589d3b4822e@suse.cz> <20170420090605.GD15781@dhcp22.suse.cz> Cc: linux-mm@kvack.org, Andrew Morton , Mel Gorman , Andrea Arcangeli , Jerome Glisse , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Kani Toshimitsu , slaoub@gmail.com, Joonsoo Kim , Andi Kleen , David Rientjes , Daniel Kiper , Igor Mammedov , Vitaly Kuznetsov , LKML , Heiko Carstens , Lai Jiangshan , Martin Schwidefsky From: Vlastimil Babka Message-ID: <54f98d7c-2a7a-b81a-0e8b-85a4b55ebe9b@suse.cz> Date: Thu, 20 Apr 2017 12:51:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170420090605.GD15781@dhcp22.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1178 Lines: 36 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 But I can't guarantee some corner case won't surface. The hotplug code is far from straightforward :(