From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754311AbbLTJ25 (ORCPT ); Sun, 20 Dec 2015 04:28:57 -0500 Received: from www.linutronix.de ([62.245.132.108]:44951 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754215AbbLTJ2z (ORCPT ); Sun, 20 Dec 2015 04:28:55 -0500 Date: Sun, 20 Dec 2015 10:27:51 +0100 (CET) From: Thomas Gleixner To: Toshi Kani cc: mingo@redhat.com, hpa@zytor.com, bp@alien8.de, stsp@list.ru, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Borislav Petkov Subject: Re: [PATCH 2/2] x86/mm/pat: Change free_memtype() to free shrinking range In-Reply-To: <1449678368-31793-3-git-send-email-toshi.kani@hpe.com> Message-ID: References: <1449678368-31793-1-git-send-email-toshi.kani@hpe.com> <1449678368-31793-3-git-send-email-toshi.kani@hpe.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Toshi, On Wed, 9 Dec 2015, Toshi Kani wrote: > diff --git a/arch/x86/mm/pat_rbtree.c b/arch/x86/mm/pat_rbtree.c > index 6393108..d6faef8 100644 > --- a/arch/x86/mm/pat_rbtree.c > +++ b/arch/x86/mm/pat_rbtree.c > @@ -107,7 +112,12 @@ static struct memtype *memtype_rb_exact_match(struct rb_root *root, > while (match != NULL && match->start < end) { > struct rb_node *node; > > - if (match->start == start && match->end == end) > + if ((match_type == MEMTYPE_EXACT_MATCH) && > + (match->start == start) && (match->end == end)) > + return match; > + > + if ((match_type == MEMTYPE_SHRINK_MATCH) && > + (match->start < start) && (match->end == end)) Confused. If we shrink a mapping then I'd expect that the start of the mapping stays the same and the end changes. I certainly miss something here, but if the above is correct, then it definitely needs a big fat comment explaining it. Thanks, tglx