Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1267652
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types |
| Date | 2015-11-12 07:20 +0100 |
| Message-ID | <qtToJ-5fA-9@gated-at.bofh.it> (permalink) |
| References | <qthjr-5Fv-3@gated-at.bofh.it> <qthjs-5Fv-17@gated-at.bofh.it> <qtKEN-7L5-3@gated-at.bofh.it> <qtOIq-2aC-3@gated-at.bofh.it> <qtSj0-4yX-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On (11/11/15 21:07), David Rientjes wrote:
[..]
> > > > /* Object size */
> > > > - unsigned long long min_objsize = max, max_objsize = 0, avg_objsize;
> > > > + unsigned int min_objsize = UINT_MAX, max_objsize = 0, avg_objsize;
> > > >
> > > > /* Number of partial slabs in a slabcache */
> > > > unsigned long long min_partial = max, max_partial = 0,
> > >
> > > avg_objsize should not be unsigned int.
> >
> > Hm. the assumption is that `avg_objsize' cannot be larger
> > than `max_objsize', which is
> > `int object_size;' in `struct kmem_cache' from slab_def.h
> > and
> > `unsigned int object_size;' in `struct kmem_cache' from slab.h.
> >
> >
> > avg_objsize = total_used / total_objects;
> >
>
I'm not sure I clearly understand the problems you're pointing
me to.
> 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'.
> If you need to convert max_objsize to be unsigned long long as
> well, that would be better.
... in case if someday `struct kmem_cache' will be updated to keep
`unsigned long' sized objects and sysfs attrs will do sprintf("%lu")?
IOW, if slabs will keep objects bigger that 4gig?
-ss
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] tools/vm: trivial fixes Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-10 14:40 +0100
[PATCH 2/3] tools/vm/page-types: suppress gcc warnings Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-10 14:40 +0100
Re: [PATCH 2/3] tools/vm/page-types: suppress gcc warnings David Rientjes <rientjes@google.com> - 2015-11-11 21:50 +0100
Re: [PATCH 2/3] tools/vm/page-types: suppress gcc warnings Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-12 02:00 +0100
Re: [PATCH 2/3] tools/vm/page-types: suppress gcc warnings David Rientjes <rientjes@google.com> - 2015-11-12 06:50 +0100
[PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-10 14:40 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types Christoph Lameter <cl@linux.com> - 2015-11-10 16:30 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types David Rientjes <rientjes@google.com> - 2015-11-11 22:00 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-12 02:20 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types David Rientjes <rientjes@google.com> - 2015-11-12 06:10 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-12 07:20 +0100
Re: [PATCH 3/3] tools/vm/slabinfo: update struct slabinfo members' types David Rientjes <rientjes@google.com> - 2015-11-12 11:00 +0100
[PATCH 1/3] tools/vm: fix Makefile multi-targets Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-10 14:40 +0100
Re: [PATCH 1/3] tools/vm: fix Makefile multi-targets Christoph Lameter <cl@linux.com> - 2015-11-10 16:30 +0100
Re: [PATCH 1/3] tools/vm: fix Makefile multi-targets Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2015-11-11 13:30 +0100
Re: [PATCH 1/3] tools/vm: fix Makefile multi-targets David Rientjes <rientjes@google.com> - 2015-11-11 21:40 +0100
Re: [PATCH 1/3] tools/vm: fix Makefile multi-targets Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2015-11-12 02:00 +0100
csiph-web