sandbox: vm: reduce vm_page order field size to 4 bits
This commit is contained in:
@@ -60,9 +60,15 @@ typedef enum vm_page_order {
|
|||||||
VM_PAGE_32M,
|
VM_PAGE_32M,
|
||||||
VM_PAGE_64M,
|
VM_PAGE_64M,
|
||||||
VM_PAGE_128M,
|
VM_PAGE_128M,
|
||||||
|
#if 0
|
||||||
|
/* vm_page_t only has 4 bits to store the page order with.
|
||||||
|
the maximum order that can be stored in 4 bits is 15 (VM_PAGE_128M)
|
||||||
|
to use any of the page orders listed here, this field
|
||||||
|
will have to be expanded. */
|
||||||
VM_PAGE_256M,
|
VM_PAGE_256M,
|
||||||
VM_PAGE_512M,
|
VM_PAGE_512M,
|
||||||
VM_PAGE_1G,
|
VM_PAGE_1G,
|
||||||
|
#endif
|
||||||
VM_PAGE_MIN_ORDER = VM_PAGE_4K,
|
VM_PAGE_MIN_ORDER = VM_PAGE_4K,
|
||||||
VM_PAGE_MAX_ORDER = VM_PAGE_8M,
|
VM_PAGE_MAX_ORDER = VM_PAGE_8M,
|
||||||
} vm_page_order_t;
|
} vm_page_order_t;
|
||||||
@@ -110,18 +116,25 @@ typedef enum vm_page_flags {
|
|||||||
} vm_page_flags_t;
|
} vm_page_flags_t;
|
||||||
|
|
||||||
typedef struct vm_page {
|
typedef struct vm_page {
|
||||||
|
/* order of the page block that this page belongs too */
|
||||||
|
uint16_t p_order : 4;
|
||||||
/* the id of the NUMA node that this page belongs to */
|
/* the id of the NUMA node that this page belongs to */
|
||||||
uint32_t p_node : 6;
|
uint16_t p_node : 6;
|
||||||
/* the id of the memory zone that this page belongs to */
|
/* the id of the memory zone that this page belongs to */
|
||||||
uint32_t p_zone : 2;
|
uint16_t p_zone : 3;
|
||||||
/* vm_page_flags_t bitfields. */
|
/* some unused bits */
|
||||||
uint32_t p_flags : 24;
|
uint16_t p_reserved : 3;
|
||||||
|
|
||||||
/* buddy allocator free page list head (vm_zone_t->z_free_pages[p_order]) */
|
/* vm_page_flags_t bitfields. */
|
||||||
|
uint32_t p_flags;
|
||||||
|
|
||||||
|
/* multi-purpose list.
|
||||||
|
the owner of the page can decide what to do with this.
|
||||||
|
some examples:
|
||||||
|
- the buddy allocator uses this to maintain its per-zone free-page lists.
|
||||||
|
*/
|
||||||
queue_entry_t p_free_list;
|
queue_entry_t p_free_list;
|
||||||
|
|
||||||
/* order of the page block that this page belongs too */
|
|
||||||
unsigned char p_order;
|
|
||||||
} __attribute__((aligned(2 * sizeof(unsigned long)))) vm_page_t;
|
} __attribute__((aligned(2 * sizeof(unsigned long)))) vm_page_t;
|
||||||
|
|
||||||
extern kern_status_t vm_bootstrap(const vm_zone_descriptor_t *zones, size_t nr_zones);
|
extern kern_status_t vm_bootstrap(const vm_zone_descriptor_t *zones, size_t nr_zones);
|
||||||
|
|||||||
@@ -28,9 +28,15 @@ static size_t page_order_bytes[] = {
|
|||||||
[VM_PAGE_32M] = 0x2000000,
|
[VM_PAGE_32M] = 0x2000000,
|
||||||
[VM_PAGE_64M] = 0x4000000,
|
[VM_PAGE_64M] = 0x4000000,
|
||||||
[VM_PAGE_128M] = 0x8000000,
|
[VM_PAGE_128M] = 0x8000000,
|
||||||
|
#if 0
|
||||||
|
/* vm can support pages of this size, but
|
||||||
|
vm_page_t only has 4 bits with which to store
|
||||||
|
the page order, which cannot accomodate these
|
||||||
|
larger order numbers */
|
||||||
[VM_PAGE_256M] = 0x10000000,
|
[VM_PAGE_256M] = 0x10000000,
|
||||||
[VM_PAGE_512M] = 0x20000000,
|
[VM_PAGE_512M] = 0x20000000,
|
||||||
[VM_PAGE_1G] = 0x40000000,
|
[VM_PAGE_1G] = 0x40000000,
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void vm_page_init_array()
|
void vm_page_init_array()
|
||||||
|
|||||||
Reference in New Issue
Block a user