From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764563AbYDYREg (ORCPT ); Fri, 25 Apr 2008 13:04:36 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1759476AbYDYRE2 (ORCPT ); Fri, 25 Apr 2008 13:04:28 -0400 Received: from host36-195-149-62.serverdedicati.aruba.it ([62.149.195.36]:36447 "EHLO mx.cpushare.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756114AbYDYRE2 (ORCPT ); Fri, 25 Apr 2008 13:04:28 -0400 Date: Fri, 25 Apr 2008 19:04:25 +0200 From: Andrea Arcangeli To: Rusty Russell Cc: Christoph Lameter , akpm@linux-foundation.org, Nick Piggin , Steve Wise , Peter Zijlstra , linux-mm@kvack.org, Kanoj Sarcar , Roland Dreier , Jack Steiner , linux-kernel@vger.kernel.org, Avi Kivity , kvm-devel@lists.sourceforge.net, Robin Holt , general@lists.openfabrics.org, Hugh Dickins Subject: Re: [PATCH 1 of 9] Lock the entire mm to prevent any mmu related operation to happen Message-ID: <20080425170425.GB23300@duo.random> References: <200804221506.26226.rusty@rustcorp.com.au> <20080425165639.GA23300@duo.random> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080425165639.GA23300@duo.random> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 25, 2008 at 06:56:39PM +0200, Andrea Arcangeli wrote: > > > + data->i_mmap_locks = vmalloc(nr_i_mmap_locks * > > > + sizeof(spinlock_t)); > > > > This is why non-typesafe allocators suck. You want 'sizeof(spinlock_t *)' > > here. > > > > > + data->anon_vma_locks = vmalloc(nr_anon_vma_locks * > > > + sizeof(spinlock_t)); > > > > and here. > > Great catch! (it was temporarily wasting some ram which isn't nice at all) As I went into the editor I just found the above already fixed in #v14-pre3. And I can't move the structure into the file anymore without kmallocing it. Exposing that structure avoids the ERR_PTR/PTR_ERR on the retvals and one kmalloc so I think it makes the code simpler in the end to keep it as it is now. I'd rather avoid further changes to the 1/N patch, as long as they don't make any difference at runtime and as long as they involve more than cut-and-pasting a structure from .h to .c file.