[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 04/10] mini-os: respect memory map when ballooning up



Juergen Gross, le lun. 06 déc. 2021 08:23:31 +0100, a ecrit:
> @@ -81,8 +93,11 @@ int balloon_up(unsigned long n_pages)
>      if ( n_pages > N_BALLOON_FRAMES )
>          n_pages = N_BALLOON_FRAMES;
>  
> +    start_pfn = e820_get_maxpfn(nr_mem_pages + 1) - 1;
> +    n_pages = e820_get_max_pages(start_pfn, n_pages);

I'd say call it e820_get_max_contig_pages?

> +unsigned long e820_get_max_pages(unsigned long pfn, unsigned long pages)
> +{
> +    int i;
> +    unsigned long end;
> +
> +    for ( i = 0; i < e820_entries; i++ )
> +    {
> +        if ( e820_map[i].type != E820_RAM ||
> +             (e820_map[i].addr >> PAGE_SHIFT) > pfn )
> +            continue;

"> pfn" looks odd to me? If the start of the e820 entry is already
beyond pfn, we'll never find any other entry. We however do want to skip
entries that have addr+size that is below pfn.

> +        end = (e820_map[i].addr + e820_map[i].size) >> PAGE_SHIFT;
> +        return ((end - pfn) > pages) ? pages : end - pfn;
> +    }
> +
> +    return 0;
> +}



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.