From patchwork Mon Mar 14 20:29:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 8583771 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B763C0553 for ; Mon, 14 Mar 2016 20:32:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7DF56202E5 for ; Mon, 14 Mar 2016 20:32:40 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9A0F620212 for ; Mon, 14 Mar 2016 20:32:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1afZ7Z-0008Go-HV; Mon, 14 Mar 2016 20:29:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.84) (envelope-from ) id 1afZ7Y-0008GD-6J for xen-devel@lists.xen.org; Mon, 14 Mar 2016 20:29:44 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 34/3E-25417-73F17E65; Mon, 14 Mar 2016 20:29:43 +0000 X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1457987382!12855934!1 X-Originating-IP: [209.85.161.193] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20040 invoked from network); 14 Mar 2016 20:29:42 -0000 Received: from mail-yw0-f193.google.com (HELO mail-yw0-f193.google.com) (209.85.161.193) by server-2.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 14 Mar 2016 20:29:42 -0000 Received: by mail-yw0-f193.google.com with SMTP id s188so12843137ywe.2 for ; Mon, 14 Mar 2016 13:29:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cardoe.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sW6jLgDoRE5K8d3iPTZP8tUFumK23zq1pBdwKTwqZmU=; b=UudjgcXVUQaYBK/0Y3N44UCYKVdmXJ5mnOv777OlFpbdLyuL/Mtsu4KQd4uoGfH1Sg iTCiDWgWFyvup3zQgRs0uQA3gzFI/IIv0gBJr/B3GqZCVp1T220AOU7FSoNGtmZmysQg pc5kWvktk8XPRDzebHgKj+7daevw1ZrfZkakc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sW6jLgDoRE5K8d3iPTZP8tUFumK23zq1pBdwKTwqZmU=; b=S6eYeg2pFTy3zD196LwwhMaJDflUdSj6yrSkR1kkBc6QxVg4UtwG9/bv28/ktnWZJd HDITXvH+Z7OA0QjQojjtiWl5mDNSxy7eXc/Tk9rLcZGxZ/XsC1dQaF3kjvley1LyIlGg 8zN/Y2S3A2p7qPOY2/gVqh3hV9lSRcSvwTQwXdxruykmF/GTAheajJCgGZmsmLHIaXUu fZkG/j053HCWiozN+FH4CRtpsdzP3DztgCLPDjv3fhN/4uE1Cxo3o7KvpnQVqjdSm/9n p5yB5ENlLPvtybjEODtuuqNeO7ZSeh5EvVssho0wkLn+U1QSenIH0DoSv9iCDZ8t9c/L ryYg== X-Gm-Message-State: AD7BkJIu0kztWS3o5VECL49/DNItP3GMLtj130BNzXQ9Ad5GS5sqJDLxtCtOc58RU8BdwQ== X-Received: by 10.37.80.137 with SMTP id e131mr5240102ybb.61.1457987381881; Mon, 14 Mar 2016 13:29:41 -0700 (PDT) Received: from swanson.lan (c-68-46-196-185.hsd1.al.comcast.net. [68.46.196.185]) by smtp.gmail.com with ESMTPSA id v63sm15131124ywf.40.2016.03.14.13.29.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 14 Mar 2016 13:29:40 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Mon, 14 Mar 2016 15:29:23 -0500 Message-Id: <1457987365-866-4-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1457987365-866-1-git-send-email-cardoe@cardoe.com> References: <1457987365-866-1-git-send-email-cardoe@cardoe.com> Cc: Doug Goldstein Subject: [Xen-devel] [PATCH 3/5] tmem: make tmem_freeable_pages() check tmem status X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- CC: Konrad Rzeszutek Wilk --- 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); }