diff options
author | Reed Riley <reed@riley.engineer> | 2024-04-15 21:08:13 -0700 |
---|---|---|
committer | Reed Riley <reed@riley.engineer> | 2024-04-15 21:08:13 -0700 |
commit | e5e8f203d77f90d1af8ebfd794eb1593582b85cc (patch) | |
tree | 4b247a45e411ea62d5af495eec775d3d48c40676 /include/linux/sched.h | |
parent | 6432d7745c1d0eba610fed85a8a6bac1864e858d (diff) | |
parent | 72cfb036b00a2c9f59a5d6ff1bc2d039ffb67490 (diff) |
Merge branch 'memalloc_prof_v6' of https://github.com/surenbaghdasaryan/linux
Diffstat (limited to 'include/linux/sched.h')
-rw-r--r-- | include/linux/sched.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 3c2abbc587b4..4118b3f959c3 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -770,6 +770,10 @@ struct task_struct { unsigned int flags; unsigned int ptrace; +#ifdef CONFIG_MEM_ALLOC_PROFILING + struct alloc_tag *alloc_tag; +#endif + #ifdef CONFIG_SMP int on_cpu; struct __call_single_node wake_entry; @@ -810,6 +814,7 @@ struct task_struct { struct task_group *sched_task_group; #endif + #ifdef CONFIG_UCLAMP_TASK /* * Clamp values requested for a scheduling entity. @@ -2187,4 +2192,23 @@ static inline int sched_core_idle_cpu(int cpu) { return idle_cpu(cpu); } extern void sched_set_stop_task(int cpu, struct task_struct *stop); +#ifdef CONFIG_MEM_ALLOC_PROFILING +static inline struct alloc_tag *alloc_tag_save(struct alloc_tag *tag) +{ + swap(current->alloc_tag, tag); + return tag; +} + +static inline void alloc_tag_restore(struct alloc_tag *tag, struct alloc_tag *old) +{ +#ifdef CONFIG_MEM_ALLOC_PROFILING_DEBUG + WARN(current->alloc_tag != tag, "current->alloc_tag was changed:\n"); +#endif + current->alloc_tag = old; +} +#else +#define alloc_tag_save(_tag) NULL +#define alloc_tag_restore(_tag, _old) do {} while (0) +#endif + #endif |