Changeset 7be8d4d in mainline for kernel/generic/include/mm/as.h


Ignore:
Timestamp:
2018-12-08T23:32:55Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Children:
dd74b5b
Parents:
de0af3a
git-author:
Jiri Svoboda <jiri@…> (2018-12-05 18:39:06)
git-committer:
Jiri Svoboda <jiri@…> (2018-12-08 23:32:55)
Message:

Replace B+tree with ordered dict. for used space

Replace the use of B+tree with ordered dictionary for used space,
adding a little bit more abstraction around used space tracking.
This allows performing TLB shootdown while shrinking an area
in a single sequence. A generic used_space_remove() is no longer
needed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/mm/as.h

    rde0af3a r7be8d4d  
    4545#include <synch/mutex.h>
    4646#include <adt/list.h>
    47 #include <adt/btree.h>
    4847#include <adt/odict.h>
    4948#include <lib/elf.h>
     
    158157} as_pagemap_t;
    159158
     159/** Used space interval */
     160typedef struct {
     161        /** Containing used_space structure */
     162        struct used_space *used_space;
     163        /** Link to @c used_space->ivals */
     164        odlink_t lused_space;
     165        /** First page address */
     166        uintptr_t page;
     167        /** Count of pages */
     168        size_t count;
     169} used_space_ival_t;
     170
     171/** Map of used space in an address space area */
     172typedef struct used_space {
     173        /**
     174         * Dictionary of intervals by start address.
     175         * Members are of type @c used_space_ival_t.
     176         */
     177        odict_t ivals;
     178        /** Total number of used pages. */
     179        size_t pages;
     180} used_space_t;
     181
    160182/**
    161183 * This structure contains information associated with the shared address space
     
    240262        size_t pages;
    241263
    242         /** Number of resident pages in the area. */
    243         size_t resident;
    244 
    245264        /** Base address of this area. */
    246265        uintptr_t base;
    247266
    248267        /** Map of used space. */
    249         btree_t used_space;
     268        used_space_t used_space;
    250269
    251270        /**
     
    313332extern bool as_area_check_access(as_area_t *, pf_access_t);
    314333extern size_t as_area_get_size(uintptr_t);
    315 extern bool used_space_insert(as_area_t *, uintptr_t, size_t);
    316 extern bool used_space_remove(as_area_t *, uintptr_t, size_t);
     334extern used_space_ival_t *used_space_first(used_space_t *);
     335extern used_space_ival_t *used_space_next(used_space_ival_t *);
     336extern used_space_ival_t *used_space_find_gteq(used_space_t *, uintptr_t);
     337extern bool used_space_insert(used_space_t *, uintptr_t, size_t);
    317338
    318339/* Interface to be implemented by architectures. */
Note: See TracChangeset for help on using the changeset viewer.