From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755409AbbCMNyF (ORCPT ); Fri, 13 Mar 2015 09:54:05 -0400 Received: from g9t5009.houston.hp.com ([15.240.92.67]:36689 "EHLO g9t5009.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751209AbbCMNyB (ORCPT ); Fri, 13 Mar 2015 09:54:01 -0400 Message-ID: <1426254791.17007.451.camel@misato.fc.hp.com> Subject: Re: [PATCH v2 3/4] mtrr, x86: Clean up mtrr_type_lookup() From: Toshi Kani To: Ingo Molnar Cc: "akpm@linux-foundation.org" , "hpa@zytor.com" , "tglx@linutronix.de" , "mingo@redhat.com" , "linux-mm@kvack.org" , "x86@kernel.org" , "linux-kernel@vger.kernel.org" , "dave.hansen@intel.com" , "Elliott, Robert (Server Storage)" , "pebolle@tiscali.nl" Date: Fri, 13 Mar 2015 07:53:11 -0600 In-Reply-To: <20150313123722.GA4152@gmail.com> References: <1426180690-24234-1-git-send-email-toshi.kani@hp.com> <1426180690-24234-4-git-send-email-toshi.kani@hp.com> <20150313123722.GA4152@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-03-13 at 12:37 +0000, Ingo Molnar wrote: > * Toshi Kani wrote: : > > + /* Look in fixed ranges. Just return the type as per start */ > > + if (mtrr_state.have_fixed && (start < 0x100000)) { > > + int idx; > > + > > + if (start < 0x80000) { > > + idx = 0; > > + idx += (start >> 16); > > + return mtrr_state.fixed_ranges[idx]; > > + } else if (start < 0xC0000) { > > + idx = 1 * 8; > > + idx += ((start - 0x80000) >> 14); > > + return mtrr_state.fixed_ranges[idx]; > > + } else { > > + idx = 3 * 8; > > + idx += ((start - 0xC0000) >> 12); > > + return mtrr_state.fixed_ranges[idx]; > > + } > > + } > > So why not put this into a separate helper function - named > mtrr_type_lookup_fixed()? It has little relation to variable ranges. Sounds good. I will update as suggested. > > + > > + /* > > + * Look in variable ranges > > + * Look of multiple ranges matching this address and pick type > > + * as per MTRR precedence > > + */ > > + if (!(mtrr_state.enabled & 2)) > > + return mtrr_state.def_type; > > + > > type = __mtrr_type_lookup(start, end, &partial_end, &repeat); > > And this then should be named mtrr_type_lookup_variable() or so? Will do as well. I will send out a new version today since I won't be able to update the patchset next week. Thanks, -Toshi