From mboxrd@z Thu Jan 1 00:00:00 1970 From: KOSAKI Motohiro Subject: Re: [RFC] mm: generic adaptive large memory allocation APIs Date: Thu, 13 May 2010 13:45:35 +0900 (JST) Message-ID: <20100513134124.2164.A69D9226@jp.fujitsu.com> References: <1273105838-4441-1-git-send-email-xiaosuo@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Cc: kosaki.motohiro@jp.fujitsu.com, akpm@linux-foundation.org, Eric Dumazet , Jiri Slaby , Alexander Viro , "Paul E. McKenney" , Alexey Dobriyan , Ingo Molnar , Peter Zijlstra , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Avi Kivity , Tetsuo Handa To: Changli Gao Return-path: In-Reply-To: <1273105838-4441-1-git-send-email-xiaosuo@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Hi > void *kvmalloc(size_t size) > { > void *ptr; > > if (size < PAGE_SIZE) > return kmalloc(PAGE_SIZE, GFP_KERNEL); > ptr = alloc_pages_exact(size, GFP_KERNEL | __GFP_NOWARN); low order GFP_KERNEL allocation never fail. then, this doesn't works as you expected. > if (ptr != NULL) > return ptr; > > return vmalloc(size); On x86, vmalloc area is only 128MB address space. it is very rare resource than physical ram. vmalloc fallback is not good idea.