libxc: fix PV vNUMA guest memory allocation

In 415b58c1 (tools/libxc: Batch memory allocations for PV guests) the
number of super pages is calculated with the number of total pages. That
is wrong. It breaks PV guest vNUMA. The correct number of super pages
should be derived from the number of pages within that virtual NUMA
node.

Also change the name and type of super page variable to match the naming
convention and type of normal page variable. Make the necessary
adjustment to make code compile.

Reported-by: Dario Faggioli <dario.faggioli@citrix.com>
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-and-Tested-by: Dario Faggioli <dario.faggioli@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
This commit is contained in:
Wei Liu authored and Ian Campbell committed 2015-07-07 15:10:45 +01:00
1 parent 6a6c199a89
commit 826ca36fa3
1 file changed
+6 -5
+6 -5
View File
@@ -879,9 +879,8 @@ int arch_setup_meminit(struct xc_dom_image *dom)
for ( i = 0; i < nr_vmemranges; i++ )
{
unsigned int memflags;
uint64_t pages;
uint64_t pages, super_pages;
unsigned int pnode = vnode_to_pnode[vmemranges[i].nid];
int nr_spages = dom->total_pages >> SUPERPAGE_PFN_SHIFT;
xen_pfn_t extents[SUPERPAGE_BATCH_SIZE];
xen_pfn_t pfn_base_idx;
@@ -891,15 +890,17 @@ int arch_setup_meminit(struct xc_dom_image *dom)
pages = (vmemranges[i].end - vmemranges[i].start)
>> PAGE_SHIFT;
super_pages = pages >> SUPERPAGE_PFN_SHIFT;
pfn_base = vmemranges[i].start >> PAGE_SHIFT;
for ( pfn = pfn_base; pfn < pfn_base+pages; pfn++ )
dom->p2m_host[pfn] = pfn;
pfn_base_idx = pfn_base;
while (nr_spages) {
int count = min(nr_spages, SUPERPAGE_BATCH_SIZE);
nr_spages -= count;
while (super_pages) {
uint64_t count =
min_t(uint64_t, super_pages,SUPERPAGE_BATCH_SIZE);
super_pages -= count;
for ( pfn = pfn_base_idx, j = 0;
pfn < pfn_base_idx + (count << SUPERPAGE_PFN_SHIFT);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.