From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759315Ab0EMV7s (ORCPT ); Thu, 13 May 2010 17:59:48 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:40112 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752127Ab0EMV7p convert rfc822-to-8bit (ORCPT ); Thu, 13 May 2010 17:59:45 -0400 Subject: Re: [PATCH 0/9] mm: generic adaptive large memory allocation APIs Mime-Version: 1.0 (Apple Message framework v1078) Content-Type: text/plain; charset=us-ascii From: Andreas Dilger In-Reply-To: <1273763055.4353.136.camel@mulgrave.site> Date: Thu, 13 May 2010 15:56:43 -0600 Cc: Changli Gao , Andrew Morton , Hoang-Nam Nguyen , Christoph Raisch , Roland Dreier , Sean Hefty , Hal Rosenstock , Divy Le Ray , "Theodore Ts'o" , Alexander Viro , Paul Menage , Li Zefan , linux-rdma@vger.kernel.org, "linux-kernel@vger.kernel.org Mailinglist" , netdev@vger.kernel.org, linux-scsi@vger.kernel.org, "linux-ext4@vger.kernel.org development" , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, containers@lists.linux-foundation.org Content-Transfer-Encoding: 8BIT Message-Id: <7280ADBE-F4BF-43B4-8BAC-5BF129C9DDB3@oracle.com> References: <1273744147-7594-1-git-send-email-xiaosuo@gmail.com> <1273763055.4353.136.camel@mulgrave.site> To: James Bottomley X-Mailer: Apple Mail (2.1078) X-Auth-Type: Internal IP X-Source-IP: rcsinet13.oracle.com [148.87.113.125] X-CT-RefId: str=0001.0A090206.4BEC7616.0066:SCFMA4539811,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2010-05-13, at 09:04, James Bottomley wrote: > This isn't necessarily true ... most drivers and filesystems have to > know what type they're getting. Often they have to do extra tricks to > process vmalloc areas. Conversely, large kmalloc areas are a very > precious commodity: if a driver or filesystem can handle vmalloc for > large allocations, it should: it's easier for us to expand the vmalloc > area than to try to make page reclaim keep large contiguous areas ... I > notice your proposed API does the exact opposite of this ... tries > kmalloc first and then does vmalloc. > > Given this policy problem, isn't it easier simply to hand craft the > vmalloc fall back to kmalloc (or vice versa) in the driver than add this > whole massive raft of APIs for it? I know we wouldn't mind using large vmalloc allocations for e.g. per-group arrays in ext4 (allocated once per mount), but I'd always understood that using vmalloc for general purpose uses can have a significant impact because the vmalloc() engine has (had?) serious performance problems. That means it is better performance-wise to have a wrapper function like this to switch between kmalloc() and vmalloc() based on the allocation size, but it makes the code ugly. Having the wrapper in the kernel would at least identify the different places that are using this kind of workaround. If the performance of vmalloc() has been improved in the last few years, then I'd be happy to just use vmalloc() all the time. That said, vmalloc still isn't suitable for sub-page allocations, so if you have a variable-sized allocation that may be very small or very large the small allocations will waste a whole page and a wrapper is still needed, or vmalloc should be changed to call kmalloc/kfree for the sub-page allocations. Cheers, Andreas -- Andreas Dilger Lustre Technical Lead Oracle Corporation Canada Inc.