linux/lib/debugobjects.c
<<
" /spaon> /formn> a " href="../linux+v3.6/lib/debugobjects.c">" img src="../.static/gfx/right.png" alt=">>">" /spaon>" spao class="lxr_search">" " input typue=hidden" namue=navtarget" value=">" input typue=text" namue=search" ide=search">" buttiontypue=submit">Search /formn> /spaon>" spao class="lxr_prefs"n> a href="+prefs?return=lib/debugobjects.c"" onclick="return ajax_prefs();">" Prefs> /a>" /spaon> /divn> form acptio="ajax+*" method="post" onsubmit="return false;">" input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">" /formn>" div class="headingbottim"> div ide=search_results" class="search_results"> n> /divn> div ide=content">> div ide=file_contents"n
   1 /a> spao class="comment">/* /spaon>   2 /a> spao class="comment"> * Generic infrastructure for lifetime debugging of objects. /spaon>   3 /a> spao class="comment"> * /spaon>   4 /a> spao class="comment"> * Started by Thomas Gleixner /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> * Copyright (C) 2008, Thomas Gleixner <tglx@linutronix.de> /spaon>   7 /a> spao class="comment"> * /spaon>   8 /a> spao class="comment"> * For licencing details see kernel-base/COPYING /spaon>   9 /a> spao class="comment"> */ /spaon>  n vaa>#include <linux/debugobjects.hvaa>>>  11vaa>#include <linux/interrupt.hvaa>>>  12vaa>#include <linux/sched.hvaa>>>  13vaa>#include <linux/seq_file.hvaa>>>  14vaa>#include <linux/debugfs.hvaa>>>  15vaa>#include <linux/slab.hvaa>>>  16vaa>#include <linux/hash.hvaa>>>  17 /a>>  18 /a>#define  a href="+code=ODEBUG_HASH_BITS" class="sref">ODEBUG_HASH_BITS /a>        14>  19 /a>#define  a href="+code=ODEBUG_HASH_SIZE" class="sref">ODEBUG_HASH_SIZE /a>        (1 <<  a href="+code=ODEBUG_HASH_BITS" class="sref">ODEBUG_HASH_BITS /a>)>  20 /a>>  21 /a>#define  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>        512>  22 /a>#define  a href="+code=ODEBUG_POOL_MIN_LEVEL" class="sref">ODEBUG_POOL_MIN_LEVEL /a>   256>  23 /a>>  24 /a>#define  a href="+code=ODEBUG_CHUNK_SHIFT" class="sref">ODEBUG_CHUNK_SHIFT /a>       a href="+code=PAGE_SHIFT" class="sref">PAGE_SHIFT /a>>  25 /a>#define  a href="+code=ODEBUG_CHUNK_SIZE" class="sref">ODEBUG_CHUNK_SIZE /a>       (1 <<  a href="+code=ODEBUG_CHUNK_SHIFT" class="sref">ODEBUG_CHUNK_SHIFT /a>)>  26 /a>#define  a href="+code=ODEBUG_CHUNK_MASK" class="sref">ODEBUG_CHUNK_MASK /a>       (~( a href="+code=ODEBUG_CHUNK_SIZE" class="sref">ODEBUG_CHUNK_SIZE /a> - 1))>  27 /a>>  28 /a>struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> {>  29 /a>        struct  a href="+code=hlist_head" class="sref">hlist_head /a>        a href="+code=list" class="sref">list /a>;>  30 /a>         a href="+code=raw_spinlock_t" class="sref">raw_spinlock_t /a>           a href="+code=lock" class="sref">lock /a>;>  31 /a>};>  32 /a>>  33 /a>static struct  a href="+code=debug_bucket" class="sref">debug_bucket /a>       a href="+code=obj_hash" class="sref">obj_hash /a>[ a href="+code=ODEBUG_HASH_SIZE" class="sref">ODEBUG_HASH_SIZE /a>];>  34 /a>>  35 /a>static struct  a href="+code=debug_obj" class="sref">debug_obj /a>          a href="+code=obj_static_pool" class="sref">obj_static_pool /a>[ a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>]  a href="+code=__initdata" class="sref">__initdata /a>;>  36 /a>>  37 /a>static  a href="+code=DEFINE_RAW_SPINLOCK" class="sref">DEFINE_RAW_SPINLOCK /a>( a href="+code=pool_lock" class="sref">pool_lock /a>);>  38 /a>>  39 /a>static  a href="+code=HLIST_HEAD" class="sref">HLIST_HEAD /a>( a href="+code=obj_pool" class="sref">obj_pool /a>);>  40 /a>>  41 /a>static int                       a href="+code=obj_pool_min_free" class="sref">obj_pool_min_free /a> =  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>;>  42 /a>static int                       a href="+code=obj_pool_free" class="sref">obj_pool_free /a> =  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>;>  43 /a>static int                       a href="+code=obj_pool_used" class="sref">obj_pool_used /a>;>  44 /a>static int                       a href="+code=obj_pool_max_used" class="sref">obj_pool_max_used /a>;>  45 /a>static struct  a href="+code=kmem_cache" class="sref">kmem_cache /a>        * a href="+code=obj_cache" class="sref">obj_cache /a>;>  46 /a>>  47 /a>static int                       a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  48 /a>static int                       a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  49 /a>static int                       a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  50 /a>static int                       a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>  a href="+code=__read_mostly" class="sref">__read_mostly /a>>  51 /a>                                =  a href="+code=CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT" class="sref">CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT /a>;>  52 /a>>  53 /a>static struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a>   * a href="+code=descr_test" class="sref">descr_test /a>   a href="+code=__read_mostly" class="sref">__read_mostly /a>;>  54 /a>>  55 /a>static void  a href="+code=free_obj_work" class="sref">free_obj_work /a>(struct  a href="+code=work_struct" class="sref">work_struct /a> * a href="+code=work" class="sref">work /a>);>  56 /a>static  a href="+code=DECLARE_WORK" class="sref">DECLARE_WORK /a>( a href="+code=debug_obj_work" class="sref">debug_obj_work /a>,  a href="+code=free_obj_work" class="sref">free_obj_work /a>);>  57 /a>>  58 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=enable_object_debug" class="sref">enable_object_debug /a>(char * a href="+code=str" class="sref">str /a>)>  59 /a>{>  60 /a>         a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a> = 1;>  61 /a>        return 0;>  62 /a>}>  63 /a>>  64 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=disable_object_debug" class="sref">disable_object_debug /a>(char * a href="+code=str" class="sref">str /a>)>  65 /a>{>  66 /a>         a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a> = 0;>  67 /a>        return 0;>  68 /a>}>  69 /a>>  70 /a> a href="+code=early_param" class="sref">early_param /a>( spao class="string">"debug_objects" /spaon,  a href="+code=enable_object_debug" class="sref">enable_object_debug /a>);>  71 /a> a href="+code=early_param" class="sref">early_param /a>( spao class="string">"no_debug_objects" /spaon,  a href="+code=disable_object_debug" class="sref">disable_object_debug /a>);>  72 /a>>  73 /a>static const char * a href="+code=obj_states" class="sref">obj_states /a>[ a href="+code=ODEBUG_STATE_MAX" class="sref">ODEBUG_STATE_MAX /a>] = {>  74 /a>        [ a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>]             =  spao class="string">"none" /spaon,>  75 /a>        [ a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>]             =  spao class="string">"initialized" /spaon,>  76 /a>        [ a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>]         =  spao class="string">"inacptve" /spaon,>  77 /a>        [ a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>]           =  spao class="string">"acptve" /spaon,>  78 /a>        [ a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>]        =  spao class="string">"destroyed" /spaon,>  79 /a>        [ a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>]     =  spao class="string">"not available" /spaon,>  80 /a>};>  81 /a>>  82 /a>static void  a href="+code=fill_pool" class="sref">fill_pool /a>(void)>  83 /a>{>  84 /a>         a href="+code=gfp_t" class="sref">gfp_t /a>  a href="+code=gfp" class="sref">gfp /a> =  a href="+code=GFP_ATOMIC" class="sref">GFP_ATOMIC /a> |  a href="+code=__GFP_NORETRY" class="sref">__GFP_NORETRY /a> |  a href="+code=__GFP_NOWARN" class="sref">__GFP_NOWARN /a>;>  85 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=new" class="sref">new /a>;>  86 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;>  87 /a>>  88 /a>        if ( a href="+code=likely" class="sref">likely /a>( a href="+code=obj_pool_free" class="sref">obj_pool_free /a> >=  a href="+code=ODEBUG_POOL_MIN_LEVEL" class="sref">ODEBUG_POOL_MIN_LEVEL /a>))>  89 /a>                return;>  90 /a>>  91 /a>        if ( a href="+code=unlikely" class="sref">unlikely /a>(! a href="+code=obj_cache" class="sref">obj_cache /a>))>  92 /a>                return;>  93 /a>>  94 /a>        while ( a href="+code=obj_pool_free" class="sref">obj_pool_free /a> <  a href="+code=ODEBUG_POOL_MIN_LEVEL" class="sref">ODEBUG_POOL_MIN_LEVEL /a>) {>  95 /a>>  96 /a>                 a href="+code=new" class="sref">new /a> =  a href="+code=kmem_cache_zalloc" class="sref">kmem_cache_zalloc /a>( a href="+code=obj_cache" class="sref">obj_cache /a>,  a href="+code=gfp" class="sref">gfp /a>);>  97 /a>                if (! a href="+code=new" class="sref">new /a>)>  98 /a>                        return;>  99 /a>> 100 /a>                 a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 101 /a>                 a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=new" class="sref">new /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=obj_pool" class="sref">obj_pool /a>);> 102 /a>                 a href="+code=obj_pool_free" class="sref">obj_pool_free /a>++;> 103 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 104 /a>        }> 105 /a>}> 106 /a>> 107 /a> spao class="comment">/* /spaon> 108 /a> spao class="comment"> * Lookup ao object in the hash bucket. /spaon> 109 /a> spao class="comment"> */ /spaon> 110 /a>static struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=lookup_object" class="sref">lookup_object /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=b" class="sref">b /a>)> 111vaa>{> 112 /a>        struct  a href="+code=hlist_node" class="sref">hlist_node /a> * a href="+code=node" class="sref">node /a>;> 113 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 114 /a>        int  a href="+code=cnt" class="sref">cnt /a> = 0;> 115 /a>> 116 /a>         a href="+code=hlist_for_each_entry" class="sref">hlist_for_each_entry /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>, & a href="+code=b" class="sref">b /a>-> a href="+code=list" class="sref">list /a>,  a href="+code=node" class="sref">node /a>) {> 117 /a>                 a href="+code=cnt" class="sref">cnt /a>++;> 118 /a>                if ( a href="+code=obj" class="sref">obj /a>-> a href="+code=object" class="sref">object /a> ==  a href="+code=addr" class="sref">addr /a>)> 119 /a>                        return  a href="+code=obj" class="sref">obj /a>;> 120 /a>        }> 121 /a>        if ( a href="+code=cnt" class="sref">cnt /a> >  a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a>)> 122 /a>                 a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a> =  a href="+code=cnt" class="sref">cnt /a>;> 123 /a>> 124 /a>        return  a href="+code=NULL" class="sref">NULL /a>;> 125 /a>}> 126 /a>> 127 /a> spao class="comment">/* /spaon> 128 /a> spao class="comment"> * Allocate a new object. If the pool is empty, switch off the debugger. /spaon> 129 /a> spao class="comment"> * Must be called with interrupts disabled. /spaon> 130 /a> spao class="comment"> */ /spaon> 131 /a>static struct  a href="+code=debug_obj" class="sref">debug_obj /a> *> 132 /a> a href="+code=alloc_object" class="sref">alloc_object /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=b" class="sref">b /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 133 /a>{> 134 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a> =  a href="+code=NULL" class="sref">NULL /a>;> 135 /a>> 136 /a>         a href="+code=raw_spin_lock" class="sref">raw_spin_lock /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>);> 137 /a>        if ( a href="+code=obj_pool" class="sref">obj_pool /a>. a href="+code=first" class="sref">first /a>) {> 138 /a>                 a href="+code=obj" class="sref">obj /a>         =  a href="+code=hlist_entry" class="sref">hlist_entry /a>( a href="+code=obj_pool" class="sref">obj_pool /a>. a href="+code=first" class="sref">first /a>,  a href="+code=typuof" class="sref">typuof /a>(* a href="+code=obj" class="sref">obj /a>),  a href="+code=node" class="sref">node /a>);> 139 /a>> 140 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=object" class="sref">object /a> =  a href="+code=addr" class="sref">addr /a>;> 141 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=descr" class="sref">descr /a>  =  a href="+code=descr" class="sref">descr /a>;> 142 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>  =  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>;> 143 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=astate" class="sref">astate /a> = 0;> 144 /a>                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 145 /a>> 146 /a>                 a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=b" class="sref">b /a>-> a href="+code=list" class="sref">list /a>);> 147 /a>> 148 /a>                 a href="+code=obj_pool_used" class="sref">obj_pool_used /a>++;> 149 /a>                if ( a href="+code=obj_pool_used" class="sref">obj_pool_used /a> >  a href="+code=obj_pool_max_used" class="sref">obj_pool_max_used /a>)> 150 /a>                         a href="+code=obj_pool_max_used" class="sref">obj_pool_max_used /a> =  a href="+code=obj_pool_used" class="sref">obj_pool_used /a>;> 151 /a>> 152 /a>                 a href="+code=obj_pool_free" class="sref">obj_pool_free /a>--;> 153 /a>                if ( a href="+code=obj_pool_free" class="sref">obj_pool_free /a> <  a href="+code=obj_pool_min_free" class="sref">obj_pool_min_free /a>)> 154 /a>                         a href="+code=obj_pool_min_free" class="sref">obj_pool_min_free /a> =  a href="+code=obj_pool_free" class="sref">obj_pool_free /a>;> 155 /a>        }> 156 /a>         a href="+code=raw_spin_unlock" class="sref">raw_spin_unlock /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>);> 157 /a>> 158 /a>        return  a href="+code=obj" class="sref">obj /a>;> 159 /a>}> 160 /a>> 161 /a> spao class="comment">/* /spaon> 162 /a> spao class="comment"> * workqueue funcptio to free objects. /spaon> 163 /a> spao class="comment"> */ /spaon> 164 /a>static void  a href="+code=free_obj_work" class="sref">free_obj_work /a>(struct  a href="+code=work_struct" class="sref">work_struct /a> * a href="+code=work" class="sref">work /a>)> 165 /a>{> 166 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 167 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 168 /a>> 169 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 170 /a>        while ( a href="+code=obj_pool_free" class="sref">obj_pool_free /a> >  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>) {> 171 /a>                 a href="+code=obj" class="sref">obj /a> =  a href="+code=hlist_entry" class="sref">hlist_entry /a>( a href="+code=obj_pool" class="sref">obj_pool /a>. a href="+code=first" class="sref">first /a>,  a href="+code=typuof" class="sref">typuof /a>(* a href="+code=obj" class="sref">obj /a>),  a href="+code=node" class="sref">node /a>);> 172 /a>                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 173 /a>                 a href="+code=obj_pool_free" class="sref">obj_pool_free /a>--;> 174 /a>                 spao class="comment">/* /spaon> 175 /a> spao class="comment">                 * We release pool_lock across kmem_cache_free() to /spaon> 176 /a> spao class="comment">                 * avoid contenttio io pool_lock. /spaon> 177 /a> spao class="comment">                 */ /spaon> 178 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 179 /a>                 a href="+code=kmem_cache_free" class="sref">kmem_cache_free /a>( a href="+code=obj_cache" class="sref">obj_cache /a>,  a href="+code=obj" class="sref">obj /a>);> 180 /a>                 a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 181 /a>        }> 182 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 183 /a>}> 184 /a>> 185 /a> spao class="comment">/* /spaon> 186 /a> spao class="comment"> * Put the object back into the pool and schedule work to free objects /spaon> 187 /a> spao class="comment"> * if necessary. /spaon> 188 /a> spao class="comment"> */ /spaon> 189 /a>static void  a href="+code=free_object" class="sref">free_object /a>(struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>)> 190 /a>{> 191 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 192 /a>        int  a href="+code=sched" class="sref">sched /a> = 0;> 193 /a>> 194 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 195 /a>         spao class="comment">/* /spaon> 196 /a> spao class="comment">         * schedule work when the pool is filled and the cache is /spaon> 197 /a> spao class="comment">         * initialized: /spaon> 198 /a> spao class="comment">         */ /spaon> 199 /a>        if ( a href="+code=obj_pool_free" class="sref">obj_pool_free /a> >  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a> &&  a href="+code=obj_cache" class="sref">obj_cache /a>)> 200 /a>                 a href="+code=sched" class="sref">sched /a> =  a href="+code=keventd_up" class="sref">keventd_up /a>() && ! a href="+code=work_pending" class="sref">work_pending /a>(& a href="+code=debug_obj_work" class="sref">debug_obj_work /a>);> 201 /a>         a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=obj_pool" class="sref">obj_pool /a>);> 202 /a>         a href="+code=obj_pool_free" class="sref">obj_pool_free /a>++;> 203 /a>         a href="+code=obj_pool_used" class="sref">obj_pool_used /a>--;> 204 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=pool_lock" class="sref">pool_lock /a>,  a href="+code=flags" class="sref">flags /a>);> 205 /a>        if ( a href="+code=sched" class="sref">sched /a>)> 206 /a>                 a href="+code=schedule_work" class="sref">schedule_work /a>(& a href="+code=debug_obj_work" class="sref">debug_obj_work /a>);> 207 /a>}> 208 /a>> 209 /a> spao class="comment">/* /spaon> 210 /a> spao class="comment"> * We run out of memory. That means we probably have tons of objects /spaon> 211 /a> spao class="comment"> * allocated. /spaon> 212 /a> spao class="comment"> */ /spaon> 213 /a>static void  a href="+code=debug_objects_oom" class="sref">debug_objects_oom /a>(void)> 214 /a>{> 215 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a> =  a href="+code=obj_hash" class="sref">obj_hash /a>;> 216 /a>        struct  a href="+code=hlist_node" class="sref">hlist_node /a> * a href="+code=node" class="sref">node /a>, * a href="+code=tmp" class="sref">tmp /a>;> 217 /a>         a href="+code=HLIST_HEAD" class="sref">HLIST_HEAD /a>( a href="+code=freelist" class="sref">freelist /a>);> 218 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 219 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 220 /a>        int  a href="+code=i" class="sref">i /a>;> 221 /a>> 222 /a>         a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_WARNING" class="sref">KERN_WARNING /a>  spao class="string">"ODEBUG: Out of memory. ODEBUG disabled\n" /spaon);> 223 /a>> 224 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=ODEBUG_HASH_SIZE" class="sref">ODEBUG_HASH_SIZE /a>;  a href="+code=i" class="sref">i /a>++,  a href="+code=db" class="sref">db /a>++) {> 225 /a>                 a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 226 /a>                 a href="+code=hlist_move_list" class="sref">hlist_move_list /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=list" class="sref">list /a>, & a href="+code=freelist" class="sref">freelist /a>);> 227 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 228 /a>> 229 /a>                 spao class="comment">/* Now free them */ /spaon> 230 /a>                 a href="+code=hlist_for_each_entry_safe" class="sref">hlist_for_each_entry_safe /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>,  a href="+code=tmp" class="sref">tmp /a>, & a href="+code=freelist" class="sref">freelist /a>,  a href="+code=node" class="sref">node /a>) {> 231 /a>                         a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 232 /a>                         a href="+code=free_object" class="sref">free_object /a>( a href="+code=obj" class="sref">obj /a>);> 233 /a>                }> 234 /a>        }> 235 /a>}> 236 /a>> 237 /a> spao class="comment">/* /spaon> 238 /a> spao class="comment"> * We use the pfn of the address for the hash. That way we cao check /spaon> 239 /a> spao class="comment"> * for freed objects simply by checking the affected bucket. /spaon> 240 /a> spao class="comment"> */ /spaon> 241 /a>static struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=get_bucket" class="sref">get_bucket /a>(unsigned long  a href="+code=addr" class="sref">addr /a>)> 242 /a>{> 243 /a>        unsigned long  a href="+code=hash" class="sref">hash /a>;> 244 /a>> 245 /a>         a href="+code=hash" class="sref">hash /a> =  a href="+code=hash_long" class="sref">hash_long /a>(( a href="+code=addr" class="sref">addr /a> >>  a href="+code=ODEBUG_CHUNK_SHIFT" class="sref">ODEBUG_CHUNK_SHIFT /a>),  a href="+code=ODEBUG_HASH_BITS" class="sref">ODEBUG_HASH_BITS /a>);> 246 /a>        return & a href="+code=obj_hash" class="sref">obj_hash /a>[ a href="+code=hash" class="sref">hash /a>];> 247 /a>}> 248 /a>> 249 /a>static void  a href="+code=debug_print_object" class="sref">debug_print_object /a>(struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>, char * a href="+code=msg" class="sref">msg /a>)> 250 /a>{> 251 /a>        struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=descr" class="sref">descr /a>;> 252 /a>        static int  a href="+code=limit" class="sref">limit /a>;> 253 /a>> 254 /a>        if ( a href="+code=limit" class="sref">limit /a> < 5 &&  a href="+code=descr" class="sref">descr /a> !=  a href="+code=descr_test" class="sref">descr_test /a>) {> 255 /a>                void * a href="+code=hint" class="sref">hint /a> =  a href="+code=descr" class="sref">descr /a>-> a href="+code=debug_hint" class="sref">debug_hint /a> ?> 256 /a>                         a href="+code=descr" class="sref">descr /a>-> a href="+code=debug_hint" class="sref">debug_hint /a>( a href="+code=obj" class="sref">obj /a>-> a href="+code=object" class="sref">object /a>) :  a href="+code=NULL" class="sref">NULL /a>;> 257 /a>                 a href="+code=limit" class="sref">limit /a>++;> 258 /a>                 a href="+code=WARN" class="sref">WARN /a>(1,  a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"ODEBUG: %s %s (acptve state %u) " /spaon> 259 /a>                                  spao class="string">"object typu: %s hint: %pS\n" /spaon,> 260 /a>                         a href="+code=msg" class="sref">msg /a>,  a href="+code=obj_states" class="sref">obj_states /a>[ a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>],  a href="+code=obj" class="sref">obj /a>-> a href="+code=astate" class="sref">astate /a>,> 261 /a>                         a href="+code=descr" class="sref">descr /a>-> a href="+code=namu" class="sref">namu /a>,  a href="+code=hint" class="sref">hint /a>);> 262 /a>        }> 263 /a>         a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>++;> 264 /a>}> 265 /a>> 266 /a> spao class="comment">/* /spaon> 267 /a> spao class="comment"> * Try to repair the damage, so we have a better chance to get useful /spaon> 268 /a> spao class="comment"> * debug output. /spaon> 269 /a> spao class="comment"> */ /spaon> 270 /a>static int> 271 /a> a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>(int (* a href="+code=fixup" class="sref">fixup /a>)(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>),> 272 /a>                   void *  a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>)> 273 /a>{> 274 /a>        int  a href="+code=fixed" class="sref">fixed /a> = 0;> 275 /a>> 276 /a>        if ( a href="+code=fixup" class="sref">fixup /a>)> 277 /a>                 a href="+code=fixed" class="sref">fixed /a> =  a href="+code=fixup" class="sref">fixup /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=state" class="sref">state /a>);> 278 /a>         a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a> +=  a href="+code=fixed" class="sref">fixed /a>;> 279 /a>        return  a href="+code=fixed" class="sref">fixed /a>;> 280 /a>}> 281 /a>> 282 /a>static void  a href="+code=debug_object_is_on_stack" class="sref">debug_object_is_on_stack /a>(void * a href="+code=addr" class="sref">addr /a>, int  a href="+code=onstack" class="sref">onstack /a>)> 283 /a>{> 284 /a>        int  a href="+code=is_on_stack" class="sref">is_on_stack /a>;> 285 /a>        static int  a href="+code=limit" class="sref">limit /a>;> 286 /a>> 287 /a>        if ( a href="+code=limit" class="sref">limit /a> > 4)> 288 /a>                return;> 289 /a>> 290 /a>         a href="+code=is_on_stack" class="sref">is_on_stack /a> =  a href="+code=object_is_on_stack" class="sref">object_is_on_stack /a>( a href="+code=addr" class="sref">addr /a>);> 291 /a>        if ( a href="+code=is_on_stack" class="sref">is_on_stack /a> ==  a href="+code=onstack" class="sref">onstack /a>)> 292 /a>                return;> 293 /a>> 294 /a>         a href="+code=limit" class="sref">limit /a>++;> 295 /a>        if ( a href="+code=is_on_stack" class="sref">is_on_stack /a>)> 296 /a>                 a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_WARNING" class="sref">KERN_WARNING /a>> 297 /a>                        spao class="string">"ODEBUG: object is io stack, but not annotated\n" /spaon);> 298 /a>        else> 299 /a>                 a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_WARNING" class="sref">KERN_WARNING /a>> 300 /a>                        spao class="string">"ODEBUG: object is not io stack, but annotated\n" /spaon);> 301 /a>         a href="+code=WARN_ON" class="sref">WARN_ON /a>(1);> 302 /a>}> 303 /a>> 304 /a>static void> 305 /a> a href="+code=__debug_object_init" class="sref">__debug_object_init /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>, int  a href="+code=onstack" class="sref">onstack /a>)> 306 /a>{> 307 /a>        enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>;> 308 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 309 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 310 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 311 /a>> 312 /a>         a href="+code=fill_pool" class="sref">fill_pool /a>();> 313 /a>> 314 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 315 /a>> 316 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 317 /a>> 318 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 319 /a>        if (! a href="+code=obj" class="sref">obj /a>) {> 320 /a>                 a href="+code=obj" class="sref">obj /a> =  a href="+code=alloc_object" class="sref">alloc_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>,  a href="+code=descr" class="sref">descr /a>);> 321 /a>                if (! a href="+code=obj" class="sref">obj /a>) {> 322 /a>                         a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a> = 0;> 323 /a>                         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 324 /a>                         a href="+code=debug_objects_oom" class="sref">debug_objects_oom /a>();> 325 /a>                        return;> 326 /a>                }> 327 /a>                 a href="+code=debug_object_is_on_stack" class="sref">debug_object_is_on_stack /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=onstack" class="sref">onstack /a>);> 328 /a>        }> 329 /a>> 330 /a>        switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 331 /a>        case  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>:> 332 /a>        case  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>:> 333 /a>        case  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>:> 334 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>;> 335 /a>                break;> 336 /a>> 337 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 338 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"init" /spaon);> 339 /a>                 a href="+code=state" class="sref">state /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>;> 340 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 341 /a>                 a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_init" class="sref">fixup_init /a>,  a href="+code=addr" class="sref">addr /a>,  a href="+code=state" class="sref">state /a>);> 342 /a>                return;> 343 /a>> 344 /a>        case  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>:> 345 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"init" /spaon);> 346 /a>                break;> 347 /a>        default:> 348 /a>                break;> 349 /a>        }> 350 /a>> 351 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 352 /a>}> 353 /a>> 354 /a> spao class="comment">/** /spaon> 355 /a> spao class="comment"> * debug_object_init - debug checks when ao object is initialized /spaon> 356 /a> spao class="comment"> * @addr:       address of the object /spaon> 357 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 358 /a> spao class="comment"> */ /spaon> 359 /a>void  a href="+code=debug_object_init" class="sref">debug_object_init /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 360 /a>{> 361 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 362 /a>                return;> 363 /a>> 364 /a>         a href="+code=__debug_object_init" class="sref">__debug_object_init /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=descr" class="sref">descr /a>, 0);> 365 /a>}> 366 /a>> 367 /a> spao class="comment">/** /spaon> 368 /a> spao class="comment"> * debug_object_init_on_stack - debug checks when ao object io stack is /spaon> 369 /a> spao class="comment"> *                              initialized /spaon> 370 /a> spao class="comment"> * @addr:       address of the object /spaon> 371 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 372 /a> spao class="comment"> */ /spaon> 373 /a>void  a href="+code=debug_object_init_on_stack" class="sref">debug_object_init_on_stack /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 374 /a>{> 375 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 376 /a>                return;> 377 /a>> 378 /a>         a href="+code=__debug_object_init" class="sref">__debug_object_init /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=descr" class="sref">descr /a>, 1);> 379 /a>}> 380 /a>> 381 /a> spao class="comment">/** /spaon> 382 /a> spao class="comment"> * debug_object_acptvate - debug checks when ao object is acptvated /spaon> 383 /a> spao class="comment"> * @addr:       address of the object /spaon> 384 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 385 /a> spao class="comment"> */ /spaon> 386 /a>void  a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 387 /a>{> 388 /a>        enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>;> 389 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 390 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 391 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 392 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a>  a href="+code=o" class="sref">o /a> = { . a href="+code=object" class="sref">object /a> =  a href="+code=addr" class="sref">addr /a>,> 393 /a>                               . a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>,> 394 /a>                               . a href="+code=descr" class="sref">descr /a> =  a href="+code=descr" class="sref">descr /a> };> 395 /a>> 396 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 397 /a>                return;> 398 /a>> 399 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 400 /a>> 401 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 402 /a>> 403 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 404 /a>        if ( a href="+code=obj" class="sref">obj /a>) {> 405 /a>                switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 406 /a>                case  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>:> 407 /a>                case  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>:> 408 /a>                         a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>;> 409 /a>                        break;> 410 /a>> 411 /a>                case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 412 /a>                         a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"acptvate" /spaon);> 413 /a>                         a href="+code=state" class="sref">state /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>;> 414 /a>                         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 415 /a>                         a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_acptvate" class="sref">fixup_acptvate /a>,  a href="+code=addr" class="sref">addr /a>,  a href="+code=state" class="sref">state /a>);> 416 /a>                        return;> 417 /a>> 418 /a>                case  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>:> 419 /a>                         a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"acptvate" /spaon);> 420 /a>                        break;> 421 /a>                default:> 422 /a>                        break;> 423 /a>                }> 424 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 425 /a>                return;> 426 /a>        }> 427 /a>> 428 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 429 /a>         spao class="comment">/* /spaon> 430 /a> spao class="comment">         * This happens when a static object is acptvated. We /spaon> 431 /a> spao class="comment">         * let the typu specific code decide whether this is /spaon> 432 /a> spao class="comment">         * true or not. /spaon> 433 /a> spao class="comment">         */ /spaon> 434 /a>        if ( a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_acptvate" class="sref">fixup_acptvate /a>,  a href="+code=addr" class="sref">addr /a>,> 435 /a>                            a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>))> 436 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>(& a href="+code=o" class="sref">o /a>,  spao class="string">"acptvate" /spaon);> 437 /a>}> 438 /a>> 439 /a> spao class="comment">/** /spaon> 440 /a> spao class="comment"> * debug_object_deacptvate - debug checks when ao object is deacptvated /spaon> 441 /a> spao class="comment"> * @addr:       address of the object /spaon> 442 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 443 /a> spao class="comment"> */ /spaon> 444 /a>void  a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 445 /a>{> 446 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 447 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 448 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 449 /a>> 450 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 451 /a>                return;> 452 /a>> 453 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 454 /a>> 455 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 456 /a>> 457 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 458 /a>        if ( a href="+code=obj" class="sref">obj /a>) {> 459 /a>                switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 460 /a>                case  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>:> 461 /a>                case  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>:> 462 /a>                case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 463 /a>                        if (! a href="+code=obj" class="sref">obj /a>-> a href="+code=astate" class="sref">astate /a>)> 464 /a>                                 a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>;> 465 /a>                        else> 466 /a>                                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"deacptvate" /spaon);> 467 /a>                        break;> 468 /a>> 469 /a>                case  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>:> 470 /a>                         a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"deacptvate" /spaon);> 471 /a>                        break;> 472 /a>                default:> 473 /a>                        break;> 474 /a>                }> 475 /a>        } else {> 476 /a>                struct  a href="+code=debug_obj" class="sref">debug_obj /a>  a href="+code=o" class="sref">o /a> = { . a href="+code=object" class="sref">object /a> =  a href="+code=addr" class="sref">addr /a>,> 477 /a>                                       . a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>,> 478 /a>                                       . a href="+code=descr" class="sref">descr /a> =  a href="+code=descr" class="sref">descr /a> };> 479 /a>> 480 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>(& a href="+code=o" class="sref">o /a>,  spao class="string">"deacptvate" /spaon);> 481 /a>        }> 482 /a>> 483 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 484 /a>}> 485 /a>> 486 /a> spao class="comment">/** /spaon> 487 /a> spao class="comment"> * debug_object_destroy - debug checks when ao object is destroyed /spaon> 488 /a> spao class="comment"> * @addr:       address of the object /spaon> 489 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 490 /a> spao class="comment"> */ /spaon> 491 /a>void  a href="+code=debug_object_destroy" class="sref">debug_object_destroy /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 492 /a>{> 493 /a>        enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>;> 494 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 495 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 496 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 497 /a>> 498 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 499 /a>                return;> 500 /a>> 501 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 502 /a>> 503 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 504 /a>> 505 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 506 /a>        if (! a href="+code=obj" class="sref">obj /a>)> 507 /a>                goto  a href="+code=out_unlock" class="sref">out_unlock /a>;> 508 /a>> 509 /a>        switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 510 /a>        case  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>:> 511 /a>        case  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>:> 512 /a>        case  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>:> 513 /a>                 a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>;> 514 /a>                break;> 515 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 516 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"destroy" /spaon);> 517 /a>                 a href="+code=state" class="sref">state /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>;> 518 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 519 /a>                 a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_destroy" class="sref">fixup_destroy /a>,  a href="+code=addr" class="sref">addr /a>,  a href="+code=state" class="sref">state /a>);> 520 /a>                return;> 521 /a>> 522 /a>        case  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>:> 523 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"destroy" /spaon);> 524 /a>                break;> 525 /a>        default:> 526 /a>                break;> 527 /a>        }> 528 /a> a href="+code=out_unlock" class="sref">out_unlock /a>:> 529 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 530 /a>}> 531 /a>> 532 /a> spao class="comment">/** /spaon> 533 /a> spao class="comment"> * debug_object_free - debug checks when ao object is freed /spaon> 534 /a> spao class="comment"> * @addr:       address of the object /spaon> 535 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 536 /a> spao class="comment"> */ /spaon> 537 /a>void  a href="+code=debug_object_free" class="sref">debug_object_free /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 538 /a>{> 539 /a>        enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>;> 540 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 541 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 542 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 543 /a>> 544 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 545 /a>                return;> 546 /a>> 547 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 548 /a>> 549 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 550 /a>> 551 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 552 /a>        if (! a href="+code=obj" class="sref">obj /a>)> 553 /a>                goto  a href="+code=out_unlock" class="sref">out_unlock /a>;> 554 /a>> 555 /a>        switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 556 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 557 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"free" /spaon);> 558 /a>                 a href="+code=state" class="sref">state /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>;> 559 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 560 /a>                 a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_free" class="sref">fixup_free /a>,  a href="+code=addr" class="sref">addr /a>,  a href="+code=state" class="sref">state /a>);> 561 /a>                return;> 562 /a>        default:> 563 /a>                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 564 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 565 /a>                 a href="+code=free_object" class="sref">free_object /a>( a href="+code=obj" class="sref">obj /a>);> 566 /a>                return;> 567 /a>        }> 568 /a> a href="+code=out_unlock" class="sref">out_unlock /a>:> 569 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 570 /a>}> 571 /a>> 572 /a> spao class="comment">/** /spaon> 573 /a> spao class="comment"> * debug_object_assert_init - debug checks when object should be init-ed /spaon> 574 /a> spao class="comment"> * @addr:       address of the object /spaon> 575 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 576 /a> spao class="comment"> */ /spaon> 577 /a>void  a href="+code=debug_object_assert_init" class="sref">debug_object_assert_init /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>)> 578 /a>{> 579 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 580 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 581 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 582 /a>> 583 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 584 /a>                return;> 585 /a>> 586 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 587 /a>> 588 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 589 /a>> 590 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 591 /a>        if (! a href="+code=obj" class="sref">obj /a>) {> 592 /a>                struct  a href="+code=debug_obj" class="sref">debug_obj /a>  a href="+code=o" class="sref">o /a> = { . a href="+code=object" class="sref">object /a> =  a href="+code=addr" class="sref">addr /a>,> 593 /a>                                       . a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>,> 594 /a>                                       . a href="+code=descr" class="sref">descr /a> =  a href="+code=descr" class="sref">descr /a> };> 595 /a>> 596 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 597 /a>                 spao class="comment">/* /spaon> 598 /a> spao class="comment">                 * Maybe the object is static.  Let the typu specific /spaon> 599 /a> spao class="comment">                 * code decide what to do. /spaon> 600 /a> spao class="comment">                 */ /spaon> 601 /a>                if ( a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_assert_init" class="sref">fixup_assert_init /a>,  a href="+code=addr" class="sref">addr /a>,> 602 /a>                                        a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>))> 603 /a>                         a href="+code=debug_print_object" class="sref">debug_print_object /a>(& a href="+code=o" class="sref">o /a>,  spao class="string">"assert_init" /spaon);> 604 /a>                return;> 605 /a>        }> 606 /a>> 607 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 608 /a>}> 609 /a>> 610 /a> spao class="comment">/** /spaon> 611 /a> spao class="comment"> * debug_object_acptve_state - debug checks object usage state machine /spaon> 612 /a> spao class="comment"> * @addr:       address of the object /spaon> 613 /a> spao class="comment"> * @descr:      pointer to ao object specific debug descripttio structure /spaon> 614 /a> spao class="comment"> * @expect:     expected state /spaon> 615 /a> spao class="comment"> * @next:       state to move to if expected state is found /spaon> 616 /a> spao class="comment"> */ /spaon> 617 /a>void> 618 /a> a href="+code=debug_object_acptve_state" class="sref">debug_object_acptve_state /a>(void * a href="+code=addr" class="sref">addr /a>, struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>,> 619 /a>                          unsigned int  a href="+code=expect" class="sref">expect /a>, unsigned int  a href="+code=next" class="sref">next /a>)> 620 /a>{> 621 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 622 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 623 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 624 /a>> 625 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 626 /a>                return;> 627 /a>> 628 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 629 /a>> 630 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 631 /a>> 632 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 633 /a>        if ( a href="+code=obj" class="sref">obj /a>) {> 634 /a>                switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 635 /a>                case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 636 /a>                        if ( a href="+code=obj" class="sref">obj /a>-> a href="+code=astate" class="sref">astate /a> ==  a href="+code=expect" class="sref">expect /a>)> 637 /a>                                 a href="+code=obj" class="sref">obj /a>-> a href="+code=astate" class="sref">astate /a> =  a href="+code=next" class="sref">next /a>;> 638 /a>                        else> 639 /a>                                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"acptve_state" /spaon);> 640 /a>                        break;> 641 /a>> 642 /a>                default:> 643 /a>                         a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"acptve_state" /spaon);> 644 /a>                        break;> 645 /a>                }> 646 /a>        } else {> 647 /a>                struct  a href="+code=debug_obj" class="sref">debug_obj /a>  a href="+code=o" class="sref">o /a> = { . a href="+code=object" class="sref">object /a> =  a href="+code=addr" class="sref">addr /a>,> 648 /a>                                       . a href="+code=state" class="sref">state /a> =  a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>,> 649 /a>                                       . a href="+code=descr" class="sref">descr /a> =  a href="+code=descr" class="sref">descr /a> };> 650 /a>> 651 /a>                 a href="+code=debug_print_object" class="sref">debug_print_object /a>(& a href="+code=o" class="sref">o /a>,  spao class="string">"acptve_state" /spaon);> 652 /a>        }> 653 /a>> 654 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 655 /a>}> 656 /a>> 657 /a>#ifdef  a href="+code=CONFIG_DEBUG_OBJECTS_FREE" class="sref">CONFIG_DEBUG_OBJECTS_FREE /a>> 658 /a>static void  a href="+code=__debug_check_no_obj_freed" class="sref">__debug_check_no_obj_freed /a>(const void * a href="+code=address" class="sref">address /a>, unsigned long  a href="+code=size" class="sref">size /a>)> 659 /a>{> 660 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>,  a href="+code=oaddr" class="sref">oaddr /a>,  a href="+code=saddr" class="sref">saddr /a>,  a href="+code=eaddr" class="sref">eaddr /a>,  a href="+code=paddr" class="sref">paddr /a>,  a href="+code=chunks" class="sref">chunks /a>;> 661 /a>        struct  a href="+code=hlist_node" class="sref">hlist_node /a> * a href="+code=node" class="sref">node /a>, * a href="+code=tmp" class="sref">tmp /a>;> 662 /a>         a href="+code=HLIST_HEAD" class="sref">HLIST_HEAD /a>( a href="+code=freelist" class="sref">freelist /a>);> 663 /a>        struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a> * a href="+code=descr" class="sref">descr /a>;> 664 /a>        enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>;> 665 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 666 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 667 /a>        int  a href="+code=cnt" class="sref">cnt /a>;> 668 /a>> 669 /a>         a href="+code=saddr" class="sref">saddr /a> = (unsigned long)  a href="+code=address" class="sref">address /a>;> 670 /a>         a href="+code=eaddr" class="sref">eaddr /a> =  a href="+code=saddr" class="sref">saddr /a> +  a href="+code=size" class="sref">size /a>;> 671 /a>         a href="+code=paddr" class="sref">paddr /a> =  a href="+code=saddr" class="sref">saddr /a> &  a href="+code=ODEBUG_CHUNK_MASK" class="sref">ODEBUG_CHUNK_MASK /a>;> 672 /a>         a href="+code=chunks" class="sref">chunks /a> = (( a href="+code=eaddr" class="sref">eaddr /a> -  a href="+code=paddr" class="sref">paddr /a>) + ( a href="+code=ODEBUG_CHUNK_SIZE" class="sref">ODEBUG_CHUNK_SIZE /a> - 1));> 673 /a>         a href="+code=chunks" class="sref">chunks /a> >>=  a href="+code=ODEBUG_CHUNK_SHIFT" class="sref">ODEBUG_CHUNK_SHIFT /a>;> 674 /a>> 675 /a>        for (; a href="+code=chunks" class="sref">chunks /a> > 0;  a href="+code=chunks" class="sref">chunks /a>--,  a href="+code=paddr" class="sref">paddr /a> +=  a href="+code=ODEBUG_CHUNK_SIZE" class="sref">ODEBUG_CHUNK_SIZE /a>) {> 676 /a>                 a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>( a href="+code=paddr" class="sref">paddr /a>);> 677 /a>> 678 /a> a href="+code=repeat" class="sref">repeat /a>:> 679 /a>                 a href="+code=cnt" class="sref">cnt /a> = 0;> 680 /a>                 a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 681 /a>                 a href="+code=hlist_for_each_entry_safe" class="sref">hlist_for_each_entry_safe /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>,  a href="+code=tmp" class="sref">tmp /a>, & a href="+code=db" class="sref">db /a>-> a href="+code=list" class="sref">list /a>,  a href="+code=node" class="sref">node /a>) {> 682 /a>                         a href="+code=cnt" class="sref">cnt /a>++;> 683 /a>                         a href="+code=oaddr" class="sref">oaddr /a> = (unsigned long)  a href="+code=obj" class="sref">obj /a>-> a href="+code=object" class="sref">object /a>;> 684 /a>                        if ( a href="+code=oaddr" class="sref">oaddr /a> <  a href="+code=saddr" class="sref">saddr /a> ||  a href="+code=oaddr" class="sref">oaddr /a> >=  a href="+code=eaddr" class="sref">eaddr /a>)> 685 /a>                                continue;> 686 /a>> 687 /a>                        switch ( a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>) {> 688 /a>                        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 689 /a>                                 a href="+code=debug_print_object" class="sref">debug_print_object /a>( a href="+code=obj" class="sref">obj /a>,  spao class="string">"free" /spaon);> 690 /a>                                 a href="+code=descr" class="sref">descr /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=descr" class="sref">descr /a>;> 691 /a>                                 a href="+code=state" class="sref">state /a> =  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>;> 692 /a>                                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 693 /a>                                 a href="+code=debug_object_fixup" class="sref">debug_object_fixup /a>( a href="+code=descr" class="sref">descr /a>-> a href="+code=fixup_free" class="sref">fixup_free /a>,> 694 /a>                                                   (void *)  a href="+code=oaddr" class="sref">oaddr /a>,  a href="+code=state" class="sref">state /a>);> 695 /a>                                goto  a href="+code=repeat" class="sref">repeat /a>;> 696 /a>                        default:> 697 /a>                                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 698 /a>                                 a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=freelist" class="sref">freelist /a>);> 699 /a>                                break;> 700 /a>                        }> 701 /a>                }> 702 /a>                 a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 703 /a>> 704 /a>                 spao class="comment">/* Now free them */ /spaon> 705 /a>                 a href="+code=hlist_for_each_entry_safe" class="sref">hlist_for_each_entry_safe /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>,  a href="+code=tmp" class="sref">tmp /a>, & a href="+code=freelist" class="sref">freelist /a>,  a href="+code=node" class="sref">node /a>) {> 706 /a>                         a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);> 707 /a>                         a href="+code=free_object" class="sref">free_object /a>( a href="+code=obj" class="sref">obj /a>);> 708 /a>                }> 709 /a>> 710 /a>                if ( a href="+code=cnt" class="sref">cnt /a> >  a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a>)> 711 /a>                         a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a> =  a href="+code=cnt" class="sref">cnt /a>;> 712 /a>        }> 713 /a>}> 714 /a>> 715 /a>void  a href="+code=debug_check_no_obj_freed" class="sref">debug_check_no_obj_freed /a>(const void * a href="+code=address" class="sref">address /a>, unsigned long  a href="+code=size" class="sref">size /a>)> 716 /a>{> 717 /a>        if ( a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 718 /a>                 a href="+code=__debug_check_no_obj_freed" class="sref">__debug_check_no_obj_freed /a>( a href="+code=address" class="sref">address /a>,  a href="+code=size" class="sref">size /a>);> 719 /a>}> 720 /a>#endif> 721 /a>> 722 /a>#ifdef  a href="+code=CONFIG_DEBUG_FS" class="sref">CONFIG_DEBUG_FS /a>> 723 /a>> 724 /a>static int  a href="+code=debug_stats_show" class="sref">debug_stats_show /a>(struct  a href="+code=seq_file" class="sref">seq_file /a> * a href="+code=m" class="sref">m /a>, void * a href="+code=v" class="sref">v /a>)> 725 /a>{> 726 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"max_chain     :%d\n" /spaon,  a href="+code=debug_objects_maxchain" class="sref">debug_objects_maxchain /a>);> 727 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"warnings      :%d\n" /spaon,  a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>);> 728 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"fixups        :%d\n" /spaon,  a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a>);> 729 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"pool_free     :%d\n" /spaon,  a href="+code=obj_pool_free" class="sref">obj_pool_free /a>);> 730 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"pool_min_free :%d\n" /spaon,  a href="+code=obj_pool_min_free" class="sref">obj_pool_min_free /a>);> 731 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"pool_used     :%d\n" /spaon,  a href="+code=obj_pool_used" class="sref">obj_pool_used /a>);> 732 /a>         a href="+code=seq_printf" class="sref">seq_printf /a>( a href="+code=m" class="sref">m /a>,  spao class="string">"pool_max_used :%d\n" /spaon,  a href="+code=obj_pool_max_used" class="sref">obj_pool_max_used /a>);> 733 /a>        return 0;> 734 /a>}> 735 /a>> 736 /a>static int  a href="+code=debug_stats_open" class="sref">debug_stats_open /a>(struct  a href="+code=inode" class="sref">inode /a> * a href="+code=inode" class="sref">inode /a>, struct  a href="+code=file" class="sref">file /a> * a href="+code=filp" class="sref">filp /a>)> 737 /a>{> 738 /a>        return  a href="+code=single_open" class="sref">single_open /a>( a href="+code=filp" class="sref">filp /a>,  a href="+code=debug_stats_show" class="sref">debug_stats_show /a>,  a href="+code=NULL" class="sref">NULL /a>);> 739 /a>}> 740 /a>> 741 /a>static const struct  a href="+code=file_operattios" class="sref">file_operattios /a>  a href="+code=debug_stats_fops" class="sref">debug_stats_fops /a> = {> 742 /a>        . a href="+code=open" class="sref">open /a>           =  a href="+code=debug_stats_open" class="sref">debug_stats_open /a>,> 743 /a>        . a href="+code=read" class="sref">read /a>           =  a href="+code=seq_read" class="sref">seq_read /a>,> 744 /a>        . a href="+code=llseek" class="sref">llseek /a>         =  a href="+code=seq_lseek" class="sref">seq_lseek /a>,> 745 /a>        . a href="+code=release" class="sref">release /a>        =  a href="+code=single_release" class="sref">single_release /a>,> 746 /a>};> 747 /a>> 748 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=debug_objects_init_debugfs" class="sref">debug_objects_init_debugfs /a>(void)> 749 /a>{> 750 /a>        struct  a href="+code=dentry" class="sref">dentry /a> * a href="+code=dbgdir" class="sref">dbgdir /a>, * a href="+code=dbgstats" class="sref">dbgstats /a>;> 751 /a>> 752 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)> 753 /a>                return 0;> 754 /a>> 755 /a>         a href="+code=dbgdir" class="sref">dbgdir /a> =  a href="+code=debugfs_create_dir" class="sref">debugfs_create_dir /a>( spao class="string">"debug_objects" /spaon,  a href="+code=NULL" class="sref">NULL /a>);> 756 /a>        if (! a href="+code=dbgdir" class="sref">dbgdir /a>)> 757 /a>                return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;> 758 /a>> 759 /a>         a href="+code=dbgstats" class="sref">dbgstats /a> =  a href="+code=debugfs_create_file" class="sref">debugfs_create_file /a>( spao class="string">"stats" /spaon, 0444,  a href="+code=dbgdir" class="sref">dbgdir /a>,  a href="+code=NULL" class="sref">NULL /a>,> 760 /a>                                       & a href="+code=debug_stats_fops" class="sref">debug_stats_fops /a>);> 761 /a>        if (! a href="+code=dbgstats" class="sref">dbgstats /a>)> 762 /a>                goto  a href="+code=err" class="sref">err /a>;> 763 /a>> 764 /a>        return 0;> 765 /a>> 766 /a> a href="+code=err" class="sref">err /a>:> 767 /a>         a href="+code=debugfs_remove" class="sref">debugfs_remove /a>( a href="+code=dbgdir" class="sref">dbgdir /a>);> 768 /a>> 769 /a>        return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;> 770 /a>}> 771 /a> a href="+code=__initcall" class="sref">__initcall /a>( a href="+code=debug_objects_init_debugfs" class="sref">debug_objects_init_debugfs /a>);> 772 /a>> 773 /a>#else> 774 /a>static  a href="+code=inline" class="sref">inline /a> void  a href="+code=debug_objects_init_debugfs" class="sref">debug_objects_init_debugfs /a>(void) { }> 775 /a>#endif> 776 /a>> 777 /a>#ifdef  a href="+code=CONFIG_DEBUG_OBJECTS_SELFTEST" class="sref">CONFIG_DEBUG_OBJECTS_SELFTEST /a>> 778 /a>> 779 /a> spao class="comment">/* Random data structure for the self test */ /spaon> 780 /a>struct  a href="+code=self_test" class="sref">self_test /a> {> 781 /a>        unsigned long    a href="+code=dummy1" class="sref">dummy1 /a>[6];> 782 /a>        int              a href="+code=static_init" class="sref">static_init /a>;> 783 /a>        unsigned long    a href="+code=dummy2" class="sref">dummy2 /a>[3];> 784 /a>};> 785 /a>> 786 /a>static  a href="+code=__initdata" class="sref">__initdata /a> struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a>  a href="+code=descr_type_test" class="sref">descr_type_test /a>;> 787 /a>> 788 /a> spao class="comment">/* /spaon> 789 /a> spao class="comment"> * fixup_init is called when: /spaon> 790 /a> spao class="comment"> * - ao acptve object is initialized /spaon> 791 /a> spao class="comment"> */ /spaon> 792 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=fixup_init" class="sref">fixup_init /a>(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>)> 793 /a>{> 794 /a>        struct  a href="+code=self_test" class="sref">self_test /a> * a href="+code=obj" class="sref">obj /a> =  a href="+code=addr" class="sref">addr /a>;> 795 /a>> 796 /a>        switch ( a href="+code=state" class="sref">state /a>) {> 797 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 798 /a>                 a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 799 /a>                 a href="+code=debug_object_init" class="sref">debug_object_init /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 800 /a>                return 1;> 801 /a>        default:> 802 /a>                return 0;> 803 /a>        }> 804 /a>}> 805 /a>> 806 /a> spao class="comment">/* /spaon> 807 /a> spao class="comment"> * fixup_acptvate is called when: /spaon> 808 /a> spao class="comment"> * - ao acptve object is acptvated /spaon> 809 /a> spao class="comment"> * - ao unknown object is acptvated (might be a statically initialized object) /spaon> 810 /a> spao class="comment"> */ /spaon> 811 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=fixup_acptvate" class="sref">fixup_acptvate /a>(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>)> 812 /a>{> 813 /a>        struct  a href="+code=self_test" class="sref">self_test /a> * a href="+code=obj" class="sref">obj /a> =  a href="+code=addr" class="sref">addr /a>;> 814 /a>> 815 /a>        switch ( a href="+code=state" class="sref">state /a>) {> 816 /a>        case  a href="+code=ODEBUG_STATE_NOTAVAILABLE" class="sref">ODEBUG_STATE_NOTAVAILABLE /a>:> 817 /a>                if ( a href="+code=obj" class="sref">obj /a>-> a href="+code=static_init" class="sref">static_init /a> == 1) {> 818 /a>                         a href="+code=debug_object_init" class="sref">debug_object_init /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 819 /a>                         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 820 /a>                        return 0;> 821 /a>                }> 822 /a>                return 1;> 823 /a>> 824 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 825 /a>                 a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 826 /a>                 a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 827 /a>                return 1;> 828 /a>> 829 /a>        default:> 830 /a>                return 0;> 831 /a>        }> 832 /a>}> 833 /a>> 834 /a> spao class="comment">/* /spaon> 835 /a> spao class="comment"> * fixup_destroy is called when: /spaon> 836 /a> spao class="comment"> * - ao acptve object is destroyed /spaon> 837 /a> spao class="comment"> */ /spaon> 838 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=fixup_destroy" class="sref">fixup_destroy /a>(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>)> 839 /a>{> 840 /a>        struct  a href="+code=self_test" class="sref">self_test /a> * a href="+code=obj" class="sref">obj /a> =  a href="+code=addr" class="sref">addr /a>;> 841 /a>> 842 /a>        switch ( a href="+code=state" class="sref">state /a>) {> 843 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 844 /a>                 a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 845 /a>                 a href="+code=debug_object_destroy" class="sref">debug_object_destroy /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 846 /a>                return 1;> 847 /a>        default:> 848 /a>                return 0;> 849 /a>        }> 850 /a>}> 851 /a>> 852 /a> spao class="comment">/* /spaon> 853 /a> spao class="comment"> * fixup_free is called when: /spaon> 854 /a> spao class="comment"> * - ao acptve object is freed /spaon> 855 /a> spao class="comment"> */ /spaon> 856 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=fixup_free" class="sref">fixup_free /a>(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>)> 857 /a>{> 858 /a>        struct  a href="+code=self_test" class="sref">self_test /a> * a href="+code=obj" class="sref">obj /a> =  a href="+code=addr" class="sref">addr /a>;> 859 /a>> 860 /a>        switch ( a href="+code=state" class="sref">state /a>) {> 861 /a>        case  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>:> 862 /a>                 a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 863 /a>                 a href="+code=debug_object_free" class="sref">debug_object_free /a>( a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 864 /a>                return 1;> 865 /a>        default:> 866 /a>                return 0;> 867 /a>        }> 868 /a>}> 869 /a>> 870 /a>static int  a href="+code=__init" class="sref">__init /a>> 871 /a> a href="+code=check_results" class="sref">check_results /a>(void * a href="+code=addr" class="sref">addr /a>, enum  a href="+code=debug_obj_state" class="sref">debug_obj_state /a>  a href="+code=state" class="sref">state /a>, int  a href="+code=fixups" class="sref">fixups /a>, int  a href="+code=warnings" class="sref">warnings /a>)> 872 /a>{> 873 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a>;> 874 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>;> 875 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 876 /a>        int  a href="+code=res" class="sref">res /a> = - a href="+code=EINVAL" class="sref">EINVAL /a>;> 877 /a>> 878 /a>         a href="+code=db" class="sref">db /a> =  a href="+code=get_bucket" class="sref">get_bucket /a>((unsigned long)  a href="+code=addr" class="sref">addr /a>);> 879 /a>> 880 /a>         a href="+code=raw_spin_lock_irqsave" class="sref">raw_spin_lock_irqsave /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 881 /a>> 882 /a>         a href="+code=obj" class="sref">obj /a> =  a href="+code=lookup_object" class="sref">lookup_object /a>( a href="+code=addr" class="sref">addr /a>,  a href="+code=db" class="sref">db /a>);> 883 /a>        if (! a href="+code=obj" class="sref">obj /a> &&  a href="+code=state" class="sref">state /a> !=  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>) {> 884 /a>                 a href="+code=WARN" class="sref">WARN /a>(1,  a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"ODEBUG: selftest object not found\n" /spaon);> 885 /a>                goto  a href="+code=out" class="sref">out /a>;> 886 /a>        }> 887 /a>        if ( a href="+code=obj" class="sref">obj /a> &&  a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a> !=  a href="+code=state" class="sref">state /a>) {> 888 /a>                 a href="+code=WARN" class="sref">WARN /a>(1,  a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"ODEBUG: selftest wrong state: %d != %d\n" /spaon,> 889 /a>                        a href="+code=obj" class="sref">obj /a>-> a href="+code=state" class="sref">state /a>,  a href="+code=state" class="sref">state /a>);> 890 /a>                goto  a href="+code=out" class="sref">out /a>;> 891 /a>        }> 892 /a>        if ( a href="+code=fixups" class="sref">fixups /a> !=  a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a>) {> 893 /a>                 a href="+code=WARN" class="sref">WARN /a>(1,  a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"ODEBUG: selftest fixups failed %d != %d\n" /spaon,> 894 /a>                        a href="+code=fixups" class="sref">fixups /a>,  a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a>);> 895 /a>                goto  a href="+code=out" class="sref">out /a>;> 896 /a>        }> 897 /a>        if ( a href="+code=warnings" class="sref">warnings /a> !=  a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>) {> 898 /a>                 a href="+code=WARN" class="sref">WARN /a>(1,  a href="+code=KERN_ERR" class="sref">KERN_ERR /a>  spao class="string">"ODEBUG: selftest warnings failed %d != %d\n" /spaon,> 899 /a>                        a href="+code=warnings" class="sref">warnings /a>,  a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>);> 900 /a>                goto  a href="+code=out" class="sref">out /a>;> 901 /a>        }> 902 /a>         a href="+code=res" class="sref">res /a> = 0;> 903 /a> a href="+code=out" class="sref">out /a>:> 904 /a>         a href="+code=raw_spin_unlock_irqrestore" class="sref">raw_spin_unlock_irqrestore /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=lock" class="sref">lock /a>,  a href="+code=flags" class="sref">flags /a>);> 905 /a>        if ( a href="+code=res" class="sref">res /a>)> 906 /a>                 a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a> = 0;> 907 /a>        return  a href="+code=res" class="sref">res /a>;> 908 /a>}> 909 /a>> 910 /a>static  a href="+code=__initdata" class="sref">__initdata /a> struct  a href="+code=debug_obj_descr" class="sref">debug_obj_descr /a>  a href="+code=descr_type_test" class="sref">descr_type_test /a> = {> 911 /a>        . a href="+code=namu" class="sref">namu /a>                   =  spao class="string">"selftest" /spaon,> 912 /a>        . a href="+code=fixup_init" class="sref">fixup_init /a>             =  a href="+code=fixup_init" class="sref">fixup_init /a>,> 913 /a>        . a href="+code=fixup_acptvate" class="sref">fixup_acptvate /a>         =  a href="+code=fixup_acptvate" class="sref">fixup_acptvate /a>,> 914 /a>        . a href="+code=fixup_destroy" class="sref">fixup_destroy /a>          =  a href="+code=fixup_destroy" class="sref">fixup_destroy /a>,> 915 /a>        . a href="+code=fixup_free" class="sref">fixup_free /a>             =  a href="+code=fixup_free" class="sref">fixup_free /a>,> 916 /a>};> 917 /a>> 918 /a>static  a href="+code=__initdata" class="sref">__initdata /a> struct  a href="+code=self_test" class="sref">self_test /a>  a href="+code=obj" class="sref">obj /a> = { . a href="+code=static_init" class="sref">static_init /a> = 0 };> 919 /a>> 920 /a>static void  a href="+code=__init" class="sref">__init /a>  a href="+code=debug_objects_selftest" class="sref">debug_objects_selftest /a>(void)> 921 /a>{> 922 /a>        int  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=oldfixups" class="sref">oldfixups /a>,  a href="+code=warnings" class="sref">warnings /a>,  a href="+code=oldwarnings" class="sref">oldwarnings /a>;> 923 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 924 /a>> 925 /a>         a href="+code=local_irq_save" class="sref">local_irq_save /a>( a href="+code=flags" class="sref">flags /a>);> 926 /a>> 927 /a>         a href="+code=fixups" class="sref">fixups /a> =  a href="+code=oldfixups" class="sref">oldfixups /a> =  a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a>;> 928 /a>         a href="+code=warnings" class="sref">warnings /a> =  a href="+code=oldwarnings" class="sref">oldwarnings /a> =  a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a>;> 929 /a>         a href="+code=descr_test" class="sref">descr_test /a> = & a href="+code=descr_type_test" class="sref">descr_type_test /a>;> 930 /a>> 931 /a>         a href="+code=debug_object_init" class="sref">debug_object_init /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 932 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 933 /a>                goto  a href="+code=out" class="sref">out /a>;> 934 /a>         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 935 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 936 /a>                goto  a href="+code=out" class="sref">out /a>;> 937 /a>         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 938 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>, ++ a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 939 /a>                goto  a href="+code=out" class="sref">out /a>;> 940 /a>         a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 941 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_INACTIVE" class="sref">ODEBUG_STATE_INACTIVE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 942 /a>                goto  a href="+code=out" class="sref">out /a>;> 943 /a>         a href="+code=debug_object_destroy" class="sref">debug_object_destroy /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 944 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 945 /a>                goto  a href="+code=out" class="sref">out /a>;> 946 /a>         a href="+code=debug_object_init" class="sref">debug_object_init /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 947 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>,  a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 948 /a>                goto  a href="+code=out" class="sref">out /a>;> 949 /a>         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 950 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>,  a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 951 /a>                goto  a href="+code=out" class="sref">out /a>;> 952 /a>         a href="+code=debug_object_deacptvate" class="sref">debug_object_deacptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 953 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_DESTROYED" class="sref">ODEBUG_STATE_DESTROYED /a>,  a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 954 /a>                goto  a href="+code=out" class="sref">out /a>;> 955 /a>         a href="+code=debug_object_free" class="sref">debug_object_free /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 956 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 957 /a>                goto  a href="+code=out" class="sref">out /a>;> 958 /a>> 959 /a>         a href="+code=obj" class="sref">obj /a>. a href="+code=static_init" class="sref">static_init /a> = 1;> 960 /a>         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 961 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 962 /a>                goto  a href="+code=out" class="sref">out /a>;> 963 /a>         a href="+code=debug_object_init" class="sref">debug_object_init /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 964 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>, ++ a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 965 /a>                goto  a href="+code=out" class="sref">out /a>;> 966 /a>         a href="+code=debug_object_free" class="sref">debug_object_free /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 967 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 968 /a>                goto  a href="+code=out" class="sref">out /a>;> 969 /a>> 970 /a>#ifdef  a href="+code=CONFIG_DEBUG_OBJECTS_FREE" class="sref">CONFIG_DEBUG_OBJECTS_FREE /a>> 971 /a>         a href="+code=debug_object_init" class="sref">debug_object_init /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 972 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_INIT" class="sref">ODEBUG_STATE_INIT /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 973 /a>                goto  a href="+code=out" class="sref">out /a>;> 974 /a>         a href="+code=debug_object_acptvate" class="sref">debug_object_acptvate /a>(& a href="+code=obj" class="sref">obj /a>, & a href="+code=descr_type_test" class="sref">descr_type_test /a>);> 975 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_ACTIVE" class="sref">ODEBUG_STATE_ACTIVE /a>,  a href="+code=fixups" class="sref">fixups /a>,  a href="+code=warnings" class="sref">warnings /a>))> 976 /a>                goto  a href="+code=out" class="sref">out /a>;> 977 /a>         a href="+code=__debug_check_no_obj_freed" class="sref">__debug_check_no_obj_freed /a>(& a href="+code=obj" class="sref">obj /a>, sizeof( a href="+code=obj" class="sref">obj /a>));> 978 /a>        if ( a href="+code=check_results" class="sref">check_results /a>(& a href="+code=obj" class="sref">obj /a>,  a href="+code=ODEBUG_STATE_NONE" class="sref">ODEBUG_STATE_NONE /a>, ++ a href="+code=fixups" class="sref">fixups /a>, ++ a href="+code=warnings" class="sref">warnings /a>))> 979 /a>                goto  a href="+code=out" class="sref">out /a>;> 980 /a>#endif> 981 /a>         a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_INFO" class="sref">KERN_INFO /a>  spao class="string">"ODEBUG: selftest passed\n" /spaon);> 982 /a>> 983 /a> a href="+code=out" class="sref">out /a>:> 984 /a>         a href="+code=debug_objects_fixups" class="sref">debug_objects_fixups /a> =  a href="+code=oldfixups" class="sref">oldfixups /a>;> 985 /a>         a href="+code=debug_objects_warnings" class="sref">debug_objects_warnings /a> =  a href="+code=oldwarnings" class="sref">oldwarnings /a>;> 986 /a>         a href="+code=descr_test" class="sref">descr_test /a> =  a href="+code=NULL" class="sref">NULL /a>;> 987 /a>> 988 /a>         a href="+code=local_irq_restore" class="sref">local_irq_restore /a>( a href="+code=flags" class="sref">flags /a>);> 989 /a>}> 990 /a>#else> 991 /a>static  a href="+code=inline" class="sref">inline /a> void  a href="+code=debug_objects_selftest" class="sref">debug_objects_selftest /a>(void) { }> 992 /a>#endif> 993 /a>> 994 /a> spao class="comment">/* /spaon> 995 /a> spao class="comment"> * Called during early boot to initialize the hash buckets and link /spaon> 996 /a> spao class="comment"> * the static object pool objects into the poll list. After this call /spaon> 997 /a> spao class="comment"> * the object tracker is fully operational. /spaon> 998 /a> spao class="comment"> */ /spaon> 999 /a>void  a href="+code=__init" class="sref">__init /a>  a href="+code=debug_objects_early_init" class="sref">debug_objects_early_init /a>(void)>1000 /a>{
1001 /a>        int  a href="+code=i" class="sref">i /a>;>1002 /a>>1003 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=ODEBUG_HASH_SIZE" class="sref">ODEBUG_HASH_SIZE /a>;  a href="+code=i" class="sref">i /a>++)>1004 /a>                 a href="+code=raw_spin_lock_init" class="sref">raw_spin_lock_init /a>(& a href="+code=obj_hash" class="sref">obj_hash /a>[ a href="+code=i" class="sref">i /a>]. a href="+code=lock" class="sref">lock /a>);>1005 /a>>1006 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>;  a href="+code=i" class="sref">i /a>++)>1007 /a>                 a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=obj_static_pool" class="sref">obj_static_pool /a>[ a href="+code=i" class="sref">i /a>]. a href="+code=node" class="sref">node /a>, & a href="+code=obj_pool" class="sref">obj_pool /a>);>1008 /a>}>1009 /a>>1010 /a> spao class="comment">/* /spaon>1011 /a> spao class="comment"> * Convert the statically allocated objects to dynamic ones: /spaon>1012 /a> spao class="comment"> */ /spaon>1013 /a>static int  a href="+code=__init" class="sref">__init /a>  a href="+code=debug_objects_replace_static_objects" class="sref">debug_objects_replace_static_objects /a>(void)>1014 /a>{
1015 /a>        struct  a href="+code=debug_bucket" class="sref">debug_bucket /a> * a href="+code=db" class="sref">db /a> =  a href="+code=obj_hash" class="sref">obj_hash /a>;>1016 /a>        struct  a href="+code=hlist_node" class="sref">hlist_node /a> * a href="+code=node" class="sref">node /a>, * a href="+code=tmp" class="sref">tmp /a>;>1017 /a>        struct  a href="+code=debug_obj" class="sref">debug_obj /a> * a href="+code=obj" class="sref">obj /a>, * a href="+code=new" class="sref">new /a>;>1018 /a>         a href="+code=HLIST_HEAD" class="sref">HLIST_HEAD /a>( a href="+code=objects" class="sref">objects /a>);>1019 /a>        int  a href="+code=i" class="sref">i /a>,  a href="+code=cnt" class="sref">cnt /a> = 0;>1020 /a>>1021 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=ODEBUG_POOL_SIZE" class="sref">ODEBUG_POOL_SIZE /a>;  a href="+code=i" class="sref">i /a>++) {>1022 /a>                 a href="+code=obj" class="sref">obj /a> =  a href="+code=kmem_cache_zalloc" class="sref">kmem_cache_zalloc /a>( a href="+code=obj_cache" class="sref">obj_cache /a>,  a href="+code=GFP_KERNEL" class="sref">GFP_KERNEL /a>);>1023 /a>                if (! a href="+code=obj" class="sref">obj /a>)>1024 /a>                        goto  a href="+code=free" class="sref">free /a>;>1025 /a>                 a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=objects" class="sref">objects /a>);>1026 /a>        }>1027 /a>>1028 /a>         spao class="comment">/* /spaon>1029 /a> spao class="comment">         * When debug_objects_mem_init() is called we know that only /spaon>1030 /a> spao class="comment">         * one CPU is up, so disabling interrupts is enough /spaon>1031 /a> spao class="comment">         * protection. This avoids the lockdep hell of lock ordering. /spaon>1032 /a> spao class="comment">         */ /spaon>1033 /a>         a href="+code=local_irq_disable" class="sref">local_irq_disable /a>();>1034 /a>>1035 /a>         spao class="comment">/* Remove the statically allocated objects from the pool */ /spaon>1036 /a>         a href="+code=hlist_for_each_entry_safe" class="sref">hlist_for_each_entry_safe /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>,  a href="+code=tmp" class="sref">tmp /a>, & a href="+code=obj_pool" class="sref">obj_pool /a>,  a href="+code=node" class="sref">node /a>)>1037 /a>                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);>1038 /a>         spao class="comment">/* Move the allocated objects to the pool */ /spaon>1039 /a>         a href="+code=hlist_move_list" class="sref">hlist_move_list /a>(& a href="+code=objects" class="sref">objects /a>, & a href="+code=obj_pool" class="sref">obj_pool /a>);>1040 /a>>1041 /a>         spao class="comment">/* Replace the acptve object references */ /spaon>1042 /a>        for ( a href="+code=i" class="sref">i /a> = 0;  a href="+code=i" class="sref">i /a> <  a href="+code=ODEBUG_HASH_SIZE" class="sref">ODEBUG_HASH_SIZE /a>;  a href="+code=i" class="sref">i /a>++,  a href="+code=db" class="sref">db /a>++) {>1043 /a>                 a href="+code=hlist_move_list" class="sref">hlist_move_list /a>(& a href="+code=db" class="sref">db /a>-> a href="+code=list" class="sref">list /a>, & a href="+code=objects" class="sref">objects /a>);>1044 /a>>1045 /a>                 a href="+code=hlist_for_each_entry" class="sref">hlist_for_each_entry /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>, & a href="+code=objects" class="sref">objects /a>,  a href="+code=node" class="sref">node /a>) {>1046 /a>                         a href="+code=new" class="sref">new /a> =  a href="+code=hlist_entry" class="sref">hlist_entry /a>( a href="+code=obj_pool" class="sref">obj_pool /a>. a href="+code=first" class="sref">first /a>,  a href="+code=typeof" class="sref">typeof /a>(* a href="+code=obj" class="sref">obj /a>),  a href="+code=node" class="sref">node /a>);>1047 /a>                         a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=new" class="sref">new /a>-> a href="+code=node" class="sref">node /a>);>1048 /a>                         spao class="comment">/* copy object data */ /spaon>1049 /a>                        * a href="+code=new" class="sref">new /a> = * a href="+code=obj" class="sref">obj /a>;>1050 /a>                         a href="+code=hlist_add_head" class="sref">hlist_add_head /a>(& a href="+code=new" class="sref">new /a>-> a href="+code=node" class="sref">node /a>, & a href="+code=db" class="sref">db /a>-> a href="+code=list" class="sref">list /a>);>1051 /a>                         a href="+code=cnt" class="sref">cnt /a>++;>1052 /a>                }>1053 /a>        }>1054 /a>         a href="+code=local_irq_enable" class="sref">local_irq_enable /a>();>1055 /a>>1056 /a>         a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_DEBUG" class="sref">KERN_DEBUG /a>  spao class="string">"ODEBUG: %d of %d acptve objects replaced\n" /spaon,  a href="+code=cnt" class="sref">cnt /a>,>1057 /a>                a href="+code=obj_pool_used" class="sref">obj_pool_used /a>);>1058 /a>        return 0;>1059 /a> a href="+code=free" class="sref">free /a>:>1060 /a>         a href="+code=hlist_for_each_entry_safe" class="sref">hlist_for_each_entry_safe /a>( a href="+code=obj" class="sref">obj /a>,  a href="+code=node" class="sref">node /a>,  a href="+code=tmp" class="sref">tmp /a>, & a href="+code=objects" class="sref">objects /a>,  a href="+code=node" class="sref">node /a>) {>1061 /a>                 a href="+code=hlist_del" class="sref">hlist_del /a>(& a href="+code=obj" class="sref">obj /a>-> a href="+code=node" class="sref">node /a>);>1062 /a>                 a href="+code=kmem_cache_free" class="sref">kmem_cache_free /a>( a href="+code=obj_cache" class="sref">obj_cache /a>,  a href="+code=obj" class="sref">obj /a>);>1063 /a>        }>1064 /a>        return - a href="+code=ENOMEM" class="sref">ENOMEM /a>;>1065 /a>}>1066 /a>>1067 /a> spao class="comment">/* /spaon>1068 /a> spao class="comment"> * Called after the kmem_caches are functional to setup a dedicated /spaon>1069 /a> spao class="comment"> * cache pool, which has the SLAB_DEBUG_OBJECTS flag set. This flag /spaon>1070 /a> spao class="comment"> * prevents that the debug code is called on kmem_cache_free() for the /spaon>1071 /a> spao class="comment"> * debug tracker objects to avoid recurstve calls. /spaon>1072 /a> spao class="comment"> */ /spaon>1073 /a>void  a href="+code=__init" class="sref">__init /a>  a href="+code=debug_objects_mem_init" class="sref">debug_objects_mem_init /a>(void)>1074 /a>{
1075 /a>        if (! a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a>)>1076 /a>                return;>1077 /a>>1078 /a>         a href="+code=obj_cache" class="sref">obj_cache /a> =  a href="+code=kmem_cache_create" class="sref">kmem_cache_create /a>( spao class="string">"debug_objects_cache" /spaon,>1079 /a>                                      sizeof (struct  a href="+code=debug_obj" class="sref">debug_obj /a>), 0,>1080 /a>                                       a href="+code=SLAB_DEBUG_OBJECTS" class="sref">SLAB_DEBUG_OBJECTS /a>,  a href="+code=NULL" class="sref">NULL /a>);>1081 /a>>1082 /a>        if (! a href="+code=obj_cache" class="sref">obj_cache /a> ||  a href="+code=debug_objects_replace_static_objects" class="sref">debug_objects_replace_static_objects /a>()) {>1083 /a>                 a href="+code=debug_objects_enabled" class="sref">debug_objects_enabled /a> = 0;>1084 /a>                if ( a href="+code=obj_cache" class="sref">obj_cache /a>)>1085 /a>                         a href="+code=kmem_cache_destroy" class="sref">kmem_cache_destroy /a>( a href="+code=obj_cache" class="sref">obj_cache /a>);>1086 /a>                 a href="+code=printk" class="sref">printk /a>( a href="+code=KERN_WARNING" class="sref">KERN_WARNING /a>  spao class="string">"ODEBUG: out of memory.\n" /spaon);>1087 /a>        } else>1088 /a>                 a href="+code=debug_objects_selftest" class="sref">debug_objects_selftest /a>();>1089 /a>}>1090 /a> /pre>
lxr.linux.no kindly hosted by Redpill Linpro AS /a>, provider of Linux consulting and operations services since 1995.