|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/7] xen/mm: Normalize common per-domain page counters to unsigned long
Prepare common code for >16 TiB domains by normalizing the per-domain
page counts in struct domain (tot_pages, xenheap_pages, extra_pages,
outstanding_pages, max_pages, node_claims and claims[MAX_NUMNODES])
to unsigned long and update related code accordingly:
- Update format specifiers for widened types across affected files. NB:
- shr_pages and paged_pages are atomic_t; their formats are %d.
- pod.entry_count in p2m-pod.c is unsigned long; %lu is correct.
Updates for domain_tot_pages():
- unsigned int domain_tot_pages(d) -> unsigned long domain_tot_pages(d).
- assign_pages(): Assign domain_tot_pages(d) to unsigned long likewise.
- sh_min_allocation(): 0U -> 0UL for unsigned long domain_tot_pages().
Suggested-by: Jan Beulich <jbeulich@xxxxxxxx>
Signed-off-by: Bernhard Kaindl <bernhard.kaindl@xxxxxxxxxx>
---
xen/arch/x86/mm/p2m-pod.c | 2 +-
xen/arch/x86/mm/shadow/common.c | 2 +-
xen/common/grant_table.c | 2 +-
xen/common/keyhandler.c | 8 ++++----
xen/common/numa.c | 2 +-
xen/common/page_alloc.c | 8 ++++----
xen/include/xen/sched.h | 16 ++++++++--------
7 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/xen/arch/x86/mm/p2m-pod.c b/xen/arch/x86/mm/p2m-pod.c
index 7a0bebd2d3b5..14d18b726e80 100644
--- a/xen/arch/x86/mm/p2m-pod.c
+++ b/xen/arch/x86/mm/p2m-pod.c
@@ -1270,7 +1270,7 @@ p2m_pod_demand_populate(struct p2m_domain *p2m, gfn_t gfn,
out_of_memory:
pod_unlock_and_flush(p2m);
- printk("%s: Dom%d out of PoD memory! (tot=%"PRIu32" ents=%ld dom%d)\n",
+ printk("%s: Dom%d out of PoD memory! (tot=%lu ents=%lu dom%d)\n",
__func__, d->domain_id, domain_tot_pages(d),
p2m->pod.entry_count, current->domain->domain_id);
domain_crash(d);
diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
index ed698fa90bc7..e300898fe789 100644
--- a/xen/arch/x86/mm/shadow/common.c
+++ b/xen/arch/x86/mm/shadow/common.c
@@ -768,7 +768,7 @@ static unsigned int sh_min_allocation(const struct domain
*d)
* up of slot zero and an LAPIC page), plus one for HVM's 1-to-1 pagetable.
*/
unsigned int extra = max(domain_tot_pages(d) / 256,
- is_hvm_domain(d) ? CONFIG_PAGING_LEVELS + 2 : 0U)
+
+ is_hvm_domain(d) ? CONFIG_PAGING_LEVELS + 2 :
0UL) +
is_hvm_domain(d);
return shadow_min_acceptable_pages(d) +
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ac9fed600101..3c1f8876da22 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -2396,7 +2396,7 @@ gnttab_transfer(
e->domain_id);
else
gdprintk(XENLOG_INFO,
- "Transferee %pd has no headroom (tot %u, max %u, ex
%u)\n",
+ "Transferee %pd has no headroom (tot %lu, max %lu, ex
%lu)\n",
e, domain_tot_pages(e), e->max_pages, e->extra_pages);
gop.status = GNTST_general_error;
diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c
index cb6df2823b00..b1cb9e7ba8d9 100644
--- a/xen/common/keyhandler.c
+++ b/xen/common/keyhandler.c
@@ -278,14 +278,14 @@ static void cf_check dump_domains(unsigned char key)
printk(" refcnt=%d dying=%d pause_count=%d\n",
atomic_read(&d->refcnt), d->is_dying,
atomic_read(&d->pause_count));
- printk(" nr_pages=%u xenheap_pages=%u"
+ printk(" nr_pages=%lu xenheap_pages=%lu"
#ifdef CONFIG_MEM_SHARING
- " shared_pages=%u"
+ " shared_pages=%d"
#endif
#ifdef CONFIG_MEM_PAGING
- " paged_pages=%u"
+ " paged_pages=%d"
#endif
- " dirty_cpus={%*pbl} max_pages=%u\n",
+ " dirty_cpus={%*pbl} max_pages=%lu\n",
domain_tot_pages(d), d->xenheap_pages,
#ifdef CONFIG_MEM_SHARING
atomic_read(&d->shr_pages),
diff --git a/xen/common/numa.c b/xen/common/numa.c
index ad75955a1622..8c561578615c 100644
--- a/xen/common/numa.c
+++ b/xen/common/numa.c
@@ -743,7 +743,7 @@ static void cf_check dump_numa(unsigned char key)
process_pending_softirqs();
- printk("%pd (total: %u):\n", d, domain_tot_pages(d));
+ printk("%pd (total: %lu):\n", d, domain_tot_pages(d));
memset(page_num_node, 0, sizeof(page_num_node));
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1801afc96a0a..3f8b300d8c29 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2892,11 +2892,11 @@ int assign_pages(
}
else if ( !(memflags & MEMF_no_refcount) )
{
- unsigned int tot_pages = domain_tot_pages(d);
+ unsigned long tot_pages = domain_tot_pages(d);
if ( unlikely(tot_pages > d->max_pages) )
{
- gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %u > %u\n",
+ gprintk(XENLOG_INFO, "Inconsistent allocation for %pd: %lu >
%lu\n",
d, tot_pages, d->max_pages);
rc = -EPERM;
goto out;
@@ -2904,7 +2904,7 @@ int assign_pages(
if ( unlikely(nr > d->max_pages - tot_pages) )
{
- gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %u\n",
+ gprintk(XENLOG_INFO, "Over-allocation for %pd: %Lu > %lu\n",
d, tot_pages + 0ULL + nr, d->max_pages);
rc = -E2BIG;
goto out;
@@ -2916,7 +2916,7 @@ int assign_pages(
if ( unlikely(d->tot_pages + nr < nr) )
{
gprintk(XENLOG_INFO,
- "Excess allocation for %pd: %Lu (%u extra)\n",
+ "Excess allocation for %pd: %Lu (%lu extra)\n",
d, d->tot_pages + 0ULL + nr, d->extra_pages);
if ( pg[0].count_info & PGC_extra )
d->extra_pages -= nr;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index f671e0c4c7b3..ee9d4a7ff9e3 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -414,17 +414,17 @@ struct domain
* This field should only be directly accessed by domain_adjust_tot_pages()
* and the domain_tot_pages() helper function defined below.
*/
- unsigned int tot_pages;
+ unsigned long tot_pages;
- unsigned int xenheap_pages; /* pages allocated from Xen heap */
+ unsigned long xenheap_pages; /* pages allocated from Xen heap */
/* Pages claimed but not possessed, protected by global heap_lock. */
- unsigned int outstanding_pages;
- unsigned int node_claims; /* Sum of per-node claims. */
+ unsigned long outstanding_pages;
+ unsigned long node_claims; /* Sum of per-node claims. */
/* Domain objects use dedicated pages, leaving room for per-node claims. */
- unsigned int claims[MAX_NUMNODES]; /* Per-NUMA-node claims. */
+ unsigned long claims[MAX_NUMNODES]; /* Per-NUMA-node claims. */
- unsigned int max_pages; /* maximum value for
domain_tot_pages() */
- unsigned int extra_pages; /* pages not included in
domain_tot_pages() */
+ unsigned long max_pages; /* maximum value for
domain_tot_pages() */
+ unsigned long extra_pages; /* pages not included in
domain_tot_pages() */
#ifdef CONFIG_MEM_SHARING
atomic_t shr_pages; /* shared pages */
@@ -691,7 +691,7 @@ static inline struct page_list_head *page_to_list(
}
/* Return number of pages currently posessed by the domain */
-static inline unsigned int domain_tot_pages(const struct domain *d)
+static inline unsigned long domain_tot_pages(const struct domain *d)
{
ASSERT(d->extra_pages <= d->tot_pages);
--
2.39.5
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |