Received: by 10.213.65.68 with SMTP id h4csp480516imn; Tue, 13 Mar 2018 10:22:23 -0700 (PDT) X-Google-Smtp-Source: AG47ELt1FNMZfdLs9VcY1cpFZUdGfqcF0ziS1p7Lq3iVykAdyGpA1QrRopnSi73/972x0eRsuwfz X-Received: by 10.99.105.202 with SMTP id e193mr1087244pgc.84.1520961743805; Tue, 13 Mar 2018 10:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520961743; cv=none; d=google.com; s=arc-20160816; b=tFQiDWQMRujhrVZlXOKgxiUIoRRuafqsfKAbqNmNs2ckRGNqBl4JjS7JxhVVy2KRjz ZqfZtxcqY8WUUCQOGPRaOpOQlqs/8OJjFXLrf65Fd+wVxU0tRm+2d5C7dgcAtk92MZbe KUbgE/Pr3xF1dI4jYarOSOU13dXzvV58E6/n5VyErATtEf5PXrU4FEZj8o2leExGCdPX 7zISa+RM6VHYU7EGOyTnd5b5+Xau8QpCO6vGPmFFIwgzl+Yzuii7/d986QW4amvotGAd JR3RCguta7Nm52tI0eWB6b35gAfF58zNlR0DJiNCGlzXB0ieVRGRvAeDXAdyYw250vch PWrg== 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=zC/XwswP/Beir5+sLiHVpEOpJtPpm3hDATFfafAfw5w=; b=TK/SCvNGqxrvkeYbyQBO7lSTMoOoH2ceaGHwQ4yo83N02QPTXQEru9uBUwBKG4x3Lj JLLCZpCLCZNEFcMjQx5H0bMIhP7aIptbne+tHkEQPw1CJAhdfmegWmmr0SY/QZXAi6Ng ZhBcyqankHWzpP+LcrBCXWCQQL8lyyp0On0l756YOyzE6rJpWq93Mr0JDokue8xb5kSw /TFrK/66NKN1F7+qxPIFdXPUQsHAIxOqyHlrdleZYNnZ4gVbZ4C7e/r3XQ5crmOLH18A /UCv15tCDKy3TL+HaH8LR3AAr/vhDslu5U4uMB+fcDk69GSXq92dbj0JQOqu/+cXHBiD 84mA== 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 t63si262967pgt.745.2018.03.13.10.22.08; Tue, 13 Mar 2018 10:22:23 -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 S932376AbeCMRUB (ORCPT + 99 others); Tue, 13 Mar 2018 13:20:01 -0400 Received: from resqmta-po-12v.sys.comcast.net ([96.114.154.171]:59012 "EHLO resqmta-po-12v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbeCMRT7 (ORCPT ); Tue, 13 Mar 2018 13:19:59 -0400 Received: from resomta-po-06v.sys.comcast.net ([96.114.154.230]) by resqmta-po-12v.sys.comcast.net with ESMTP id vnZzeobeqBWV3vnageAM5y; Tue, 13 Mar 2018 17:19:58 +0000 Received: from gentwo.org ([98.222.162.64]) by resomta-po-06v.sys.comcast.net with SMTP id vnaeePnLN2O8Mvnafe1mj0; Tue, 13 Mar 2018 17:19:58 +0000 Received: by gentwo.org (Postfix, from userid 1001) id 540711160458; Tue, 13 Mar 2018 12:19:56 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by gentwo.org (Postfix) with ESMTP id 509601160055; Tue, 13 Mar 2018 12:19:56 -0500 (CDT) Date: Tue, 13 Mar 2018 12:19:56 -0500 (CDT) From: Christopher Lameter X-X-Sender: cl@nuc-kabylake To: Shakeel Butt cc: Suleiman Souhlal , Greg Thelen , Andrew Morton , Pekka Enberg , David Rientjes , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] slab, slub: remove size disparity on debug kernel In-Reply-To: <20180313165428.58699-1-shakeelb@google.com> Message-ID: References: <20180313165428.58699-1-shakeelb@google.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CMAE-Envelope: MS4wfDdbdPP1WxYGakki9wc8rhD3URHN9u0G7rv6e0MBjMfViurbRWTd+z46PAwehEANjNICRhU+iz3HMiqIqb3wgK219thwM1aR+DbG45MlIACVlMcyiOPA SspaW4JjuITVnbgoOrqfhAgL4Ci0dpcavgna6TdnJHFq+7NC1al1APNKnGb4kYmc2vezqFaUdXUGt19afysoxKy+2VEuHIU2bHtH6+9R9E0FPEmP/3NYI62s sMfnzK+brwbS6rZHWS9/JwMWYM12KqtNAFKTynGIBWGHhgyZIimtlPFC3G5h+UPVjNWAjdVgDIfdsQ6FPpYydJ5pC3LOuP7DrRyGyfAIEX6Y9/2EWSdqASjw BJ5KdcB6dVzY6ztlgfSQg72le271qyErrWYYzKjJdY6RhL25mySnrBeTd5DcdkWq1bJkG5ra Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Mar 2018, Shakeel Butt wrote: > However for SLUB in debug kernel, the sizes were same. On further > inspection it is found that SLUB always use kmem_cache.object_size to > measure the kmem_cache.size while SLAB use the given kmem_cache.size. In > the debug kernel the slab's size can be larger than its object_size. > Thus in the creation of non-root slab, the SLAB uses the root's size as > base to calculate the non-root slab's size and thus non-root slab's size > can be larger than the root slab's size. For SLUB, the non-root slab's > size is measured based on the root's object_size and thus the size will > remain same for root and non-root slab. Note that the object_size and size may differ for SLUB based on kernel parameters and slab configuration. For SLAB these are compilation options. > @@ -379,7 +379,7 @@ struct kmem_cache *find_mergeable(unsigned int size, unsigned int align, > } > > static struct kmem_cache *create_cache(const char *name, > - unsigned int object_size, unsigned int size, unsigned int align, > + unsigned int object_size, unsigned int align, > slab_flags_t flags, unsigned int useroffset, Why was both the size and object_size passed during cache creation in the first place? From the flags etc the slab logic should be able to compute the actual bytes required for each object and its metadata.