diff mbox

[2/5] tmem: drop direct usage of opt_tmem

Message ID 1457987365-866-3-git-send-email-cardoe@cardoe.com (mailing list archive)
State New, archived
Headers show

Commit Message

Douglas Goldstein March 14, 2016, 8:29 p.m. UTC
Don't use the opt_tmem variable to check if tmem is enabled, instead use
the tmem_enabled() helper function everywhere.

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
CC: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/arch/x86/setup.c    | 2 +-
 xen/common/memory.c     | 2 +-
 xen/common/page_alloc.c | 8 ++++----
 3 files changed, 6 insertions(+), 6 deletions(-)

Comments

Jan Beulich March 15, 2016, 8:15 a.m. UTC | #1
>>> On 14.03.16 at 21:29, <cardoe@cardoe.com> wrote:
> --- a/xen/common/page_alloc.c
> +++ b/xen/common/page_alloc.c
> @@ -652,7 +652,7 @@ static void __init setup_low_mem_virq(void)
>  static void check_low_mem_virq(void)
>  {
>      unsigned long avail_pages = total_avail_pages +
> -        (opt_tmem ? tmem_freeable_pages() : 0) - outstanding_claims;
> +        (tmem_enabled() ? tmem_freeable_pages() : 0) - outstanding_claims;

Would seem more natural to simply have tmem_freeable_pages()
return zero when tmem is build-time disabled (the more that for
the build to not fail you need a stub for that function anyway).

Jan
diff mbox

Patch

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5485468..7181624 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1243,7 +1243,7 @@  void __init noreturn __start_xen(unsigned long mbi_p)
             init_domheap_pages(s, e);
         }
 
-        if ( opt_tmem )
+        if ( tmem_enabled() )
         {
            printk(XENLOG_WARNING
                   "TMEM physical RAM limit exceeded, disabling TMEM\n");
diff --git a/xen/common/memory.c b/xen/common/memory.c
index ef57219..c7fca96 100644
--- a/xen/common/memory.c
+++ b/xen/common/memory.c
@@ -202,7 +202,7 @@  static void populate_physmap(struct memop_args *a)
 
                 if ( unlikely(!page) )
                 {
-                    if ( !opt_tmem || a->extent_order )
+                    if ( !tmem_enabled() || a->extent_order )
                         gdprintk(XENLOG_INFO,
                                  "Could not allocate order=%u extent: id=%d memflags=%#x (%u of %u)\n",
                                  a->extent_order, d->domain_id, a->memflags,
diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 22e8feb..1e6246e 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -652,7 +652,7 @@  static void __init setup_low_mem_virq(void)
 static void check_low_mem_virq(void)
 {
     unsigned long avail_pages = total_avail_pages +
-        (opt_tmem ? tmem_freeable_pages() : 0) - outstanding_claims;
+        (tmem_enabled() ? tmem_freeable_pages() : 0) - outstanding_claims;
 
     if ( unlikely(avail_pages <= low_mem_virq_th) )
     {
@@ -738,7 +738,7 @@  static struct page_info *alloc_heap_pages(
      * Others try tmem pools then fail.  This is a workaround until all
      * post-dom0-creation-multi-page allocations can be eliminated.
      */
-    if ( opt_tmem && ((order == 0) || (order >= 9)) &&
+    if ( tmem_enabled() && ((order == 0) || (order >= 9)) &&
          (total_avail_pages <= midsize_alloc_zone_pages) &&
          tmem_freeable_pages() )
         goto try_tmem;
@@ -984,7 +984,7 @@  static void free_heap_pages(
     avail[node][zone] += 1 << order;
     total_avail_pages += 1 << order;
 
-    if ( opt_tmem )
+    if ( tmem_enabled() )
         midsize_alloc_zone_pages = max(
             midsize_alloc_zone_pages, total_avail_pages / MIDSIZE_ALLOC_FRAC);
 
@@ -1755,7 +1755,7 @@  int assign_pages(
     {
         if ( unlikely((d->tot_pages + (1 << order)) > d->max_pages) )
         {
-            if ( !opt_tmem || order != 0 || d->tot_pages != d->max_pages )
+            if ( !tmem_enabled() || order != 0 || d->tot_pages != d->max_pages )
                 gprintk(XENLOG_INFO, "Over-allocation for domain %u: "
                         "%u > %u\n", d->domain_id,
                         d->tot_pages + (1 << order), d->max_pages);