From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752212AbbCZH2F (ORCPT ); Thu, 26 Mar 2015 03:28:05 -0400 Received: from verein.lst.de ([213.95.11.211]:51153 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750978AbbCZH2D (ORCPT ); Thu, 26 Mar 2015 03:28:03 -0400 Date: Thu, 26 Mar 2015 08:28:00 +0100 From: Christoph Hellwig To: David Rientjes Cc: Mikulas Patocka , Andrew Morton , Dave Kleikamp , Christoph Hellwig , Sebastian Ott , Catalin Marinas , linux-kernel@vger.kernel.org, linux-mm@kvack.org, jfs-discussion@lists.sourceforge.net Subject: Re: [patch 1/4] fs, jfs: remove slab object constructor Message-ID: <20150326072800.GA26163@lst.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 25, 2015 at 07:37:40PM -0700, David Rientjes wrote: > That would be true only for > > ptr = mempool_alloc(gfp, pool); > mempool_free(ptr, pool); > > and nothing in between, and that's pretty pointless. Typically, callers > allocate memory, modify it, and then free it. When that happens with > mempools, and we can't allocate slab because of the gfp context, mempools > will return elements in the state in which they were freed (modified, not > as constructed). The historic slab allocator (Solaris and early Linux) expects objects to be returned in the same / similar enough form as the constructor returned it, and the constructor is only called when allocating pages from the page pool. I have to admit that I haven't used this feature forever, and I have no idea if people changed how the allocator works in the meantime.