From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034065AbdEYFjj (ORCPT ); Thu, 25 May 2017 01:39:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:48864 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030766AbdEYFji (ORCPT ); Thu, 25 May 2017 01:39:38 -0400 Date: Thu, 25 May 2017 07:39:35 +0200 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/vmalloc: a slight change of compare target in __insert_vmap_area() Message-ID: <20170525053935.GA12721@dhcp22.suse.cz> References: <20170524100347.8131-1-richard.weiyang@gmail.com> <20170524121135.GF14733@dhcp22.suse.cz> <20170524150730.GA8445@WeideMacBook-Pro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170524150730.GA8445@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 On Wed 24-05-17 23:07:30, Wei Yang wrote: > On Wed, May 24, 2017 at 02:11:35PM +0200, Michal Hocko wrote: > >On Wed 24-05-17 18:03:47, Wei Yang wrote: > >> The vmap RB tree store the elements in order and no overlap between any of > >> them. The comparison in __insert_vmap_area() is to decide which direction > >> the search should follow and make sure the new vmap_area is not overlap > >> with any other. > >> > >> Current implementation fails to do the overlap check. > >> > >> When first "if" is not true, it means > >> > >> va->va_start >= tmp_va->va_end > >> > >> And with the truth > >> > >> xxx->va_end > xxx->va_start > >> > >> The deduction is > >> > >> va->va_end > tmp_va->va_start > >> > >> which is the condition in second "if". > >> > >> This patch changes a little of the comparison in __insert_vmap_area() to > >> make sure it forbids the overlapped vmap_area. > > > >Why do we care about overlapping vmap areas at this level. This is an > >internal function and all the sanity checks should have been done by > >that time AFAIR. Could you describe the problem which you are trying to > >fix/address? > > > > No problem it tries to fix. I would prefer the not touch the code if there is no problem to fix. -- Michal Hocko SUSE Labs