From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932965Ab3AIV4z (ORCPT ); Wed, 9 Jan 2013 16:56:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:27295 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932934Ab3AIV41 (ORCPT ); Wed, 9 Jan 2013 16:56:27 -0500 Message-ID: <50EDE403.4070208@redhat.com> Date: Wed, 09 Jan 2013 16:41:23 -0500 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Michel Lespinasse CC: Benjamin Herrenschmidt , "James E.J. Bottomley" , Matt Turner , David Howells , Tony Luck , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-parisc@vger.kernel.org, linux-alpha@vger.kernel.org, linux-ia64@vger.kernel.org Subject: Re: [PATCH 7/8] mm: use vm_unmapped_area() on powerpc architecture References: <1357694895-520-1-git-send-email-walken@google.com> <1357694895-520-8-git-send-email-walken@google.com> <1357697739.4838.30.camel@pasglop> <1357702376.4838.32.camel@pasglop> <20130109112313.GA4905@google.com> In-Reply-To: <20130109112313.GA4905@google.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/09/2013 06:23 AM, Michel Lespinasse wrote: > On Wed, Jan 09, 2013 at 02:32:56PM +1100, Benjamin Herrenschmidt wrote: >> Ok. I think at least you can move that construct: >> >> + if (addr < SLICE_LOW_TOP) { >> + slice = GET_LOW_SLICE_INDEX(addr); >> + addr = (slice + 1) << SLICE_LOW_SHIFT; >> + if (!(available.low_slices & (1u << slice))) >> + continue; >> + } else { >> + slice = GET_HIGH_SLICE_INDEX(addr); >> + addr = (slice + 1) << SLICE_HIGH_SHIFT; >> + if (!(available.high_slices & (1u << slice))) >> + continue; >> + } >> >> Into some kind of helper. It will probably compile to the same thing but >> at least it's more readable and it will avoid a fuckup in the future if >> somebody changes the algorithm and forgets to update one of the >> copies :-) > > All right, does the following look more palatable then ? > (didn't re-test it, though) Looks equivalent. I have also not tested :) > Signed-off-by: Michel Lespinasse Acked-by: Rik van Riel