Received: by 10.213.65.68 with SMTP id h4csp4081395imn; Tue, 10 Apr 2018 08:58:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+HmMh2EzUtui5qEC5W07XqoXd6DojZPNxODvU9Mpb+j4/FbfROESCc6ahgCnbIq7Rjpo8s X-Received: by 2002:a17:902:9892:: with SMTP id s18-v6mr1030968plp.95.1523375934402; Tue, 10 Apr 2018 08:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523375934; cv=none; d=google.com; s=arc-20160816; b=yERF5D2alyi2cFgT9ORMCd35upS4jGCKTUUyEU7J3sGM5wqV3JcrOG+D2PULXVDp99 mh+7u+k9BRsSdiRE9QWoYVex/zZRucBTeo77tsFSRcl94oqkYYvEmieMxbBGaRJaJFPE bKu+Crh4P5eMhvNXL/t6WygI0m0Ux5IlnwFK+dcByPzd/GQgbUqwwsVMT4lP4LVSSf/6 lTkSY92GstFSIcidmozAONoxtCW9npUGegLi+0E+myvWLVIlwhOskrQCZ9kH9MdY2cFm WUC29INGzhftejDLv/DLUTg8StJB/RgbGmyXWL4ajuGWRhNOT9rbiL6q58Lq8vSQspFf +W9w== 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=ww9jeD0SPfkLHAkVXFjk0yNzna8M24+owQ7cUnT0cAM=; b=eEsVwEBw5zEh5QsaOP/Mq6cAVJVe47RoX/2p5g3txWXeDOlwHGvbnUjTvfnGhgWMdM rGYXttZHlxhCNtOXBiuIPDmR+Z6fXXKbr67q9ICaKDbJroAqkRyMvz6xx53SPqwzKNEx JeSRVavbIz9+wpNdpnVy28jes+CsxMeRqotvk4DPigKLVguJaJqPIMvZxoCjFjNpMwIh RzHKqGfF3JpERodzrj/quNo6l+Yi6f7NkZ7zhWPWXCQfF+sLYazYqk20820vT7Kr3T1O xntIk5yqdhRanwMzTQi7UNsHc8q282QRewEgvqGfy1uU/ybGbUElQYWLWqht4HaOV93Z Ozqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YxJXmA3j; 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 c7si2299541pfi.180.2018.04.10.08.58.16; Tue, 10 Apr 2018 08:58:54 -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=YxJXmA3j; 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 S1752284AbeDJPyv (ORCPT + 99 others); Tue, 10 Apr 2018 11:54:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38746 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751929AbeDJPyt (ORCPT ); Tue, 10 Apr 2018 11:54:49 -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=ww9jeD0SPfkLHAkVXFjk0yNzna8M24+owQ7cUnT0cAM=; b=YxJXmA3j12GXF7EwSq+f1PEwE 1CgxAqMmFTr0vTWv8IOON8IbCltFMMMxmC2uANNMYxQdDdkhmaunpYzemsgkHn4CzxmdqRBhOl166 xs1/2QQ2I7XsujYdXu+1EgfDMeC9H8WOBfMd07RfIwnTJ/iv/f5z3aBtGU9hRN2ejby5KN3GM1g7D DRA6HfRFAezIxlqy+gaZKGhp3CE6EcHqyapUjjEtM7B8oMr4NO/l8KKKEZJgk0YWBBssNNMsfEoFT 1LmXMqR81NRx+MsSMAAHApcpMskyB9+N82VHKEWGJxV4KPsZGB0y+5cUOdOuvnHcGz1XOfkW1GmX0 eHl5QiVLw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f5vbW-0001cQ-PP; Tue, 10 Apr 2018 15:54:42 +0000 Date: Tue, 10 Apr 2018 08:54:42 -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 , stable@vger.kernel.org Subject: Re: [PATCH 1/2] slab: __GFP_ZERO is incompatible with a constructor Message-ID: <20180410155442.GA3614@bombadil.infradead.org> References: <20180410125351.15837-1-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 Tue, Apr 10, 2018 at 09:21:20AM -0500, Christopher Lameter wrote: > On Tue, 10 Apr 2018, Matthew Wilcox wrote: > > > __GFP_ZERO requests that the object be initialised to all-zeroes, > > while the purpose of a constructor is to initialise an object to a > > particular pattern. We cannot do both. Add a warning to catch any > > users who mistakenly pass a __GFP_ZERO flag when allocating a slab with > > a constructor. > > Can we move this check out of the critical paths and check for > a ctor and GFP_ZERO when calling the page allocator? F.e. in > allocate_slab()? Are you willing to have this kind of bug go uncaught for a while? In this specific case, __GFP_ZERO was only being passed on a few of the calls to kmem_cache_alloc. So we'd happily trash the constructed object any time we didn't allocate a page. I appreciate it's a tradeoff, and we don't want to clutter the critical path unnecessarily.