Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755535AbXISHYm (ORCPT ); Wed, 19 Sep 2007 03:24:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752874AbXISHYe (ORCPT ); Wed, 19 Sep 2007 03:24:34 -0400 Received: from ppsw-4.csi.cam.ac.uk ([131.111.8.134]:43931 "EHLO ppsw-4.csi.cam.ac.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752426AbXISHYd (ORCPT ); Wed, 19 Sep 2007 03:24:33 -0400 X-Cam-SpamDetails: Not scanned X-Cam-AntiVirus: No virus found X-Cam-ScannerInfo: http://www.cam.ac.uk/cs/email/scanner/ In-Reply-To: References: <20070919033605.785839297@sgi.com> <20070919033641.009931707@sgi.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Cc: Christoph Lameter , Christoph Hellwig , Mel Gorman , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, David Chinner , Jens Axboe Content-Transfer-Encoding: 7bit From: Anton Altaparmakov Subject: Re: [03/17] is_vmalloc_addr(): Check if an address is within the vmalloc boundaries Date: Wed, 19 Sep 2007 08:24:24 +0100 To: David Rientjes X-Mailer: Apple Mail (2.752.3) Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1870 Lines: 48 On 19 Sep 2007, at 07:32, David Rientjes wrote: > On Tue, 18 Sep 2007, Christoph Lameter wrote: >> Index: linux-2.6/include/linux/mm.h >> =================================================================== >> --- linux-2.6.orig/include/linux/mm.h 2007-09-17 >> 21:46:06.000000000 -0700 >> +++ linux-2.6/include/linux/mm.h 2007-09-17 23:56:54.000000000 -0700 >> @@ -1158,6 +1158,14 @@ static inline unsigned long vma_pages(st >> return (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; >> } >> >> +/* Determine if an address is within the vmalloc range */ >> +static inline int is_vmalloc_addr(const void *x) >> +{ >> + unsigned long addr = (unsigned long)x; >> + >> + return addr >= VMALLOC_START && addr < VMALLOC_END; >> +} > > This breaks on i386 because VMALLOC_END is defined in terms of > PKMAP_BASE > in the CONFIG_HIGHMEM case. That is incorrect. This works perfectly on i386 and on ALL architectures supported by Linux. A lot of places in the kernel already do this today (mostly hand coded though, eg XFS and NTFS)... There even is such a function already in mm/ sparse.c::vaddr_in_vmalloc_area() with pretty identical content. I would suggest either this new inline should go away completely and use the existing one and export it or the existing one should go away and the inline should be used. It seems silly to have two functions with different names doing exactly the same thing! Best regards, Anton -- Anton Altaparmakov (replace at with @) Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK Linux NTFS maintainer, http://www.linux-ntfs.org/ - 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/