Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbdFPIFK (ORCPT ); Fri, 16 Jun 2017 04:05:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:57315 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752747AbdFPIFH (ORCPT ); Fri, 16 Jun 2017 04:05:07 -0400 Date: Fri, 16 Jun 2017 10:05:02 +0200 From: Michal Hocko To: Wei Yang Cc: Andrew Morton , linux-mm@kvack.org, Mel Gorman , Vlastimil Babka , 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 , Dan Williams , Heiko Carstens , Martin Schwidefsky Subject: Re: [PATCH 11/14] mm, memory_hotplug: do not associate hotadded memory to zones until online Message-ID: <20170616080502.GA30580@dhcp22.suse.cz> References: <20170515085827.16474-1-mhocko@kernel.org> <20170515085827.16474-12-mhocko@kernel.org> <20170616042058.GA3976@WeideMacBook-Pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170616042058.GA3976@WeideMacBook-Pro.local> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1099 Lines: 44 [Please try to trim the context you are replying to] On Fri 16-06-17 12:20:58, Wei Yang wrote: > On Mon, May 15, 2017 at 10:58:24AM +0200, Michal Hocko wrote: [...] > > /* > >+ * Return true if [start_pfn, start_pfn + nr_pages) range has a non-empty > >+ * 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 (start_pfn >= zone_end_pfn(zone)) > >+ return false; > >+ > >+ if (zone->zone_start_pfn <= start_pfn) > >+ return true; > >+ if (start_pfn + nr_pages > zone->zone_start_pfn) > >+ return true; > >+ > >+ return false; > >+} > > I think this could be simplified as: > > static inline bool zone_intersects(struct zone *zone, > unsigned long start_pfn, unsigned long nr_pages) > { > if (zone_is_empty(zone)) > return false; > > if (start_pfn >= zone_end_pfn(zone) || > start_pfn + nr_pages <= zone->zone_start_pfn) > return false; > > return true; > } Feel free to send a patch. -- Michal Hocko SUSE Labs