Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Wed, 12 Dec 2001 11:04:48 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Wed, 12 Dec 2001 11:04:39 -0500 Received: from smtpzilla2.xs4all.nl ([194.109.127.138]:23569 "EHLO smtpzilla2.xs4all.nl") by vger.kernel.org with ESMTP id ; Wed, 12 Dec 2001 11:04:26 -0500 Date: Wed, 12 Dec 2001 17:04:22 +0100 (CET) From: Roman Zippel X-X-Sender: To: Benjamin LaHaise cc: Steven Walter , Subject: Re: [PATCH] v2.5.1-pre9-00_kvec.diff In-Reply-To: <20011211223711.C17550@redhat.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Tue, 11 Dec 2001, Benjamin LaHaise wrote: > On Tue, Dec 11, 2001 at 09:35:15PM -0600, Steven Walter wrote: > > > + nr_pages = (ptr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; > > > + nr_pages -= ptr >> PAGE_SHIFT; > > > > Isn't this the same as > > nr_pages = (len + PAGE_SIZE -1) >> PAGE_SHIFT; > > No. But this is: nr_pages = ((ptr & ~PAGE_MASK) + len + PAGE_SIZE - 1) >> PAGE_SHIFT; and this even slightly better (at least on ia32): mask = PAGE_SIZE - 1; nr_pages = ((ptr & mask) + len + mask) >> PAGE_SHIFT; bye, Roman - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/