From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jamie Lokier Subject: Re: [RFC] mm: generic adaptive large memory allocation APIs Date: Thu, 6 May 2010 16:35:46 +0100 Message-ID: <20100506153546.GC28512@shareable.org> References: <1273105838-4441-1-git-send-email-xiaosuo@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: 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: Received: from mail2.shareable.org ([80.68.89.115]:47654 "EHLO mail2.shareable.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754084Ab0EFPgE (ORCPT ); Thu, 6 May 2010 11:36:04 -0400 Content-Disposition: inline In-Reply-To: <1273105838-4441-1-git-send-email-xiaosuo@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Changli Gao wrote: > kvmalloc() will try to allocate physically contiguous memory first, and try > vmalloc to allocate virtually contiguous memory when the former allocation > fails. Note that converting users from vmalloc() to kvmalloc() may increase fragmentation problems for other parts of the kernel, because it will tend to use up more of the available large blocks. Especially users who allocate large blocks and often. That's worth a mention somewhere. On the other hand, this API could make it easier to convert some kmalloc() calls to kvmalloc(), reducing fragmentation problems. :-) Since the caller is indicating they don't mind which happens, then anti-fragmentation heuristics (such as checking watermarks) could be added to kvmalloc() at some future time, if needed. -- Jamie