From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751796AbdJVL3j (ORCPT ); Sun, 22 Oct 2017 07:29:39 -0400 Received: from mga04.intel.com ([192.55.52.120]:7799 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbdJVL3i (ORCPT ); Sun, 22 Oct 2017 07:29:38 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,416,1503385200"; d="scan'208";a="166073906" Message-ID: <59EC819F.1080205@intel.com> Date: Sun, 22 Oct 2017 19:31:43 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Tetsuo Handa , mst@redhat.com CC: mhocko@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v1 2/3] virtio-balloon: deflate up to oom_pages on OOM References: <1508500466-21165-1-git-send-email-wei.w.wang@intel.com> <1508500466-21165-3-git-send-email-wei.w.wang@intel.com> <20171022062119-mutt-send-email-mst@kernel.org> <201710221311.FFI17148.VStOJQLHOFFMOF@I-love.SAKURA.ne.jp> In-Reply-To: <201710221311.FFI17148.VStOJQLHOFFMOF@I-love.SAKURA.ne.jp> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/22/2017 12:11 PM, Tetsuo Handa wrote: > Michael S. Tsirkin wrote: >>> - num_freed_pages = leak_balloon(vb, oom_pages); >>> + >>> + /* Don't deflate more than the number of inflated pages */ >>> + while (npages && atomic64_read(&vb->num_pages)) >>> + npages -= leak_balloon(vb, npages); > don't we need to abort if leak_balloon() returned 0 for some reason? I don't think so. Returning 0 should be a normal case when the host tries to give back some pages to the guest, but there is no pages that have ever been inflated. For example, right after booting the guest, the host sends a deflating request to give the guest 1G memory, leak_balloon should return 0, and guest wouldn't get 1 more G memory. Best, Wei