All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Goldstein <cardoe@cardoe.com>
To: xen-devel@lists.xen.org
Cc: Doug Goldstein <cardoe@cardoe.com>
Subject: [PATCH 3/5] tmem: make tmem_freeable_pages() check tmem status
Date: Mon, 14 Mar 2016 15:29:23 -0500	[thread overview]
Message-ID: <1457987365-866-4-git-send-email-cardoe@cardoe.com> (raw)
In-Reply-To: <1457987365-866-1-git-send-email-cardoe@cardoe.com>

Most callers of tmem_freeable_pages() checked to see if tmem was enabled
before calling tmem_freeable_pages() but not all of them did. This
seemed like an oversight and to avoid similar situations like that, stick
the check of tmem into tmem_freeable_pages().

Signed-off-by: Doug Goldstein <cardoe@cardoe.com>
---
CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/common/page_alloc.c | 4 ++--
 xen/common/tmem.c       | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 1e6246e..98e30e5 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 +
-        (tmem_enabled() ? tmem_freeable_pages() : 0) - outstanding_claims;
+        tmem_freeable_pages() - 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 ( tmem_enabled() && ((order == 0) || (order >= 9)) &&
+    if ( ((order == 0) || (order >= 9)) &&
          (total_avail_pages <= midsize_alloc_zone_pages) &&
          tmem_freeable_pages() )
         goto try_tmem;
diff --git a/xen/common/tmem.c b/xen/common/tmem.c
index 0436e49..16e249a 100644
--- a/xen/common/tmem.c
+++ b/xen/common/tmem.c
@@ -2837,6 +2837,9 @@ void *tmem_relinquish_pages(unsigned int order, unsigned int memflags)
 
 unsigned long tmem_freeable_pages(void)
 {
+    if ( !tmem_enabled() )
+        return 0;
+
     return tmem_page_list_pages + _atomic_read(freeable_page_count);
 }
 
-- 
2.4.10


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  parent reply	other threads:[~2016-03-14 20:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 20:29 [PATCH 0/5] Allow tmem to be disabled via Kconfig Doug Goldstein
2016-03-14 20:29 ` [PATCH 1/5] tmem: add tmem_disable() function Doug Goldstein
2016-03-15  8:12   ` Jan Beulich
2016-03-14 20:29 ` [PATCH 2/5] tmem: drop direct usage of opt_tmem Doug Goldstein
2016-03-15  8:15   ` Jan Beulich
2016-03-14 20:29 ` Doug Goldstein [this message]
2016-03-15  8:17   ` [PATCH 3/5] tmem: make tmem_freeable_pages() check tmem status Jan Beulich
2016-03-14 20:29 ` [PATCH 4/5] tmem: don't assume stdbool.h is included Doug Goldstein
2016-03-15  8:23   ` Jan Beulich
2016-03-14 20:29 ` [PATCH 5/5] tmem: allow tmem to be disabled with Kconfig Doug Goldstein
2016-03-15  8:31   ` Jan Beulich
2016-03-15 18:28     ` Doug Goldstein
2016-03-15 19:04     ` Doug Goldstein
2016-03-16  8:36       ` Jan Beulich
2016-03-14 20:46 ` [PATCH 0/5] Allow tmem to be disabled via Kconfig Konrad Rzeszutek Wilk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1457987365-866-4-git-send-email-cardoe@cardoe.com \
    --to=cardoe@cardoe.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.