[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

Reply via email to