From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 042FAC7618F for ; Wed, 17 Jul 2019 14:34:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DD68821743 for ; Wed, 17 Jul 2019 14:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726892AbfGQOeg (ORCPT ); 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: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@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