Received: by 10.192.165.156 with SMTP id m28csp1103144imm; Wed, 11 Apr 2018 12:28:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/GVf6+ugVAhL+nJVHRAExMauZCfIdXBNuTnC/czaJYSkHqMDTIfkkU9LZ4l71LcfTvyFDY X-Received: by 2002:a17:902:76c7:: with SMTP id j7-v6mr6431596plt.108.1523474888191; Wed, 11 Apr 2018 12:28:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523474888; cv=none; d=google.com; s=arc-20160816; b=y33zHvBpVB73UH9CJCieuOX79GgKo2hmDAeHOiYV4tWInt+ZDP/O8QsxYDM7+VkuHz wo6LBHmIFiReMHj2jowVcbomqT81RND9x9F8xTFAcF44KrqgGgIKGXSf6ZjtxqgHuwH9 0k4s9zmXfDG/+5DYSaLcnVpqjTuM4+bgUSvqUapTaOKYcTV4hBdrPpZkAQS6BZssWbp6 ZvXkvnJRH4/KmCu0RAl0VM5mLuYVv64WVXKkR7qlA3EPJUus4ys3cSuw/xHt8YiQj3h4 aGx9Mow+h1hKWF5i6BxqUZuuUjeIX+h12zSvu3kg7gAVHOSngnsLgIwkUk/5OfAvMFjN OP8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=B8E2Omrv4cj6/RqNG92qp2vv7/2IZQUnupFoc0n02yY=; b=PqwxsHjPWsLKylnfqU+eh1GxGzE70ncGr4yfIEbeq8sPB1oxTQmGhdwMuCSni2lApe +8+Q7qeeHnpgoIbK/BJLseJiKNFfLlHxx48IZDR4gsFsn6Rs/eO6Q86YgEFr6fA3wmz7 7Bl1kH2UeBdmK+et8HhXidyp9Lz8jMf6fbVvSDhPOja5KL8rzM80Jji3010rz7TWqwAh vnIPMIvZBxmcekC32wPyCYLMP664Xa7FrACZmVCgcD1fz/cbTiJEw5aZu0iBV2F6kgwW LMARwcv5P/jyWF+HSjoUMrVcp+3J14aueNoAhMT+PZMPBiDHs0gTpOW0+4VgrWgWGBhg PBCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QNNf3ZYm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e4si1135065pgs.526.2018.04.11.12.27.31; Wed, 11 Apr 2018 12:28:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=QNNf3ZYm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757069AbeDKTY5 (ORCPT + 99 others); Wed, 11 Apr 2018 15:24:57 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38574 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753537AbeDKTYx (ORCPT ); Wed, 11 Apr 2018 15:24:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=B8E2Omrv4cj6/RqNG92qp2vv7/2IZQUnupFoc0n02yY=; b=QNNf3ZYmnn1q2dgm655gK5DpC ZB9XaPmEUm7kaIlpSGLDZMkxeLjkSt7dzPmLIWwweJbJQ2ZWrxl2XkPOF+bKAclG8vmxl+lS+pC8C Q0KMuQaiQHrWwCsosCXNkJTLADsH2i2WAQcowCT6IAhT89DdksBcif49A2o+wCVYSAm1aeFHV12+q TF0w7AD+GAMTfZlec+nplopks+hKRVu0CfzUAiwix1UK/BDKaQohgOkSSUezwsGNZtzhZatil9o26 m/Mt2cEKOC4M8PYw30Yc2gx5ohx4qtWnOEE8RlNSgCfwhNDE8cUjJrfCaX5Oc/F/lRD+ZD2MPYrjX aEbBgvGXA==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6LMO-0008Ia-R9; Wed, 11 Apr 2018 19:24:48 +0000 Date: Wed, 11 Apr 2018 12:24:48 -0700 From: Matthew Wilcox To: Christopher Lameter Cc: linux-mm@kvack.org, Matthew Wilcox , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , linux-kernel@vger.kernel.org, Jan Kara , Jeff Layton , Mel Gorman Subject: Re: [PATCH v2 2/2] slab: __GFP_ZERO is incompatible with a constructor Message-ID: <20180411192448.GD22494@bombadil.infradead.org> References: <20180411060320.14458-1-willy@infradead.org> <20180411060320.14458-3-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 08:44:23AM -0500, Christopher Lameter wrote: > > +++ b/mm/slub.c > > @@ -2725,7 +2726,7 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, > > stat(s, ALLOC_FASTPATH); > > } > > > > - if (unlikely(gfpflags & __GFP_ZERO) && object) > > + if (unlikely(gfpflags & __GFP_ZERO) && object && slab_no_ctor(s)) > > memset(object, 0, s->object_size); > > > > slab_post_alloc_hook(s, gfpflags, 1, &object); > > Please put this in a code path that is enabled by specifying > > slub_debug > > on the kernel command line. I don't understand. First, I had: if (unlikely(gfpflags & __GFP_ZERO) && object && !WARN_ON_ONCE(s->ctor)) and you didn't like that because it was putting checking into a (semi)fast path. Now you want me to add a check for slub_debug somewhere? I dont see an existing one I can leverage that will hit on every allocation. Perhaps I'm missing something.