![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0-or-later */ 0002 /* 0003 * A generic stack depot implementation 0004 * 0005 * Author: Alexander Potapenko <glider@google.com> 0006 * Copyright (C) 2016 Google, Inc. 0007 * 0008 * Based on code by Dmitry Chernenkov. 0009 */ 0010 0011 #ifndef _LINUX_STACKDEPOT_H 0012 #define _LINUX_STACKDEPOT_H 0013 0014 #include <linux/gfp.h> 0015 0016 typedef u32 depot_stack_handle_t; 0017 0018 depot_stack_handle_t __stack_depot_save(unsigned long *entries, 0019 unsigned int nr_entries, 0020 gfp_t gfp_flags, bool can_alloc); 0021 0022 /* 0023 * Every user of stack depot has to call stack_depot_init() during its own init 0024 * when it's decided that it will be calling stack_depot_save() later. This is 0025 * recommended for e.g. modules initialized later in the boot process, when 0026 * slab_is_available() is true. 0027 * 0028 * The alternative is to select STACKDEPOT_ALWAYS_INIT to have stack depot 0029 * enabled as part of mm_init(), for subsystems where it's known at compile time 0030 * that stack depot will be used. 0031 * 0032 * Another alternative is to call stack_depot_want_early_init(), when the 0033 * decision to use stack depot is taken e.g. when evaluating kernel boot 0034 * parameters, which precedes the enablement point in mm_init(). 0035 * 0036 * stack_depot_init() and stack_depot_want_early_init() can be called regardless 0037 * of CONFIG_STACKDEPOT and are no-op when disabled. The actual save/fetch/print 0038 * functions should only be called from code that makes sure CONFIG_STACKDEPOT 0039 * is enabled. 0040 */ 0041 #ifdef CONFIG_STACKDEPOT 0042 int stack_depot_init(void); 0043 0044 void __init stack_depot_want_early_init(void); 0045 0046 /* This is supposed to be called only from mm_init() */ 0047 int __init stack_depot_early_init(void); 0048 #else 0049 static inline int stack_depot_init(void) { return 0; } 0050 0051 static inline void stack_depot_want_early_init(void) { } 0052 0053 static inline int stack_depot_early_init(void) { return 0; } 0054 #endif 0055 0056 depot_stack_handle_t stack_depot_save(unsigned long *entries, 0057 unsigned int nr_entries, gfp_t gfp_flags); 0058 0059 unsigned int stack_depot_fetch(depot_stack_handle_t handle, 0060 unsigned long **entries); 0061 0062 int stack_depot_snprint(depot_stack_handle_t handle, char *buf, size_t size, 0063 int spaces); 0064 0065 void stack_depot_print(depot_stack_handle_t stack); 0066 0067 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |