From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbbCZCTO (ORCPT ); Wed, 25 Mar 2015 22:19:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57342 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751912AbbCZCTL (ORCPT ); Wed, 25 Mar 2015 22:19:11 -0400 Date: Wed, 25 Mar 2015 22:18:48 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: David Rientjes cc: 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 In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Mar 2015, David Rientjes wrote: > Mempools based on slab caches with object constructors are risky because > element allocation can happen either from the slab cache itself, meaning > the constructor is properly called before returning, or from the mempool > reserve pool, meaning the constructor is not called before returning, > depending on the allocation context. I don't think there is any problem. If the allocation is hapenning from the slab cache, the constructor is called from the slab sybsystem. If the allocation is hapenning from the mempool reserve, the constructor was called in the past (when the mempool reserve was refilled from the cache). So, in both cases, the object allocated frmo the mempool is constructed. Mikulas > For this reason, we should disallow creating mempools based on slab > caches that have object constructors. Callers of mempool_alloc() will > be responsible for properly initializing the returned element. > > Then, it doesn't matter if the element came from the slab cache or the > mempool reserved pool. > > The only occurrence of a mempool being based on a slab cache with an > object constructor in the tree is in fs/jfs/jfs_metapage.c. Remove it > and properly initialize the element in alloc_metapage(). > > At the same time, META_free is never used, so remove it as well.