Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1158300ybh; Thu, 23 Jul 2020 01:46:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIXrW5ELJj5NyM93YiaNGMi5m3yR8+hy3bsq8zjDtWHfF1/zSF7hNTDjK55H1hHb0iEoSF X-Received: by 2002:a17:906:6847:: with SMTP id a7mr3310805ejs.306.1595493981759; Thu, 23 Jul 2020 01:46:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595493981; cv=none; d=google.com; s=arc-20160816; b=nTxmLnCs0PwQQ8Le1FWt0u9Oy4Le1cvOBEwXOzJIzDuhvxV854XfryAnOIWG7Ke+M2 gMarNFs9RJiejM8Qz5HsPvh/ZxH9xxjDERHTJUgXenjK9Ep1OeTRBuc2si4xIqJEbP+q MWZDDGNB8k0JicqnuIBh4lEgNSIML9OID/MHLM2hUF+8X5pjO4oDmOXOEvK7X4/he5AD I+wouUVlXhrsOjuJLiX01xRxksx+rqZsTlXF0KcjcxZHvCG3dOTkuHJLRB2JiEJg4DH0 nhgKR5Ngsk3xmc4nZ5EercLmh94FeRxB1vdwnbxK9uKOHdHRVgSsq7v01kDq0V161hju LnzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:dkim-signature; bh=IeG7X37Tzb95FNjIKw2epgIJ5XiUXyBhBho8iBa5OI0=; b=fkGrfR5dx5/38qZ0ywM/rPHMUSGVreCbwvAZmSDwLK02RgAM23Pk4AOn+WvsF2X3PC McwdzLtN3zYIqQucRSwIepFUtLcOJNRcYc9r2n8c8VdmZA4D/WYeOUABiZ1mcWnkGvRa Gw2aZ+K179iruI4c/nb7j0IdyLlBZlL9eekLT4wI2LkAOj2VS7EUnc44jZw/NqMP7QSu z5GaCCqKBbdBsD98n3JuyTO14LPwpjJNGdMjYxFgC0LQg0b3DGynkewWbgDCSqRZFUMN F2AZNf91pkG+wV5VU+cZhiZQvBbYiZFA9k3QBTtMHJ0tpUz5h21hD3aCrgRGgqSNuf98 E5gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=ceKjNjFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h25si1532085ejx.479.2020.07.23.01.45.58; Thu, 23 Jul 2020 01:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b=ceKjNjFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726884AbgGWIpp (ORCPT + 99 others); Thu, 23 Jul 2020 04:45:45 -0400 Received: from esa4.hc3370-68.iphmx.com ([216.71.155.144]:57889 "EHLO esa4.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725984AbgGWIpp (ORCPT ); Thu, 23 Jul 2020 04:45:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1595493944; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7Tw4G/V7kxbTklR4OkIgBDvRcTQey+xrJa3KZIIL0yE=; b=ceKjNjFl5vtlf8S/k3q8TVj9RWGzPfxh30dVW5mRkQhb/oPVdwkdxxEz NnngsNUdQrXzo6/Yn3/8dq0gmv08gzIbnuYjm9NMdyaaaOfxoX9E5UPjn Y8AnJ9WIOm0mtzWey54EvhPztY3jMpYtf42MTzqTGXpNkkoia3mfLmLo/ E=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: XvT0C2bz7SBG/PGU4X8x9SKjeEDHKXC2DnQh4Ohf3AOgAn+fTf2GBFquaKPJBrljF3EVlbn2no Lzfc3CouKYANDaPfndD65nop2ySPLmK0BRz+SfUhqzhkTkvyl+hHr4Z0fdpAz1X2ZWwbByPwxE txf4kH+VPc2cNl/2s6fQcd2ImZSNihdbZ55qd9S6RkyMdKww02zAxd/G43mz0DnCOq5uctvKGf qm8BXn1hp7fmezUGGl0A0/xagekyzRUqjT8GjK/+LO+PDB2u/KfTu3f//hJBi5jthWymPxhGdP Ppc= X-SBRS: 2.7 X-MesageID: 23880204 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.75,386,1589256000"; d="scan'208";a="23880204" From: Roger Pau Monne To: CC: Roger Pau Monne , , "Boris Ostrovsky" , Juergen Gross , Stefano Stabellini , Subject: [PATCH 2/3] xen/balloon: make the balloon wait interruptible Date: Thu, 23 Jul 2020 10:45:22 +0200 Message-ID: <20200723084523.42109-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200723084523.42109-1-roger.pau@citrix.com> References: <20200723084523.42109-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org So it can be killed, or else processes can get hung indefinitely waiting for balloon pages. Signed-off-by: Roger Pau Monné Cc: stable@vger.kernel.org --- Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: xen-devel@lists.xenproject.org --- drivers/xen/balloon.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 3cb10ed32557..292413b27575 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -568,11 +568,13 @@ static int add_ballooned_pages(int nr_pages) if (xen_hotplug_unpopulated) { st = reserve_additional_memory(); if (st != BP_ECANCELED) { + int rc; + mutex_unlock(&balloon_mutex); - wait_event(balloon_wq, + rc = wait_event_interruptible(balloon_wq, !list_empty(&ballooned_pages)); mutex_lock(&balloon_mutex); - return 0; + return rc ? -ENOMEM : 0; } } -- 2.27.0