Objective --------- The current implementation of struct vmap_area wasted space. After applying this commit, sizeof(struct vmap_area) has been reduced from 11 words to 8 words. Description ----------- 1) Pack "subtree_max_size", "vm" and "purge_list". This is no problem because A) "subtree_max_size" is only used when vmap_area is in "free" tree B) "vm" is only used when vmap_area is in "busy" tree C) "purge_list" is only used when vmap_area is in vmap_purge_list 2) Eliminate "flags". ;Since only one flag VM_VM_AREA is being used, and the same thing can be done by judging whether "vm" is NULL, then the "flags" can be eliminated.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -53,15 +53,21 @@ struct vmap_area { · 52 unmodified lines | |||
| 53 | unsigned long va_start; | 53 | unsigned long va_start; |
| 54 | unsigned long va_end; | 54 | unsigned long va_end; |
| 55 | 55 | ||
| 56 | /* | ||
| 57 | * Largest available free size in subtree. | ||
| 58 | */ | ||
| 59 | unsigned long subtree_max_size; | ||
| 60 | unsigned long flags; | ||
| 61 | struct rb_node rb_node; /* address sorted rbtree */ | 56 | struct rb_node rb_node; /* address sorted rbtree */ |
| 62 | struct list_head list; /* address sorted list */ | 57 | struct list_head list; /* address sorted list */ |
| 63 | struct llist_node purge_list; /* "lazy purge" list */ | 58 | |
| 64 | struct vm_struct *vm; | 59 | /* |
| 60 | * The following three variables can be packed, because | ||
| 61 | * a vmap_area object is always one of the three states: | ||
| 62 | * 1) in "free" tree (root is vmap_area_root) | ||
| 63 | * 2) in "busy" tree (root is free_vmap_area_root) | ||
| 64 | * 3) in purge list (head is vmap_purge_list) | ||
| 65 | */ | ||
| 66 | union { | ||
| 67 | unsigned long subtree_max_size; /* in "free" tree */ | ||
| 68 | struct vm_struct *vm; /* in "busy" tree */ | ||
| 69 | struct llist_node purge_list; /* in purge list */ | ||
| 70 | }; | ||
| 65 | }; | 71 | }; |
| 66 | 72 | ||
| 67 | /* | 73 | /* |