lkml.org 
[lkml]   [2009]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Export symbol ksize()
On Sun, 15 Feb 2009 15:43:14 -0600 Matt Mackall <mpm@selenic.com> wrote:

> On Sun, 2009-02-15 at 13:36 -0800, Andrew Morton wrote:
> > On Thu, 12 Feb 2009 17:55:04 +0200 Pekka Enberg <penberg@cs.helsinki.fi> wrote:
> >
> > > On Thu, Feb 12, 2009 at 12:45:21PM +0200, Pekka Enberg wrote:
> > > > >
> > > > > Because the API was being widely abused in the nommu code, for example.
> > > > > I'd rather not add it back for this special case which can be handled
> > > > > otherwise.
> > >
> > > On Thu, 2009-02-12 at 18:50 +0800, Herbert Xu wrote:
> > > > I'm sorry but that's like banning the use of heaters just because
> > > > they can abused and cause fires.
> > > >
> > > > I think I've said this to you before but in networking we very much
> > > > want to use ksize because the standard case of a 1500-byte packet
> > > > has loads of extra room given by kmalloc which all goes to waste
> > > > right now.
> > > >
> > > > If we could use ksize then we can stuff loads of metadata in that
> > > > space.
> > >
> > > OK, fair enough, I applied Kirill's patch. Thanks.
> > >
> >
> > Could we please have more details regarding this:
> >
> > > The ksize() function is not exported to modules because it has non-standard
> > > behavour across different slab allocators.
> >
> > How does the behaviour differ? It this documented? Can we fix it?
>
> SLAB and SLUB support calling ksize() on objects returned by
> kmem_cache_alloc.
>
> SLOB only supports it on objects from kmalloc. This is because it does
> not store any size or type information in kmem_cache_alloc'ed objects.
> Instead, it infers them from the cache argument.

OK. This is really bad, isn't it? People will write code which
happily works under slab and slub, only to have it crash for those small
number of people who (very much later) test with slob?

> Ideally SLAB and SLUB would complain about using ksize inappropriately
> when debugging was enabled.
>

OK, thanks.

Ideally we would support ksize() for both kmalloc() and
kmem_cache_alloc() memory across all implementations.

Could we change ksize()'s argument so that callers must provide the
cache pointer? Then for kmalloc() callers, provide a
kmem_cache *get_cache_for_kmalloc(size_t) function?

Or could we have separate interfaces:

size_t kmalloc_ksize(size_t kmalloced_size);
size_t kmem_cache_alloc_ksize(struct kmem_cache *cachep);

?


Gee this sucks. Biggest mistake I ever made. Are we working hard
enough to remove some of these sl?b implementations? Would it help if
I randomly deleted a couple?



\
 
 \ /
  Last update: 2009-02-18 12:23    [W:0.154 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site