Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751948Ab0HZBtB (ORCPT ); Wed, 25 Aug 2010 21:49:01 -0400 Received: from thunk.org ([69.25.196.29]:35646 "EHLO thunker.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750881Ab0HZBs7 (ORCPT ); Wed, 25 Aug 2010 21:48:59 -0400 Date: Wed, 25 Aug 2010 21:48:47 -0400 From: "Ted Ts'o" To: David Rientjes Cc: Peter Zijlstra , Jens Axboe , Andrew Morton , Neil Brown , Alasdair G Kergon , Chris Mason , Steven Whitehouse , Jan Kara , Frederic Weisbecker , "linux-raid@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "cluster-devel@redhat.com" , "linux-ext4@vger.kernel.org" , "reiserfs-devel@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [patch 1/5] mm: add nofail variants of kmalloc kcalloc and kzalloc Message-ID: <20100826014847.GQ4453@thunk.org> Mail-Followup-To: Ted Ts'o , David Rientjes , Peter Zijlstra , Jens Axboe , Andrew Morton , Neil Brown , Alasdair G Kergon , Chris Mason , Steven Whitehouse , Jan Kara , Frederic Weisbecker , "linux-raid@vger.kernel.org" , "linux-btrfs@vger.kernel.org" , "cluster-devel@redhat.com" , "linux-ext4@vger.kernel.org" , "reiserfs-devel@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <1282740778.2605.3652.camel@laptop> <1282743090.2605.3696.camel@laptop> <1282769729.1975.96.camel@laptop> <1282771677.1975.138.camel@laptop> <20100826001901.GL4453@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on thunker.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1610 Lines: 32 On Wed, Aug 25, 2010 at 05:30:42PM -0700, David Rientjes wrote: > > We certainly hope that nobody will reimplement the same function without > the __deprecated warning, especially for order < PAGE_ALLOC_COSTLY_ORDER > where there's no looping at a higher level. So perhaps the best > alternative is to implement the same _nofail() functions but do a > WARN_ON(get_order(size) > PAGE_ALLOC_COSTLY_ORDER) instead? Yeah, that sounds better. > I think it's really sad that the caller can't know what the upper bounds > of its memory requirement are ahead of time or at least be able to > implement a memory freeing function when kmalloc() returns NULL. Oh, we can determine an upper bound. You might just not like it. Actually ext3/ext4 shouldn't be as bad as XFS, which Dave estimated to be around 400k for a transaction. My guess is that the worst case for ext3/ext4 is probably around 256k or so; like XFS, most of the time, it would be a lot less. (At least, if data != journalled; if we are doing data journalling and every single data block begins with 0xc03b3998U, we'll need to allocate a 4k page for every single data block written.) We could dynamically calculate an upper bound if we had to. Of course, if ext3/ext4 is attached to a network block device, then it could get a lot worse than 256k, of course. - Ted -- 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/