Skip to contentSkip to conversation

mm: reducing page_owner structure size

PATCH Applied Ayush Mittal 2 participants 2 messages Oct 10, 2017 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20171010082637epcas5p4b5d588057b336b4056b7bd2f84d52b32@epcas5p4.samsung.com

#1 lore raw

PATCH 1/1 mm: reducing page_owner structure size

Maximum page order can be at max 10 which can be accomodated in short data type(2 bytes).
last_migrate_reason is defined as enum type whose values can be accomodated in short data type (2 bytes).

Total structure size is currently 16 bytes but after changing structure size it goes to 12 bytes.

---
 mm/page_owner.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mm/page_owner.c +2 -2
index 0fd9dcf..4ab438a 100644
@@ -19,9 +19,9 @@
 #define PAGE_OWNER_STACK_DEPTH (16)
 
 struct page_owner {
-	unsigned int order;
+	unsigned short order;
+	short last_migrate_reason;
 	gfp_t gfp_mask;
-	int last_migrate_reason;
 	depot_stack_handle_t handle;
 };
 
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#2 lore raw
Quoted 9 lines · Ayush Mittal

Maximum page order can be at max 10 which can be accomodated in short data type(2 bytes).
last_migrate_reason is defined as enum type whose values can be accomodated in short data type (2 bytes).

Total structure size is currently 16 bytes but after changing structure size it goes to 12 bytes.

Looks like it works, so why not.
Before:

[    0.001000] allocated 50331648 bytes of page_ext
After:
[    0.001000] allocated 41943040 bytes of page_ext
Quoted 11 lines
---
 mm/page_owner.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
mm/page_owner.c +0 -0
index 0fd9dcf..4ab438a 100644
@@ -19,9 +19,9 @@
 #define PAGE_OWNER_STACK_DEPTH (16)

mm/page_owner.c line 27

Quoted 10 lines
mm/page_owner.c +2 -2
 
 struct page_owner {
-	unsigned int order;
+	unsigned short order;
+	short last_migrate_reason;
 	gfp_t gfp_mask;
-	int last_migrate_reason;
 	depot_stack_handle_t handle;
 };
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>