From patchwork Sat Oct 16 04:33:31 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Young X-Patchwork-Id: 258421 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9G4XoVa024581 for ; Sat, 16 Oct 2010 04:33:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751192Ab0JPEdV (ORCPT ); Sat, 16 Oct 2010 00:33:21 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:57080 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751177Ab0JPEdV (ORCPT ); Sat, 16 Oct 2010 00:33:21 -0400 Received: by pzk33 with SMTP id 33so216603pzk.19 for ; Fri, 15 Oct 2010 21:33:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=b9Ux6Vs5RksX/mfJab9vlKtZUSf4zZjrePMjb2x1eQU=; b=L0Av2vtXkPt83pIJmb96mjw8KIl6HYNFgYbCQEambgGcnewPZ/9/6DWFs174+21Kkt LcAwma24s5a6tI95/7leQqHBjHKOjCKHyax50U4w42H07lJDmvQJ5e2CKJwNpEwhrKxh PfJHfAYdI0fAw2xStdFQFtRgCLK7QbVTf3cvY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=VoutuSpi+jAhcbR0+halCQQt4bQSUZuVLyJuaIWuqzRVBb0dJ0P0GEE27G12C+lr5Y JsjaPAnYbzTVDlWtjqRlkyLlCR3keI8NhT/CkRXsccqM0sylo/2TFjb+HAwOYWjis+el QhyBGtSeolKLmrKBTADN4k8+9G6nnslWjwt+E= Received: by 10.142.14.3 with SMTP id 3mr1332828wfn.399.1287203599824; Fri, 15 Oct 2010 21:33:19 -0700 (PDT) Received: from darkstar ([125.33.12.246]) by mx.google.com with ESMTPS id q13sm17093696wfc.17.2010.10.15.21.33.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 15 Oct 2010 21:33:18 -0700 (PDT) Date: Sat, 16 Oct 2010 12:33:31 +0800 From: Dave Young To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, kvm@vger.kernel.org Subject: [PATCH 1/2] Add vzalloc shortcut Message-ID: <20101016043331.GA3177@darkstar> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 16 Oct 2010 04:33:50 +0000 (UTC) --- linux-2.6.orig/include/linux/vmalloc.h 2010-08-22 15:31:38.000000000 +0800 +++ linux-2.6/include/linux/vmalloc.h 2010-10-16 10:50:54.739996121 +0800 @@ -53,6 +53,7 @@ static inline void vmalloc_init(void) #endif extern void *vmalloc(unsigned long size); +extern void *vzalloc(unsigned long size); extern void *vmalloc_user(unsigned long size); extern void *vmalloc_node(unsigned long size, int node); extern void *vmalloc_exec(unsigned long size); --- linux-2.6.orig/mm/vmalloc.c 2010-08-22 15:31:39.000000000 +0800 +++ linux-2.6/mm/vmalloc.c 2010-10-16 10:51:57.126665918 +0800 @@ -1604,6 +1604,19 @@ void *vmalloc(unsigned long size) EXPORT_SYMBOL(vmalloc); /** + * vzalloc - allocate virtually contiguous memory with zero filled + * @size: allocation size + * Allocate enough pages to cover @size from the page level + * allocator and map them into contiguous kernel virtual space. + */ +void *vzalloc(unsigned long size) +{ + return __vmalloc_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, + PAGE_KERNEL, -1, __builtin_return_address(0)); +} +EXPORT_SYMBOL(vzalloc); + +/** * vmalloc_user - allocate zeroed virtually contiguous memory for userspace * @size: allocation size *