From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753265AbbCZO6p (ORCPT ); Thu, 26 Mar 2015 10:58:45 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:34497 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753225AbbCZO6T (ORCPT ); Thu, 26 Mar 2015 10:58:19 -0400 Message-ID: <55141E75.4090403@oracle.com> Date: Thu, 26 Mar 2015 09:57:57 -0500 From: Dave Kleikamp User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Christoph Hellwig , David Rientjes CC: Mikulas Patocka , Andrew Morton , Dave Kleikamp , 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 References: <20150326072800.GA26163@lst.de> In-Reply-To: <20150326072800.GA26163@lst.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/26/2015 02:28 AM, Christoph Hellwig wrote: > 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'm pretty sure that this was the intention of the jfs code. Returned objects should have these fields returned to their initial values. It does seem error-prone, though. If jfs is in fact the last user of the constructor, it's probably time for it to die. > > 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.