ia64/xen-unstable

changeset 91:9ff45074c48b

bitkeeper revision 1.15.1.3 (3e2740b4N6EIhunx8TNDamYotuhmMg)

dump_slabinfo debugging - fix to previous patch...
author iap10@labyrinth.cl.cam.ac.uk
date Thu Jan 16 23:31:00 2003 +0000 (2003-01-16)
parents ef4c30e20156
children f295e57142a0
files xen-2.4.16/common/slab.c
line diff
     1.1 --- a/xen-2.4.16/common/slab.c	Thu Jan 16 21:20:02 2003 +0000
     1.2 +++ b/xen-2.4.16/common/slab.c	Thu Jan 16 23:31:00 2003 +0000
     1.3 @@ -1837,3 +1837,109 @@ out:
     1.4  	return ret;
     1.5  }
     1.6  
     1.7 +void dump_slabinfo()
     1.8 +{
     1.9 +	struct list_head *p;
    1.10 +        unsigned long spin_flags;
    1.11 +
    1.12 +	/* Output format version, so at least we can change it without _too_
    1.13 +	 * many complaints.
    1.14 +	 */
    1.15 +	printk( "slabinfo - version: 1.1"
    1.16 +#if STATS
    1.17 +				" (statistics)"
    1.18 +#endif
    1.19 +#ifdef CONFIG_SMP
    1.20 +				" (SMP)"
    1.21 +#endif
    1.22 +				"\n");
    1.23 +	down(&cache_chain_sem);
    1.24 +	p = &cache_cache.next;
    1.25 +	do {
    1.26 +		kmem_cache_t	*cachep;
    1.27 +		struct list_head *q;
    1.28 +		slab_t		*slabp;
    1.29 +		unsigned long	active_objs;
    1.30 +		unsigned long	num_objs;
    1.31 +		unsigned long	active_slabs = 0;
    1.32 +		unsigned long	num_slabs;
    1.33 +		cachep = list_entry(p, kmem_cache_t, next);
    1.34 +
    1.35 +		spin_lock_irq(&cachep->spinlock);
    1.36 +		active_objs = 0;
    1.37 +		num_slabs = 0;
    1.38 +		list_for_each(q,&cachep->slabs_full) {
    1.39 +			slabp = list_entry(q, slab_t, list);
    1.40 +			if (slabp->inuse != cachep->num)
    1.41 +				BUG();
    1.42 +			active_objs += cachep->num;
    1.43 +			active_slabs++;
    1.44 +		}
    1.45 +		list_for_each(q,&cachep->slabs_partial) {
    1.46 +			slabp = list_entry(q, slab_t, list);
    1.47 +			if (slabp->inuse == cachep->num || !slabp->inuse)
    1.48 +				BUG();
    1.49 +			active_objs += slabp->inuse;
    1.50 +			active_slabs++;
    1.51 +		}
    1.52 +		list_for_each(q,&cachep->slabs_free) {
    1.53 +			slabp = list_entry(q, slab_t, list);
    1.54 +			if (slabp->inuse)
    1.55 +				BUG();
    1.56 +			num_slabs++;
    1.57 +		}
    1.58 +		num_slabs+=active_slabs;
    1.59 +		num_objs = num_slabs*cachep->num;
    1.60 +
    1.61 +		printk("%-17s %6lu %6lu %6u %4lu %4lu %4u",
    1.62 +			cachep->name, active_objs, num_objs, cachep->objsize,
    1.63 +			active_slabs, num_slabs, (1<<cachep->gfporder));
    1.64 +
    1.65 +#if STATS
    1.66 +		{
    1.67 +			unsigned long errors = cachep->errors;
    1.68 +			unsigned long high = cachep->high_mark;
    1.69 +			unsigned long grown = cachep->grown;
    1.70 +			unsigned long reaped = cachep->reaped;
    1.71 +			unsigned long allocs = cachep->num_allocations;
    1.72 +
    1.73 +			printk(" : %6lu %7lu %5lu %4lu %4lu",
    1.74 +					high, allocs, grown, reaped, errors);
    1.75 +		}
    1.76 +#endif
    1.77 +#ifdef CONFIG_SMP
    1.78 +		{
    1.79 +			unsigned int batchcount = cachep->batchcount;
    1.80 +			unsigned int limit;
    1.81 +
    1.82 +			if (cc_data(cachep))
    1.83 +				limit = cc_data(cachep)->limit;
    1.84 +			 else
    1.85 +				limit = 0;
    1.86 +			printk(" : %4u %4u",
    1.87 +					limit, batchcount);
    1.88 +		}
    1.89 +#endif
    1.90 +#if STATS && defined(CONFIG_SMP)
    1.91 +		{
    1.92 +			unsigned long allochit = atomic_read(&cachep->allochit);
    1.93 +			unsigned long allocmiss = atomic_read(&cachep->allocmiss);
    1.94 +			unsigned long freehit = atomic_read(&cachep->freehit);
    1.95 +			unsigned long freemiss = atomic_read(&cachep->freemiss);
    1.96 +			printk(" : %6lu %6lu %6lu %6lu",
    1.97 +					allochit, allocmiss, freehit, freemiss);
    1.98 +		}
    1.99 +#endif
   1.100 +		printk("\n");
   1.101 +		spin_unlock_irq(&cachep->spinlock);
   1.102 +
   1.103 +		p = cachep->next.next;
   1.104 +	} while (p != &cache_cache.next);
   1.105 +
   1.106 +	up(&cache_chain_sem);
   1.107 +
   1.108 +	return;
   1.109 +}
   1.110 +
   1.111 +
   1.112 +