Pager struct allocated from boot memory and never referenced after boot.

We still have to have the pager structs because they possess intermediate
data during boot up such as for transferring of capability lists to
boot stack one-by-one, and then to newly generated ktcbs.
This commit is contained in:
Bahadir Balban
2009-11-03 15:09:28 +02:00
parent 6c69f181db
commit 9248328dd3
3 changed files with 10 additions and 2 deletions

View File

@@ -48,8 +48,8 @@ struct container {
struct id_pool *space_id_pool;
struct mutex_queue_head mutex_queue_head; /* Userspace mutex list */
struct cap_list cap_list; /* Capabilities shared by whole container */
struct pager pager[CONFIG_MAX_PAGERS_USED];
struct cap_list cap_list; /* Capabilities shared by whole container */
struct pager *pager; /* Boot-time array of pagers */
};
/* Compact, raw capability structure */

View File

@@ -7,6 +7,7 @@
#include <l4/generic/resource.h>
#include <l4/generic/capability.h>
#include <l4/generic/cap-types.h>
#include <l4/generic/bootmem.h>
#include <l4/api/errno.h>
#include INC_GLUE(memory.h)
#include INC_SUBARCH(mm.h)
@@ -25,6 +26,8 @@ int container_init(struct container *c)
cap_list_init(&c->cap_list);
/* Init pager structs */
c->pager = alloc_bootmem(sizeof(c->pager[0]) *
CONFIG_MAX_PAGERS_USED, 0);
for (int i = 0; i < CONFIG_MAX_PAGERS_USED; i++)
cap_list_init(&c->pager[i].cap_list);

View File

@@ -319,6 +319,7 @@ int memcap_map(struct cap_list *cap_list,
/* Delete all boot memory and add it to physical memory pool. */
int free_boot_memory(struct kernel_resources *kres)
{
struct container *c;
unsigned long pfn_start =
__pfn(virt_to_phys(_start_init));
unsigned long pfn_end =
@@ -334,6 +335,10 @@ int free_boot_memory(struct kernel_resources *kres)
for (unsigned long i = pfn_start; i < pfn_end; i++)
remove_mapping(phys_to_virt(__pfn_to_addr(i)));
/* Reset pointers that will remain in system as precaution */
list_foreach_struct(c, &kres->containers.list, list)
c->pager = 0;
printk("%s: Freed %lu KB init memory.\n",
__KERNELNAME__,
__pfn_to_addr((pfn_end - pfn_start)) / 1024);