From patchwork Tue Mar 15 20:18:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Goldstein X-Patchwork-Id: 8592351 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 194889F294 for ; Tue, 15 Mar 2016 20:23:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 24958203C4 for ; Tue, 15 Mar 2016 20:23:25 +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 324DA203B5 for ; Tue, 15 Mar 2016 20:23:24 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1afvSp-0003ER-Dj; Tue, 15 Mar 2016 20:21:11 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1afvSp-0003EF-2Q for xen-devel@lists.xen.org; Tue, 15 Mar 2016 20:21:11 +0000 Received: from [193.109.254.147] by server-9.bemta-14.messagelabs.com id 52/01-02984-6BE68E65; Tue, 15 Mar 2016 20:21:10 +0000 X-Env-Sender: cardoe@cardoe.com X-Msg-Ref: server-11.tower-27.messagelabs.com!1458073268!22841722!1 X-Originating-IP: [209.85.161.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.11; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25639 invoked from network); 15 Mar 2016 20:21:09 -0000 Received: from mail-yw0-f177.google.com (HELO mail-yw0-f177.google.com) (209.85.161.177) by server-11.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 15 Mar 2016 20:21:09 -0000 Received: by mail-yw0-f177.google.com with SMTP id m126so12102609ywd.0 for ; Tue, 15 Mar 2016 13:21:09 -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=5C76cUqop+8qYtiQbAQOOBD0wKFp8vavvLgd82lN0eo=; b=eGo8jwAhGShnaSE6JpHMpjlO+YCCggDWG44L5K9qNm84YzqUp0au2YvsFxwWoISB1R dPXb1zPO0ea7v2c3zzd/HyRpnCh/jknNAa2YUzLZ9cHpEZubJA/CbvdVE4R8Mbv6qMKs qEaplonKpZHuqnrztq0GfeD9/D9X6TEGY9iKo= 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=5C76cUqop+8qYtiQbAQOOBD0wKFp8vavvLgd82lN0eo=; b=J4U2We0Fe2V4Oa4KmMeR/EZ7chtqsYBLId0DaukTOIMr5wCGFTjHEGijhL/wnLZsl6 9sX8q5vGVvajgqKMF+fC9Ba+YIHe9alvUEFwSdSETPZA8J173FmA8BqoXO+RFvtrgR4E d3ohft9c6mN/dfnIfYcWrsqwzL9n23p3dS1/SQJd+W0knTkeEnXm2Gs/PfKlF0v3p7+e dw53/1u1etyoLd32fB1sbMKjGwPTt1JYaoce6tp2dXm/EF61aA4tZjt4WmJA0gx3DEXo aSuUEmj5NjbaZgbTzGPii5Ps3QMKES74A+dF2CYYtdnxwABYccm/MyxwN3pc/qvPOZzw Ehpg== X-Gm-Message-State: AD7BkJIEHcInpYeWE0G8C9I+TkArLwQD60LQ4xm1ZKu5lJB8yZ+wykFRpfpjATO6Juttsw== X-Received: by 10.13.245.135 with SMTP id e129mr18487082ywf.106.1458073268466; Tue, 15 Mar 2016 13:21:08 -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 v63sm18188276ywf.40.2016.03.15.13.20.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 15 Mar 2016 13:20:43 -0700 (PDT) From: Doug Goldstein To: xen-devel@lists.xen.org Date: Tue, 15 Mar 2016 15:18:49 -0500 Message-Id: <1458073130-5126-3-git-send-email-cardoe@cardoe.com> X-Mailer: git-send-email 2.4.10 In-Reply-To: <1458073130-5126-1-git-send-email-cardoe@cardoe.com> References: <1458073130-5126-1-git-send-email-cardoe@cardoe.com> Cc: Keir Fraser , Doug Goldstein , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH v2 2/3] tmem: drop direct usage of opt_tmem 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 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 Acked-by: Jan Beulich --- CC: Keir Fraser CC: Jan Beulich CC: Andrew Cooper CC: Konrad Rzeszutek Wilk change since v1: - merged patch 2 and 3 --- xen/arch/x86/setup.c | 2 +- xen/common/memory.c | 2 +- xen/common/page_alloc.c | 8 ++++---- xen/common/tmem.c | 3 +++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 5011930..c5c332d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1272,7 +1272,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..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 + - (opt_tmem ? 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 ( opt_tmem && ((order == 0) || (order >= 9)) && + if ( ((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); 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); }