vm: optimise page array size and initialisation.

* the page array now only extends up to the last non-reserved memory frame.
* rather than memset'ing the whole array to zero, we only initialise p_flags
  for each page in vm_page_array_init, and then leave it to group_pages_into_block
  to initialise the other parts of vm_page_t.
This commit is contained in:
2023-02-07 15:58:37 +00:00
parent 51ad3d48fd
commit 9879bbf646
2 changed files with 16 additions and 10 deletions

View File

@@ -10,6 +10,13 @@ static vm_page_t *group_pages_into_block(vm_zone_t *z, phys_addr_t base, phys_ad
vm_page_t *first_page = NULL;
for (phys_addr_t i = base; i < limit; i += VM_PAGE_SIZE) {
vm_page_t *pg = vm_page_get(i);
/* p_flags is the only part of the page that has been
initialised at this point. */
pg->p_order = order;
pg->p_node = z->z_info.zd_node;
pg->p_zone = z->z_info.zd_id;
pg->p_reserved = 0;
if (order != VM_PAGE_MIN_ORDER) {
pg->p_flags |= VM_PAGE_HUGE;
@@ -20,9 +27,8 @@ static vm_page_t *group_pages_into_block(vm_zone_t *z, phys_addr_t base, phys_ad
first_page = pg;
}
pg->p_order = order;
pg->p_node = z->z_info.zd_node;
pg->p_zone = z->z_info.zd_id;
pg->p_list = QUEUE_ENTRY_INIT;
pg->p_slab = NULL;
}
return first_page;