diff mbox series

[1/2] mm/kmemleak: Compact kmemleak_object further

Message ID 20240307190548.963626-2-longman@redhat.com (mailing list archive)
State New
Headers show
Series mm/kmemleak: Minor cleanup & performance tuning | expand

Commit Message

Waiman Long March 7, 2024, 7:05 p.m. UTC
With commit 56a61617dd22 ("mm: use stack_depot for recording kmemleak's
backtrace"), the size of kmemleak_object has been reduced by 128 bytes
for 64-bit arches. The replacement "depot_stack_handle_t trace_handle"
is actually just 4 bytes long leaving a hole of 4 bytes. By moving up
trace_handle to another existing 4-byte hold, we can save 8 more bytes
from kmemleak_object reducing its overall size from 248 to 240 bytes.

Signed-off-by: Waiman Long <longman@redhat.com>
---
 mm/kmemleak.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Catalin Marinas March 26, 2024, 5:33 p.m. UTC | #1
On Thu, Mar 07, 2024 at 02:05:47PM -0500, Waiman Long wrote:
> With commit 56a61617dd22 ("mm: use stack_depot for recording kmemleak's
> backtrace"), the size of kmemleak_object has been reduced by 128 bytes
> for 64-bit arches. The replacement "depot_stack_handle_t trace_handle"
> is actually just 4 bytes long leaving a hole of 4 bytes. By moving up
> trace_handle to another existing 4-byte hold, we can save 8 more bytes
> from kmemleak_object reducing its overall size from 248 to 240 bytes.
> 
> Signed-off-by: Waiman Long <longman@redhat.com>

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
diff mbox series

Patch

diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 4f58f6170cdf..0114a694e520 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -158,9 +158,9 @@  struct kmemleak_object {
 	int count;
 	/* checksum for detecting modified objects */
 	u32 checksum;
+	depot_stack_handle_t trace_handle;
 	/* memory ranges to be scanned inside an object (empty for all) */
 	struct hlist_head area_list;
-	depot_stack_handle_t trace_handle;
 	unsigned long jiffies;		/* creation timestamp */
 	pid_t pid;			/* pid of the current task */
 	char comm[TASK_COMM_LEN];	/* executable name */