Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp1346500yba; Thu, 4 Apr 2019 08:59:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxqdQKUI26ZwBaLK9AzHvXWWgJ/TSa9HTEEvNRM37zGYSCDjPdh4GcclFMdMVTlWauCbqfl X-Received: by 2002:a63:da4e:: with SMTP id l14mr6368235pgj.96.1554393584186; Thu, 04 Apr 2019 08:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554393584; cv=none; d=google.com; s=arc-20160816; b=nJC4uEhWJewvAlEHwUr7IPbmIpnKgoUpdj0KQlmGpbvGfv+kMK4sZGoh+SGM9/8f7X BttNzPibd3yrXKpPiZElaPL2QwY2fPQCMRBJ8Li+rdw1jjxSJ8OxtTn2NT/Te2foTO60 hzM+XTgJIInUrZm6Wz0SHoPGiHXZhqMLkC+kA/u+Ojy2idAOiFGMgAEgjW7KoOvdHjzV JnHMz+kORnSx3tC6UPoCFCsikDwjlW+WC7BSqUic5r60VUiLb/8jdJBYBptVgtg4K/3G Mrs77Obrp3OS3jY8E1YSQlxpKDHhB++SCIKcQP3LC/9dM50IXsp9Qp69Ffc3YGsssNar S/Sg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:feedback-id:mime-version:user-agent :references:message-id:in-reply-to:subject:cc:to:from:date :dkim-signature; bh=RuMz4Toeop1wxCt6X2zIK+G7Ftq7sJ4nnRup7oWLd6w=; b=ldYIQHSQg2nZ3hUWaipFonOIyLxTQemb05Z3KUSzOi1nbIQt6NUpQuk2c8QJNRYxdA KMUKfx4WQCrOH9VWIZJYgKEYiD6Efg5VEE9RFJiP8VNIokG5nilHLHCUPUj7MH3M767l MOg8m8vGvr+S0WzJ9Mpf7RO+FW4XJ13jq/fwyLHvRWE0Z/KDL984xvZsjxWmwlNCqqZT D8TdwgVvekca6y8fiF1x52MEcklVL/HyZJBxNkHkt3MZKz+MFndxWvBVH4+OY+jSvLQo mGgQgCoZuxrd6SzMdqli80y0ohjV5hG1JvLYOg1e1ydRc2Ufhe51OPU3MU7SCzgoXUqT h4kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=SUh6lLJr; 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 z72si16642707pgd.401.2019.04.04.08.59.29; Thu, 04 Apr 2019 08:59:44 -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=pass header.i=@amazonses.com header.s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw header.b=SUh6lLJr; 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 S1728623AbfDDP5Z (ORCPT + 99 others); Thu, 4 Apr 2019 11:57:25 -0400 Received: from a9-112.smtp-out.amazonses.com ([54.240.9.112]:52628 "EHLO a9-112.smtp-out.amazonses.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726888AbfDDP5Y (ORCPT ); Thu, 4 Apr 2019 11:57:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=6gbrjpgwjskckoa6a5zn6fwqkn67xbtw; d=amazonses.com; t=1554393444; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:MIME-Version:Content-Type:Feedback-ID; bh=RuMz4Toeop1wxCt6X2zIK+G7Ftq7sJ4nnRup7oWLd6w=; b=SUh6lLJrm4vec3E2SFmgWkGVRSs+fQeW9viK/c0l5DTGNw1mokz/ZXG+cWUx+GcS VdamHeX5Ew672CyFv5BEEO1VcQ/dKjT3lLcGTd4srAa+lw8gXVVMT4UuSZyF3sdOz+5 fjuOhF88OcO3A9Tz0MOJWTyiC6l/+IqwI7TKccj4= Date: Thu, 4 Apr 2019 15:57:24 +0000 From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Vlastimil Babka cc: linux-mm@kvack.org, Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Mel Gorman , linux-kernel@vger.kernel.org Subject: Re: [RFC 0/2] add static key for slub_debug In-Reply-To: <20190404091531.9815-1-vbabka@suse.cz> Message-ID: <01000169e911ae41-0abde43e-18e8-442b-b289-e796c461f0b1-000000@email.amazonses.com> References: <20190404091531.9815-1-vbabka@suse.cz> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-SES-Outgoing: 2019.04.04-54.240.9.112 Feedback-ID: 1.us-east-1.fQZZZ0Xtj2+TD7V5apTT/NrT6QKuPgzCT/IC7XYgDKI=:AmazonSES Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 4 Apr 2019, Vlastimil Babka wrote: > I looked a bit at SLUB debugging capabilities and first thing I noticed is > there's no static key guarding the runtime enablement as is common for similar > debugging functionalities, so here's a RFC to add it. Can be further improved > if there's interest. Well the runtime enablement is per slab cache and static keys are global. Adding static key adds code to the critical paths. Since the flags for a kmem_cache have to be inspected anyways there may not be that much of a benefit. > It's true that in the alloc fast path the debugging check overhead is AFAICS > amortized by the per-cpu cache, i.e. when the allocation is from there, no > debugging functionality is performed. IMHO that's kinda a weakness, especially > for SLAB_STORE_USER, so I might also look at doing something about it, and then > the static key might be more critical for overhead reduction. Moving debugging out of the per cpu fastpath allows that fastpath to be much simpler and faster. SLAB_STORE_USER is mostly used only for debugging in which case we are less concerned with performance. If you want to use SLAB_STORE_USER in the fastpath then we have to do some major redesign there. > In the freeing fast path I quickly checked the stats and it seems that in > do_slab_free(), the "if (likely(page == c->page))" is not as likely as it > declares, as in the majority of cases, freeing doesn't happen on the object > that belongs to the page currently cached. So the advantage of a static key in > slow path __slab_free() should be more useful immediately. Right. The freeing logic is actuall a weakness in terms of performance for SLUB due to the need to operate on a per page queue immediately.