Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp965625ybi; Wed, 17 Jul 2019 07:36:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJiJ/+9SOwoDHAgJvXASiyqsYbuJbMuv7DZ92qlOykhHVrS2bodHbqn1aLWk8p/c2diAVD X-Received: by 2002:a63:221f:: with SMTP id i31mr42463427pgi.251.1563374198344; Wed, 17 Jul 2019 07:36:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563374198; cv=none; d=google.com; s=arc-20160816; b=aMEnVROsD+wm0ltHDLVR5uiJJMbkYZIUoJTRPC8FLkYytAdSoGpowR2ON/vGiTNXvj cB+ku2XAiUIl9TGV71nBYxPm8Ei7CRmNXUUQ8QYgut/sgvzurw0yHIar2rAEfHjMqlQB QQ8Iol518SZyLvPCGyq1YkOLYKVPRb1gR7LNn2RyCc9c0aMN0CC5e58gEW5BUJPsyuTv cW+CpSLeSOYmk2KoN0DJq8KE8yGctV9bWVx2i9PSTaeC+3FfIPhFVAqSQ51u7gFUJGrm 2kJEj+5v3B+1Hbn6+hA7CyRLOwp5u8KuBA3KgMNqve5P6zwR5IRy3tBSnTS3t5nxbC/d 6+cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=snhado8UeJvK9GDImP7KcCYqkSIDBILBMhnuVhXLe+o=; b=Ku0MFFhjSGSgGdIKJm8Gy4Wqo1Bl2wHL5kAziGAtSEGQimOiGNkgZ2RgIJMkFGOAuz bfDLis2C8mCrEyyKMpwdxow4yfWwjItXhXrb5LbZj0sww0FnqSWbknC1Sprcsb1ofrkm kdzfOMMxE6lHSlDrPg1Po2+FvJjQNFZuQDYGWr9r+Ls88d+x2JcItG8meErYA/04ZpZz 9Xuf3ad6TuV0YN1YKzpBFYvfSm9C6B0f3GGLJRXpBUUkQ42i9Ijb869jCm11rgXJgH3T 8KHsmuX+qEPiDg31brbE25h2hU5ySTizMWgWS7lBFAWagbMqmlZrgMQIXxu1lnmJDfKZ l+DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si21645052plo.376.2019.07.17.07.36.22; Wed, 17 Jul 2019 07:36:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727256AbfGQOeg (ORCPT + 99 others); Wed, 17 Jul 2019 10:34:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:43504 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726272AbfGQOeg (ORCPT ); Wed, 17 Jul 2019 10:34:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2B22A8553A; Wed, 17 Jul 2019 14:34:36 +0000 (UTC) Received: from redhat.com (ovpn-125-71.rdu2.redhat.com [10.10.125.71]) by smtp.corp.redhat.com (Postfix) with SMTP id 654AF19C59; Wed, 17 Jul 2019 14:34:16 +0000 (UTC) Date: Wed, 17 Jul 2019 10:34:15 -0400 From: "Michael S. Tsirkin" To: David Hildenbrand Cc: Alexander Duyck , wei.w.wang@intel.com, Nitesh Narayan Lal , kvm list , Dave Hansen , LKML , linux-mm , Andrew Morton , Yang Zhang , pagupta@redhat.com, Rik van Riel , Konrad Rzeszutek Wilk , lcapitulino@redhat.com, Andrea Arcangeli , Paolo Bonzini , dan.j.williams@intel.com, Alexander Duyck Subject: Re: use of shrinker in virtio balloon free page hinting Message-ID: <20190717103208-mutt-send-email-mst@kernel.org> References: <20190717071332-mutt-send-email-mst@kernel.org> <959237f9-22cc-1e57-e07d-b8dc3ddf9ed6@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <959237f9-22cc-1e57-e07d-b8dc3ddf9ed6@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 17 Jul 2019 14:34:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 17, 2019 at 04:10:47PM +0200, David Hildenbrand wrote: > On 17.07.19 13:20, Michael S. Tsirkin wrote: > > Wei, others, > > > > ATM virtio_balloon_shrinker_scan will only get registered > > when deflate on oom feature bit is set. > > > > Not sure whether that's intentional. Assuming it is: > > > > virtio_balloon_shrinker_scan will try to locate and free > > pages that are processed by host. > > The above seems broken in several ways: > > - count ignores the free page list completely > > - if free pages are being reported, pages freed > > by shrinker will just get re-allocated again > > Trying to answer your questions (not sure if I fully understood what you > mean) > > virtio_balloon_shrinker_scan() will not be called due to inflation > requests (balloon_page_alloc()). It will be called whenever the system > is OOM, e.g., when starting a new application. > > I assume you were expecting the shrinker getting called due to > balloon_page_alloc(). however, that is not the case as we pass > "__GFP_NORETRY". Right but it's possible we exhaust all memory, then someone else asks for a single page and that invokes the shrinker. > > To test, something like: > > 1. Start a VM with > > -device virtio-balloon-pci,deflate-on-oom=true > > 2. Inflate the balloon, e.g., > > QMP: balloon 1024 > QMP: info balloon > -> 1024 > > See how "MemTotal" in /proc/meminfo in the guest won't change > > 3. Run a workload that exhausts memory in the guest (OOM). > > See how the balloon was automatically deflated > > QMP: info balloon > -> Something bigger than 1024 > > > Not sure if it is broken, last time I played with it, it worked, but > that was ~1-2 years ago. > > -- > > Thanks, > > David / dhildenb Sorry I was unclear. The question was about VIRTIO_BALLOON_F_FREE_PAGE_HINT specifically. -- MST