// SPDX-License-Identifier: GPL-2.0
/*
* Generic infrastructure for lifetime debugging of objects.
*
* Copyright (C) 2008, Linutronix GmbH, Thomas Gleixner <tglx@kernel.org>
*/
#define pr_fmt(fmt) "ODEBUG: " fmt
#include <linux/cpu.h>
#include <linux/debugobjects.h>
#include <linux/debugfs.h>
#include <linux/hash.h>
#include <linux/kmemleak.h>
#include <linux/sched.h>
#include <linux/sched/loadavg.h>
#include <linux/sched/task_stack.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/static_key.h>
#define ODEBUG_HASH_BITS 14
#define ODEBUG_HASH_SIZE (1 << ODEBUG_HASH_BITS)
/* Must be power of two */
#define ODEBUG_BATCH_SIZE 16
/* Initial values. Must all be a multiple of batch size */
#define ODEBUG_POOL_SIZE (64 * ODEBUG_BATCH_SIZE)
#define ODEBUG_POOL_MIN_LEVEL (ODEBUG_POOL_SIZE / 4)
#define ODEBUG_POOL_PERCPU_SIZE (8 * ODEBUG_BATCH_SIZE)
#define ODEBUG_CHUNK_SHIFT PAGE_SHIFT
#define ODEBUG_CHUNK_SIZE (1 << ODEBUG_CHUNK_SHIFT)
#define ODEBUG_CHUNK_MASK (~(ODEBUG_CHUNK_SIZE