Re: [RFC] SL[AUO]B common code 3/9] Extract common fields from struct kmem_cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Wed, 16 May 2012, Glauber Costa wrote:

> >   /*
> > + * Common fields provided in kmem_cache by all slab allocators
> > + */
> > +#define SLAB_COMMON \
> > +	unsigned int size, align;					\
> > +	unsigned long flags;						\
> > +	const char *name;						\
> > +	int refcount;							\
> > +	void (*ctor)(void *);						\
> > +	struct list_head list;
> > +
> > +/*
> >    * struct kmem_cache related prototypes
>
> Isn't it better to define struct kmem_cache here, and then put the non-common
> fields under proper ifdefs ?

Then we would move the definition to include/linux/slab.h. The allocator
kmem_cache struct definitions rely on other allocator specific
declarations at this point. Wont work.

> > Index: linux-2.6/mm/slob.c
> > ===================================================================
> > --- linux-2.6.orig/mm/slob.c	2012-05-11 08:34:31.792522763 -0500
> > +++ linux-2.6/mm/slob.c	2012-05-11 09:42:52.032437799 -0500
> > @@ -538,13 +538,6 @@ size_t ksize(const void *block)
> >   }
> >   EXPORT_SYMBOL(ksize);
> >
> > -struct kmem_cache {
> > -	unsigned int size, align;
> > -	unsigned long flags;
> > -	const char *name;
> > -	void (*ctor)(void *);
> > -};
> > -
>
> Who defines struct kmem_cache for the slob now ?

Its defined in include/linux/slob_def.h

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Site Home]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Tools]     [DDR & Rambus]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

Add to Google Google PageRank Checking tool