• Olaf Hering's avatar
    xenpaging: use flat index for pagefile and page-in requests · 3bf345e6
    Olaf Hering authored
    This change is based on an idea by <hongkaixing@huawei.com> and
    <bicky.shi@huawei.com>.
    
    Scanning the victims[] array is time consuming with a large number of
    target pages. Replace the loop to find the slot in the pagefile which
    holds the requested gfn with an index.
    
    Remove the victims array and replace it with a flat array. This array
    holds the gfn for a given slot in the pagefile. Adjust all users of the
    victims array.
    
    Rename variable in main() from i to slot to clearify the meaning.
    
    Update xenpaging_evict_page() to pass a pointer to xen_pfn_t to
    xc_map_foreign_pages().
    
    Update policy_choose_victim() to return either a gfn or INVALID_MFN.
    Signed-off-by: default avatarOlaf Hering <olaf@aepfle.de>
    Committed-by: Ian Jackson <ian.jackson.citrix.com>
    3bf345e6