Received: by 10.192.165.156 with SMTP id m28csp1191703imm; Wed, 11 Apr 2018 14:15:08 -0700 (PDT) X-Google-Smtp-Source: AIpwx49POi0ze8hcNPoqsq4YTzkk6LBtwv12uZplmEny3O9Acyyx13bBMBmtV/LVJ5gGgoY14zLH X-Received: by 2002:a17:902:564:: with SMTP id 91-v6mr6886504plf.63.1523481308281; Wed, 11 Apr 2018 14:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523481308; cv=none; d=google.com; s=arc-20160816; b=X5Z4gDX/9U/4bsA4wAa8MZGOUzmiRY6SVDpWbOMSItVGSHI1t3CXkJgU76jSZSg59I HcbZ0YPH9q04mG6UhDWUGWONpDxO0tLK2hJ0MQgSlgHXH3WDG7YYzAavROn+jHFSQKpZ 1a9h7LspB62XHevlIr+rv4vmaPxZb0lWmINyTpx6hOn4/48838bvxVa1KujcMjxbgyAl 4MYBGqyJxVKx6aVkyqeBnKDADeslvYnLTCIRXc708XTkDVmiriP+ba/tMavZDNbHcB9l Hywlbdxy7MPi19VLTIRFnf4L4EdpD/XGRsG5Ou2GJhq0Wsiyvc8Fo2Bj/jDBXTZzvAiC 1i+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=aBSZTO8yTwh534OGQ7qvDQnJibWMzpxel/buo/vv8sQ=; b=JyqV1bQebV0iWLZOWwHNlyogwPs6cwP1ieqawnY4coj7o81bzaMOnDYGPJFS3YDtEE SStv1ZXPqdW9a7PbcJNba8BHcJ4b/k3snVWbiNHHAOO4GzidDMXyER7Smi5lDOeyAtxo B3Pl/gJ3WgsP3ylWtIqP+F7ux8iadeEI0c0c5NSL1BD0Ng63jLkiO2ZPezBCZ+tE98BV q71qYSqzKoDYOW7b+VcZ2zWBPdmoD14PF0qZ/GTvjFpuIYfsmWmtXpc++se6pv7dRZtM VWCzlpPuqXv8nKm6A+bPS6hiWgi+wf1zvXnyvZ34+KGA6+t0KWL9S+qqFuYwr9wRvezc O7ig== ARC-Authentication-Results: i=1; mx.google.com; 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 w8-v6si767990plp.521.2018.04.11.14.14.31; Wed, 11 Apr 2018 14:15: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; 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 S1755120AbeDKVLW (ORCPT + 99 others); Wed, 11 Apr 2018 17:11:22 -0400 Received: from resqmta-ch2-11v.sys.comcast.net ([69.252.207.43]:39452 "EHLO resqmta-ch2-11v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753258AbeDKVLT (ORCPT ); Wed, 11 Apr 2018 17:11:19 -0400 Received: from resomta-ch2-18v.sys.comcast.net ([69.252.207.114]) by resqmta-ch2-11v.sys.comcast.net with ESMTP id 6N1TfmOl8mUWH6N1Tf2hBd; Wed, 11 Apr 2018 21:11:19 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-ch2-18v.sys.comcast.net with SMTP id 6N1RfepkmgLrT6N1SfkNgH; Wed, 11 Apr 2018 21:11:18 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 58BAE11616B0; Wed, 11 Apr 2018 16:11:17 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 56594116012E; Wed, 11 Apr 2018 16:11:17 -0500 (CDT) Date: Wed, 11 Apr 2018 16:11:17 -0500 (CDT) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Matthew Wilcox 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 In-Reply-To: <20180411192448.GD22494@bombadil.infradead.org> Message-ID: References: <20180411060320.14458-1-willy@infradead.org> <20180411060320.14458-3-willy@infradead.org> <20180411192448.GD22494@bombadil.infradead.org> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfN+nXFTaL/GCaQdMvox7DUkk+vaan1S5or1M12BuWnrlQvyrKGl69Q1kZKrGMvhBcAf6eY0TdUVciLw8dflpHdZKrQMsxLqBjjAxj/bH0NNwWx2zgpxD ppa3f+TVaR0lNid1q4zbxM0ImlsxqPMbd3EfeNvGlajW0v4F9kpp9PVP6/8uA9be9RJ50WYGkVVfHGgWvN+5/+hZbz0hMv5BYuYAdlJiWfkIrk0z2z9vYqG5 NraJI0Li/bgb9BmVukRm7Z/KeZnFIpQsAbKdnQocnTRQsUyORN3YgoHzrnb2o7x1bSjtPL2GemTdijH0pCG5wNsHxjtmTAh7U2N4nSkn1PpfpgB49hAExhzK V9pDXpSRYhNzrGjX+z1rA1HkpQ5hfnJvEyJ4VQ0u6IQNxAuuYrOybuJOb4g42WOYBgNi5G2AUk7HwDo3Yg1vmciMcC/YjCstHeDgzL2qKRbmIUL6OQEY03HE +HbhEtU8T+DAq99u Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 11 Apr 2018, Matthew Wilcox wrote: > > > 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. The WARN_ON is only enabled when you configure and build the kernel with debugging enabled (CONFIG_VM_DEBUG). That is a compile time debugging feature like supported by SLAB. SLUB debugging is different because we had problems isolating memory corruption bugs in the production kernels for years. The debug code is always included in the build but kept out of the hotpaths. The debug can be enabled when needed to find memory corruption errors without the need to rebuild a kernel for a prod environment (which may change race conditions etc) because we only then need to add a kernel parameter. "slub_debug" enables kmem_cache->flags & SLAB_DEBUG and that forces all fastpath processing to be disabled. Thus you can check reliably in the slow path only for the GFP_ZERO problem. Add the check to the other debug stuff already there. F.e. in alloc_debug_processing() or after if (kmem_cache_debug(s) ... in ____slab_alloc()