Received: by 10.192.165.156 with SMTP id m28csp1315037imm; Wed, 11 Apr 2018 17:00:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+21RBiYvRJo2d6N+i6GUKTbKsGSbEO9LWuzzyvr28nACVV9PEMkUeMATLYJW2SzNhuq281 X-Received: by 2002:a17:902:5681:: with SMTP id j1-v6mr7238135pli.383.1523491222118; Wed, 11 Apr 2018 17:00:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523491222; cv=none; d=google.com; s=arc-20160816; b=oM3/QeBZGR7MUz2hiOLY1OKY+Wfl+cb9gg0aKgBLj4hcCgo69Pr7+2OterNStYubSG QF2Uc+lhAQlsjUiCUQE9dm8rkTofyX69Vu0daeGDlZV3BUALW40Pwll0r7RLtZDRg19A kw5Wpi2D3+ibuYBt1Ls8kbZ3BFYRRJRUaLKYNs2mS+VBilLpPrvKrzbFeDz6T8FRlj2W RLxJBuERUg+Ekcw3FlQzj0/F4VKQVpBcvc07FtH1hF/ogb/cCLiLdcvhacQ/EaDv5ACQ PW8kVyLxjbMHIuO9LIvmkj+XrNKoztsptO0Z57bnCOnR0K5PzWTuB9jhUtiahduiRIeB 8X6w== 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=h0diLse9hq13pcrD59X/J/MRL15I2nt7XppB8SdR5Ys=; b=OV0Qw5AXGiyZty16Ih78HsA93O7Ks/hRQAdky6Wiy1RME/iJskyBaN20cJdKy06vwU RpPJiHVoFWSgEOeUOOSnIPFNrMPhjMkf9Hj1e4LsYMNsroMthbMcMfRyhZGftDhpN/Qr 5y3+cjVJji3uJ6cXEIROWuWLw9CE0MUGYTWLbgMHuuA7B57luyMi6tijlYwyRXp0tmdj Hl3vJ+5G1/7KfaRBYxkTjlo6lQywGkfUZwAVZw89Q8owKoOAePEO4a78VwlVEU67FN9Y 7FKXlNZvXgdwleTRAs9EFrwbV2aUJaU9tQ9aKEs2kB3/VvMyXrgks+mROtllN27xUWHm eydQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=MGhk7lsm; 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 s2si1629766pfb.39.2018.04.11.16.59.41; Wed, 11 Apr 2018 17:00:22 -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=MGhk7lsm; 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 S1752291AbeDKX47 (ORCPT + 99 others); Wed, 11 Apr 2018 19:56:59 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:53162 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751633AbeDKX46 (ORCPT ); Wed, 11 Apr 2018 19:56:58 -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=h0diLse9hq13pcrD59X/J/MRL15I2nt7XppB8SdR5Ys=; b=MGhk7lsmy+ciItDU4SJLULPkM k/ZOHhBB1DTbgL9Lu2FliYsC2gyQa0PQxY0zS/S2Y58bFHZ3y4AV3kFJTZA/BQNdj0ZGbdFDw3X6p 1Qt8FD4aHhQ/uXAQ6GaRUWQvF7Pe3cLe/EBVawwEwfifXx3GN21mmsQ7xdQMRCaikT2MjZcOF14tK TbIFN7+fl/5kIwFCfxH/xeWYZ/+wta0QD/83mhwlN4tBeojhfyOyi44+wcI1UlPCfxnOgz0s7nN1o CW6ve0C3ufAh20XtYlPowqNyRpfBwvrMqbX8cK72VRahE2ZWRrCzRsi6BFLb6eIWX9rNqcpwQvGdV 0cFtTMXWw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1f6Pbg-0003sS-Dc; Wed, 11 Apr 2018 23:56:52 +0000 Date: Wed, 11 Apr 2018 16:56:52 -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: <20180411235652.GA28279@bombadil.infradead.org> References: <20180411060320.14458-1-willy@infradead.org> <20180411060320.14458-3-willy@infradead.org> <20180411192448.GD22494@bombadil.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 04:11:17PM -0500, Christopher Lameter wrote: > On Wed, 11 Apr 2018, Matthew Wilcox wrote: > > > 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. Yes. I want to have an option to check *every single* allocation. > "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() I don't see how that works ... can you explain a little more? I see ___slab_alloc() is called from __slab_alloc(). And I see slab_alloc_node does this: object = c->freelist; page = c->page; if (unlikely(!object || !node_match(page, node))) { object = __slab_alloc(s, gfpflags, node, addr, c); stat(s, ALLOC_SLOWPATH); But I don't see how slub_debug leads to c->freelist always being NULL. It looks like it gets repopulated from page->freelist in ___slab_alloc() at the load_freelist label.