Skip to contentSkip to conversation

Remove global slab cache declarations from slab.h

PATCH New Christoph Lameter 1 participant 7 messages Nov 21, 2006

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover Remove global slab cache declarations from slab.h

One of the strange issues in slab.h is that it contains a list of global slab caches. The following patches remove all the global definitions from slab.h into #include <linux/*> files where related information is defined.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw

PATCH 1/6 Move sighand_cachep to include/signal.h

Move sighand_cachep definitioni to linux/signal.h

The sighand cache is only used in fs/exec.c and kernel/fork.c. It is defined in kernel/fork.c but only used in fs/exec.c.

The sighand_cachep is related to signal processing. So add the definition to signal.h.

include/linux/slab.h +0 -1
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -302,7 +302,6 @@ extern kmem_cache_t	*names_cachep;
 extern kmem_cache_t	*files_cachep;
 extern kmem_cache_t	*filp_cachep;
 extern kmem_cache_t	*fs_cachep;
-extern kmem_cache_t	*sighand_cachep;
 
 #endif	/* __KERNEL__ */
 
include/linux/signal.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/signal.h
===================================================================
@@ -241,6 +241,8 @@ extern int sigprocmask(int, sigset_t *, 
 struct pt_regs;
 extern int get_signal_to_deliver(siginfo_t *info, struct k_sigaction *return_ka, struct pt_regs *regs, void *cookie);
 
+extern struct kmem_cache *sighand_cachep;
+
 #endif /* __KERNEL__ */
 
 #endif /* _LINUX_SIGNAL_H */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw

PATCH 2/6 Move vm_area_cachep to include/mm.h

In reply to Christoph Lameter

Move vm_area_cachep to linux/mm.h

vm_area_cachep is used to store vm_area_structs. So move to mm.h.

include/linux/mm.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/mm.h
===================================================================
@@ -114,6 +114,8 @@ struct vm_area_struct {
 #endif
 };
 
+extern struct kmem_cache *vm_area_cachep;
+
 /*
  * This struct defines the per-mm list of VMAs for uClinux. If CONFIG_MMU is
  * disabled, then there's a single shared list of VMAs maintained by the
include/linux/slab.h +0 -1
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -297,7 +297,6 @@ static inline void kmem_set_shrinker(kme
 #endif /* CONFIG_SLOB */
 
 /* System wide caches */
-extern kmem_cache_t	*vm_area_cachep;
 extern kmem_cache_t	*names_cachep;
 extern kmem_cache_t	*files_cachep;
 extern kmem_cache_t	*filp_cachep;

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#3 lore raw

PATCH 3/6 Move files_cachep to include/file.h

In reply to Christoph Lameter

Move files_cachep to linux/file.h

Proper place is in file.h since files_cachep uses are rated to file I/O.

include/linux/file.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/file.h
===================================================================
@@ -101,4 +101,6 @@ struct files_struct *get_files_struct(st
 void FASTCALL(put_files_struct(struct files_struct *fs));
 void reset_files_struct(struct task_struct *, struct files_struct *);
 
+extern struct kmem_cache *files_cachep;
+
 #endif /* __LINUX_FILE_H */
include/linux/slab.h +0 -1
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -298,7 +298,6 @@ static inline void kmem_set_shrinker(kme
 
 /* System wide caches */
 extern kmem_cache_t	*names_cachep;
-extern kmem_cache_t	*files_cachep;
 extern kmem_cache_t	*filp_cachep;
 extern kmem_cache_t	*fs_cachep;
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#4 lore raw

PATCH 4/6 Move filep_cachep to include/file.h

In reply to Christoph Lameter

Move filp_cachep to linux/file.h

filp_cachep is only used in fs/file_table.c and in fs/dcache.c where it is defined.

Move it to related definitions in linux/file.h.

include/linux/slab.h +0 -1
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -298,7 +298,6 @@ static inline void kmem_set_shrinker(kme
 
 /* System wide caches */
 extern kmem_cache_t	*names_cachep;
-extern kmem_cache_t	*filp_cachep;
 extern kmem_cache_t	*fs_cachep;
 
 #endif	/* __KERNEL__ */
include/linux/file.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/file.h
===================================================================
@@ -57,6 +57,8 @@ struct files_struct {
 
 #define files_fdtable(files) (rcu_dereference((files)->fdt))
 
+extern struct kmem_cache *filp_cachep;
+
 extern void FASTCALL(__fput(struct file *));
 extern void FASTCALL(fput(struct file *));
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw

PATCH 5/6 Move fs_cachep to linux/fs_struct.h

In reply to Christoph Lameter

Move fs_cachep declaration to linux/fs_struct.h.

fs_cachep is only used in kernel/exit.c and in kernel/fork.c.

It is used to store fs_struct items so it should be placed in linux/fs_struct.h

include/linux/slab.h +0 -1
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -298,7 +298,6 @@ static inline void kmem_set_shrinker(kme
 
 /* System wide caches */
 extern kmem_cache_t	*names_cachep;
-extern kmem_cache_t	*fs_cachep;
 
 #endif	/* __KERNEL__ */
 
include/linux/fs_struct.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/fs_struct.h
===================================================================
@@ -18,6 +18,8 @@ struct fs_struct {
 	.umask		= 0022, \
 }
 
+extern struct kmem_cache *fs_cachep;
+
 extern void exit_fs(struct task_struct *);
 extern void set_fs_altroot(void);
 extern void set_fs_root(struct fs_struct *, struct vfsmount *, struct dentry *);

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#6 lore raw

PATCH 6/6 Move names_cachep to linux/fs.h

In reply to Christoph Lameter

Move names_cachep to linux/fs.h

The names_cachep is used for getname() and putname(). So lets put it into fs.h near those two definitions.

include/linux/slab.h +0 -3
Index: linux-2.6.19-rc5-mm2/include/linux/slab.h
===================================================================
@@ -296,9 +297,6 @@ static inline void kmem_set_shrinker(kme
 
 #endif /* CONFIG_SLOB */
 
-/* System wide caches */
-extern kmem_cache_t	*names_cachep;
-
 #endif	/* __KERNEL__ */
 
 #endif	/* _LINUX_SLAB_H */
include/linux/fs.h +2 -0
Index: linux-2.6.19-rc5-mm2/include/linux/fs.h
===================================================================
@@ -1558,6 +1558,8 @@ extern char * getname(const char __user 
 extern void __init vfs_caches_init_early(void);
 extern void __init vfs_caches_init(unsigned long);
 
+extern struct kmem_cache *names_cachep;
+
 #define __getname()	kmem_cache_alloc(names_cachep, SLAB_KERNEL)
 #define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
 #ifndef CONFIG_AUDITSYSCALL

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>