summaryrefslogtreecommitdiffstats
path: root/include/linux/stackdepot.h
diff options
context:
space:
mode:
authorOscar Salvador <osalvador@suse.de>2024-02-15 22:59:03 +0100
committerAndrew Morton <akpm@linux-foundation.org>2024-02-23 17:48:17 -0800
commit4bedfb314bdd85c1662ecc46fa25b33b998f994d (patch)
treef38b88cba66f0461a0a24c37e98d0a12a49a24b1 /include/linux/stackdepot.h
parent8151c7a35d8bd8a12e93538ef7963ea209b6ab41 (diff)
downloadlinux-4bedfb314bdd85c1662ecc46fa25b33b998f994d.tar.gz
linux-4bedfb314bdd85c1662ecc46fa25b33b998f994d.tar.bz2
linux-4bedfb314bdd85c1662ecc46fa25b33b998f994d.zip
mm,page_owner: maintain own list of stack_records structs
page_owner needs to increment a stack_record refcount when a new allocation occurs, and decrement it on a free operation. In order to do that, we need to have a way to get a stack_record from a handle. Implement __stack_depot_get_stack_record() which just does that, and make it public so page_owner can use it. Also, traversing all stackdepot buckets comes with its own complexity, plus we would have to implement a way to mark only those stack_records that were originated from page_owner, as those are the ones we are interested in. For that reason, page_owner maintains its own list of stack_records, because traversing that list is faster than traversing all buckets while keeping at the same time a low complexity. For now, add to stack_list only the stack_records of dummy_handle and failure_handle, and set their refcount of 1. Further patches will add code to increment or decrement stack_records count on allocation and free operation. Link: https://lkml.kernel.org/r/20240215215907.20121-4-osalvador@suse.de Signed-off-by: Oscar Salvador <osalvador@suse.de> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> Reviewed-by: Marco Elver <elver@google.com> Acked-by: Andrey Konovalov <andreyknvl@gmail.com> Cc: Alexander Potapenko <glider@google.com> Cc: Michal Hocko <mhocko@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'include/linux/stackdepot.h')
-rw-r--r--include/linux/stackdepot.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/linux/stackdepot.h b/include/linux/stackdepot.h
index c4b5ad57c066..3c6caa5abc7c 100644
--- a/include/linux/stackdepot.h
+++ b/include/linux/stackdepot.h
@@ -179,6 +179,17 @@ depot_stack_handle_t stack_depot_save(unsigned long *entries,
unsigned int nr_entries, gfp_t gfp_flags);
/**
+ * __stack_depot_get_stack_record - Get a pointer to a stack_record struct
+ *
+ * @handle: Stack depot handle
+ *
+ * This function is only for internal purposes.
+ *
+ * Return: Returns a pointer to a stack_record struct
+ */
+struct stack_record *__stack_depot_get_stack_record(depot_stack_handle_t handle);
+
+/**
* stack_depot_fetch - Fetch a stack trace from stack depot
*
* @handle: Stack depot handle returned from stack_depot_save()