linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched/task_struct: Move alloc_tag to the end of the struct.
@ 2024-06-21 10:27 Sebastian Andrzej Siewior
  2024-06-21 14:20 ` Kent Overstreet
  2024-06-28  9:49 ` Sebastian Andrzej Siewior
  0 siblings, 2 replies; 15+ messages in thread
From: Sebastian Andrzej Siewior @ 2024-06-21 10:27 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Andrew Morton, Ben Segall, Daniel Bristot de Oliveira,
	Dietmar Eggemann, Ingo Molnar, Juri Lelli, Kent Overstreet,
	Klara Modin, Mel Gorman, Peter Zijlstra, Steven Rostedt,
	Suren Baghdasaryan, Thomas Gleixner, Valentin Schneider,
	Vincent Guittot

The alloc_tag member has been added to task_struct at the very
beginning. This is a pointer and on 64bit architectures it forces 4 byte
padding after `ptrace' and then forcing another another 4 byte padding
after `on_cpu'. A few members later, `se' requires a cacheline aligned
due to struct sched_avg resulting in 52 hole before `se'.

This is the case on 64bit-SMP architectures.
The 52 byte hole can be avoided by moving alloc_tag away where it
currently resides.

Move alloc_tag to the end of task_struct. There is likely a hole before
`thread' due to its alignment requirement and the previous members are
likely to be already pointer-aligned.

Fixes: 22d407b164ff7 ("lib: add allocation tagging support for memory allocation profiling")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 include/linux/sched.h | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 61591ac6eab6d..d76c61510ef1d 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -770,10 +770,6 @@ 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;
@@ -1553,6 +1549,9 @@ struct task_struct {
 #ifdef CONFIG_USER_EVENTS
 	struct user_event_mm		*user_event_mm;
 #endif
+#ifdef CONFIG_MEM_ALLOC_PROFILING
+	struct alloc_tag		*alloc_tag;
+#endif
 
 	/*
 	 * New fields for task_struct should be added above here, so that
-- 
2.45.2



^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-07-01  8:05 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-21 10:27 [PATCH] sched/task_struct: Move alloc_tag to the end of the struct Sebastian Andrzej Siewior
2024-06-21 14:20 ` Kent Overstreet
2024-06-21 18:29   ` Sebastian Andrzej Siewior
2024-06-21 18:49     ` Kent Overstreet
2024-06-21 19:07       ` Sebastian Andrzej Siewior
2024-06-21 19:13         ` Kent Overstreet
2024-06-21 19:22           ` Sebastian Andrzej Siewior
2024-06-28  9:49 ` Sebastian Andrzej Siewior
2024-06-28 19:20   ` Andrew Morton
2024-06-28 19:35   ` Kent Overstreet
2024-06-28 19:55     ` Sebastian Andrzej Siewior
2024-06-28 20:20       ` Kent Overstreet
2024-06-30 21:11         ` Sebastian Andrzej Siewior
2024-06-30 21:23           ` Kent Overstreet
2024-07-01  8:05             ` Sebastian Andrzej Siewior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).