Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754208AbbKLJ7m (ORCPT ); Thu, 12 Nov 2015 04:59:42 -0500 Received: from mail-pa0-f46.google.com ([209.85.220.46]:35899 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753644AbbKLJ7k (ORCPT ); Thu, 12 Nov 2015 04:59:40 -0500 Date: Thu, 12 Nov 2015 01:59:35 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Sergey Senozhatsky cc: Sergey Senozhatsky , Andrew Morton , Christoph Lameter , Pekka Enberg , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types In-Reply-To: <20151112061701.GA498@swordfish> Message-ID: References: <1447162326-30626-1-git-send-email-sergey.senozhatsky@gmail.com> <1447162326-30626-4-git-send-email-sergey.senozhatsky@gmail.com> <20151112011347.GC1651@swordfish> <20151112061701.GA498@swordfish> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2855 Lines: 73 On Thu, 12 Nov 2015, Sergey Senozhatsky wrote: > > This has nothing to do with object_size in the kernel. > > what we have in slabinfo as slab_size(), ->object_size, etc. > comming from slub's sysfs attrs: > > chdir("/sys/kernel/slab") > while readdir > ... > slab->object_size = get_obj("object_size"); > slab->slab_size = get_obj("slab_size"); > ... > > and attr show handlers are: > > ... > static ssize_t slab_size_show(struct kmem_cache *s, char *buf) > { > return sprintf(buf, "%d\n", s->size); > } > SLAB_ATTR_RO(slab_size); > > static ssize_t object_size_show(struct kmem_cache *s, char *buf) > { > return sprintf(buf, "%d\n", s->object_size); > } > SLAB_ATTR_RO(object_size); > ... > > so those are sprintf("%d") of `struct kmem_cache'-s `int' > values. > > > > total_used and total_objects are unsigned long long. > > yes, that's correct. > but `total_used / total_objects' cannot be larger that the size > of the largest object, which is represented in the kernel and > returned to user space as `int'. it must fit into `unsigned int'. > Again, I am referring only to slabinfo as its own logical unit, it shouldn't be based on the implementation of any slab allocator in particular. avg_objsize has nothing to do with your patch, which is advertised as fixing the mismatch in sign type of variables under comparison. There seems to be an on-going issue in this patchset that you're not confronting: you are mixing extraneous changes into patches that are supposed to do one thing. This already got you in trouble in the first patch where you just threw -O2 into the Makefile randomly, and without any mention in the commit description, and then you don't understand how to fix the warnings that it now presents in page-types. The warnings being shown are a result of the particular _optimization_ that your gcc version has done and your subsequent patch is only addressing the ones that appear when you, yourself, compile. Between different gcc versions, the optimization done by -O2 may be different and it will warn of more or less variables that may be clobbered as a result OF ITS OPTIMIZATION. You miss entirely that _any_ variable modified after the setjmp() can be clobbered, most notably "off" which is the iterator of the very loop the setjmp() appears in! Playing whack-a-mole in the warnings you get without understanding them is the issue here. Please, very respectfully, do not include extraneous changes into patches, especially without mentioning them in the commit description, when the change isn't needed or understood. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/