From patchwork Tue Jan 7 20:52:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 234409 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96140C282DD for ; Tue, 7 Jan 2020 20:59:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 670B22081E for ; Tue, 7 Jan 2020 20:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578430770; bh=UZpOsYdE1Ppqt+5umPPoViX1SlL2qvGaTV670/xBn00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zKjbpq9xrlfSGTYVMt+wpec9pHo6+OQouHvBjcIABwkU81IUvbgNOpxAOeW7ncujR GYI2bfR66uywF5Q59GgmAxD6Qd97uAJ7M6CiQVWASx+Am8YByghR59STeL696oUw44 punwUKkx0+Gx+bjMC4SA5fffdddMMMBrmd1WPhUk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727702AbgAGU73 (ORCPT ); Tue, 7 Jan 2020 15:59:29 -0500 Received: from mail.kernel.org ([198.145.29.99]:60496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728124AbgAGU71 (ORCPT ); Tue, 7 Jan 2020 15:59:27 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D3A5E2087F; Tue, 7 Jan 2020 20:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578430766; bh=UZpOsYdE1Ppqt+5umPPoViX1SlL2qvGaTV670/xBn00=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W55IdET7+x15nMpXs3o4C7RcCW4xsjuTijH0zOj5IpNzE9S5ezQkLkJ33RVr8adFX h1Ec7HNMCmTrffsamBfHn6UOUpCw9yJguxD+YN2XbS1cF5gRXCZXZ6b3KTmsHjw+Cb qbBLOoG/dICwuvF+YKdfc38h49x+aE4HZ0018294= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Tsirakis , Juergen Gross , Boris Ostrovsky , Sasha Levin Subject: [PATCH 5.4 051/191] xen/balloon: fix ballooned page accounting without hotplug enabled Date: Tue, 7 Jan 2020 21:52:51 +0100 Message-Id: <20200107205335.733442762@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205332.984228665@linuxfoundation.org> References: <20200107205332.984228665@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Juergen Gross [ Upstream commit c673ec61ade89bf2f417960f986bc25671762efb ] When CONFIG_XEN_BALLOON_MEMORY_HOTPLUG is not defined reserve_additional_memory() will set balloon_stats.target_pages to a wrong value in case there are still some ballooned pages allocated via alloc_xenballooned_pages(). This will result in balloon_process() no longer be triggered when ballooned pages are freed in batches. Reported-by: Nicholas Tsirakis Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- drivers/xen/balloon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 5bae515c8e25..bed90d612e48 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -395,7 +395,8 @@ static struct notifier_block xen_memory_nb = { #else static enum bp_state reserve_additional_memory(void) { - balloon_stats.target_pages = balloon_stats.current_pages; + balloon_stats.target_pages = balloon_stats.current_pages + + balloon_stats.target_unpopulated; return BP_ECANCELED; } #endif /* CONFIG_XEN_BALLOON_MEMORY_HOTPLUG */