Using allocpercpu removes the needs for the per cpu arrays in the kmem_cache struct.
These could get quite big if we have to support system of up to thousands of cpus.
The use of alloc_percpu means that:
1. The size of kmem_cache for SMP configuration shrinks since we will only
need 1 pointer instead of NR_CPUS. The same pointer can be used by all
processors. Reduces cache footprint of the allocator.
2. We can dynamically size kmem_cache according to the actual nodes in the
system meaning less memory overhead for configurations that may potentially
support up to 1k NUMA nodes.
3. We can remove the diddle widdle with allocating and releasing kmem_cache_cpu
structures when bringing up and shuttting down cpus. The allocpercpu
logic will do it all for us.
4. Fastpath performance increases by another 20% vs. the earlier improvements.
Instead of having fastpath with 40-50 cycles we are now in the 30-40 range.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
include/linux/slub_def.h | 11 ++--
mm/slub.c | 125 ++++-------------------------------------------
2 files changed, 18 insertions(+), 118 deletions(-)
Index: linux-2.6/include/linux/slub_def.h
===================================================================
--- linux-2.6.orig/include/linux/slub_def.h 2007-10-30 16:34:41.000000000 -0700
+++ linux-2.6/include/linux/slub_def.h 2007-10-31 09:23:26.000000000 -0700
@@ -34,6 +34,12 @@ struct kmem_cache_node {
* Slab cache management.
*/
struct kmem_cache {
+#ifdef CONFIG_SMP
+ /* Per cpu pointer usable for any cpu */
+ struct kmem_cache_cpu *cpu_slab;
+#else
+ struct kmem_cache_cpu cpu_slab;
+#endif
/* Used for retriving partial slabs etc */
unsigned long flags;
int size; /* The size of an object including meta data */
@@ -63,11 +69,6 @@ struct kmem_cache {
int defrag_ratio;
struct kmem_cache_node *node[MAX_NUMNODES];
#endif
-#ifdef CONFIG_SMP
- struct kmem_cache_cpu *cpu_slab[NR_CPUS];
-#else
- struct ...d_path() is used on a <dentry,vfsmount> pair. Lets use a struct path to
reflect this.
Signed-off-by: Jan Blunck <jblunck@suse.de>
---
drivers/md/bitmap.c | 8 +-------
drivers/usb/gadget/file_storage.c | 3 +--
fs/compat_ioctl.c | 2 +-
fs/dcache.c | 12 +++++-------
fs/dcookies.c | 2 +-
fs/ecryptfs/super.c | 5 ++---
fs/nfsd/export.c | 3 ++-
fs/proc/base.c | 2 +-
fs/seq_file.c | 4 +++-
fs/sysfs/file.c | 5 ++---
fs/unionfs/super.c | 3 +--
include/linux/dcache.h | 5 +++--
kernel/audit.c | 2 +-
13 files changed, 24 insertions(+), 32 deletions(-)
Index: b/drivers/md/bitmap.c
===================================================================
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -206,16 +206,10 @@ static void bitmap_checkfree(struct bitm
/* copy the pathname of a file to a buffer */
char *file_path(struct file *file, char *buf, int count)
{
- struct dentry *d;
- struct vfsmount *v;
-
if (!buf)
return NULL;
- d = file->f_path.dentry;
- v = file->f_path.mnt;
-
- buf = d_path(d, v, buf, count);
+ buf = d_path(&file->f_path, buf, count);
return IS_ERR(buf) ? NULL : buf;
}
Index: b/drivers/usb/gadget/file_storage.c
===================================================================
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3567,8 +3567,7 @@ static ssize_t show_file(struct device *
down_read(&fsg->filesem);
if (backing_file_is_open(curlun)) { // Get the complete pathname
- p = d_path(curlun->filp->f_path.dentry,
- curlun->filp->f_path.mnt, buf, PAGE_SIZE - 1);
+ p = d_path(&curlun->filp->f_path, buf, PAGE_SIZE - 1);
if (IS_ERR(p))
rc = PTR_ERR(p);
else {
Index: ...Did you miss the d_path() caller arch/blackfin/kernel/traps.c:printk_address() ? Regards, Bharata. -- "Men come and go but mountains remain" -- Ruskin Bond. -
Yes, I remember I saw that before. Please send patch again. -Bryan Wu -
d_path() is used on a <dentry,vfsmount> pair. Lets use a struct path to
reflect this.
Signed-off-by: Jan Blunck <jblunck@suse.de>
---
arch/blackfin/kernel/traps.c | 12 +++++-------
drivers/md/bitmap.c | 8 +-------
drivers/usb/gadget/file_storage.c | 8 +++-----
fs/compat_ioctl.c | 2 +-
fs/dcache.c | 12 +++++-------
fs/dcookies.c | 2 +-
fs/ecryptfs/super.c | 5 ++---
fs/nfsd/export.c | 3 ++-
fs/proc/base.c | 2 +-
fs/seq_file.c | 4 +++-
fs/sysfs/file.c | 5 ++---
fs/unionfs/super.c | 3 +--
include/linux/dcache.h | 5 +++--
kernel/audit.c | 2 +-
14 files changed, 31 insertions(+), 42 deletions(-)
Index: b/arch/blackfin/kernel/traps.c
===================================================================
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -98,15 +98,13 @@ static int printk_address(unsigned long
struct vm_area_struct *vma = vml->vma;
if (address >= vma->vm_start && address < vma->vm_end) {
+ char _tmpbuf[256];
char *name = p->comm;
struct file *file = vma->vm_file;
- if (file) {
- char _tmpbuf[256];
- name = d_path(file->f_dentry,
- file->f_vfsmnt,
- _tmpbuf,
- sizeof(_tmpbuf));
- }
+
+ if (file)
+ name = d_path(&file->f_path, _tmpbuf,
+ sizeof(_tmpbuf));
/* FLAT does not have its text aligned to the start of
* the map while FDPIC ELF does ...
Index: b/drivers/md/bitmap.c
===================================================================
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -206,16 +206,10 @@ static void bitmap_checkfree(struct bitm
/* copy the pathname of a file to a buffer */
char *file_path(struct file *file, char *buf, int ...