Skip to content
Snippets Groups Projects
Select Git revision
  • 163cf842f5837334bc69aaf09ad38e11f4573914
  • vme-testing default
  • ci-test
  • master
  • remoteproc
  • am625-sk-ov5640
  • pcal6534-upstreaming
  • lps22df-upstreaming
  • msc-upstreaming
  • imx8mp
  • iio/noa1305
  • vme-next
  • vme-next-4.14-rc4
  • v4.14-rc4
  • v4.14-rc3
  • v4.14-rc2
  • v4.14-rc1
  • v4.13
  • vme-next-4.13-rc7
  • v4.13-rc7
  • v4.13-rc6
  • v4.13-rc5
  • v4.13-rc4
  • v4.13-rc3
  • v4.13-rc2
  • v4.13-rc1
  • v4.12
  • v4.12-rc7
  • v4.12-rc6
  • v4.12-rc5
  • v4.12-rc4
  • v4.12-rc3
32 results

debugobjects.c

Blame
  • debugobjects.c 29.45 KiB
    /*
     * Generic infrastructure for lifetime debugging of objects.
     *
     * Started by Thomas Gleixner
     *
     * Copyright (C) 2008, Thomas Gleixner <tglx@linutronix.de>
     *
     * For licencing details see kernel-base/COPYING
     */
    
    #define pr_fmt(fmt) "ODEBUG: " fmt
    
    #include <linux/debugobjects.h>
    #include <linux/interrupt.h>
    #include <linux/sched.h>
    #include <linux/sched/task_stack.h>
    #include <linux/seq_file.h>
    #include <linux/debugfs.h>
    #include <linux/slab.h>
    #include <linux/hash.h>
    #include <linux/kmemleak.h>
    
    #define ODEBUG_HASH_BITS	14
    #define ODEBUG_HASH_SIZE	(1 << ODEBUG_HASH_BITS)
    
    #define ODEBUG_POOL_SIZE	1024
    #define ODEBUG_POOL_MIN_LEVEL	256
    
    #define ODEBUG_CHUNK_SHIFT	PAGE_SHIFT
    #define ODEBUG_CHUNK_SIZE	(1 << ODEBUG_CHUNK_SHIFT)
    #define ODEBUG_CHUNK_MASK	(~(ODEBUG_CHUNK_SIZE - 1))
    
    struct debug_bucket {
    	struct hlist_head	list;
    	raw_spinlock_t		lock;
    };
    
    static struct debug_bucket	obj_hash[ODEBUG_HASH_SIZE];
    
    static struct debug_obj		obj_static_pool[ODEBUG_POOL_SIZE] __initdata;
    
    static DEFINE_RAW_SPINLOCK(pool_lock);
    
    static HLIST_HEAD(obj_pool);
    static HLIST_HEAD(obj_to_free);
    
    static int			obj_pool_min_free = ODEBUG_POOL_SIZE;
    static int			obj_pool_free = ODEBUG_POOL_SIZE;
    static int			obj_pool_used;
    static int			obj_pool_max_used;
    /* The number of objs on the global free list */
    static int			obj_nr_tofree;
    static struct kmem_cache	*obj_cache;
    
    static int			debug_objects_maxchain __read_mostly;
    static int __maybe_unused	debug_objects_maxchecked __read_mostly;
    static int			debug_objects_fixups __read_mostly;
    static int			debug_objects_warnings __read_mostly;
    static int			debug_objects_enabled __read_mostly
    				= CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT;
    static int			debug_objects_pool_size __read_mostly
    				= ODEBUG_POOL_SIZE;
    static int			debug_objects_pool_min_level __read_mostly
    				= ODEBUG_POOL_MIN_LEVEL;
    static struct debug_obj_descr	*descr_test  __read_mostly;
    
    /*
     * Track numbers of kmem_cache_alloc()/free() calls done.
     */
    static int			debug_objects_allocated;