Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1747180ybi; Wed, 17 Jul 2019 21:14:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwaLJ5bOAk0OUhnVEHl3Va16vdVQNI/IKTtKMHWiP4HAKN891ugpwTxLvgXfAuWYU973Fe X-Received: by 2002:a65:52c5:: with SMTP id z5mr31088571pgp.118.1563423245587; Wed, 17 Jul 2019 21:14:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563423245; cv=none; d=google.com; s=arc-20160816; b=UNg80Nml0zPTQ5jNb4UMld6nW0Cx81CJ3WEE2Gxe1cRcd2Bmo3gVFJlWT5q12wEGaR bon2qWGAjAnwX7nSBaoYqhdcd9tlSUNjBU2zong4epSsZN+1a9Jip2zbtZjOYO6haz3s IfqJDcI+nkCQAHseccVjZyaQC1FHBNwNhSOXv3U7oDt3IndnLK0ZixMCoYiSu0hz5tKz gnMtg1URP0dYSwaNIctCpoDHoJs0qvMv8kx9aYplVJtWHPEOevq1VCsIvvinzUnl1eFV RFAdxsPgAqQBQjmU2ZPufxreBX46AHReMmoIeSg7NVXkEdV8WGoCh6mUuuZKsUR+mATs whxA== 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=SV4rxSTVGz8T4IUkWIYI1+Xgg0JTmyIUsV7ZBNQwoIo=; b=wi7ExcydDjKcDBtW356i6CfEyCSwOOV2nWglYavl0fv9oX8uQgHNSoH/ea6X5Eo4WZ z+8Y80Gll3ipoqm8vB7J9iYF9ulXijdigCXcy+RM0XQiF6KG3wEfYymN/LfeYCI2VpKR B/IdWOwbAJs900n1qRlM4ikZBKJcNvQODAtzVlQmebCWmr0dmCJvHRXRIGvRbIgMXM2P BZQfIDhPT0oDcLccVRzjxCKJc1tgFh0Qwi2c68tGygGHN6utoaYTGHLQcCDCi/qaMhVk XjKMolGYXnlq/sMi27wBQRch39iH1Oy1322ziVfmHdk5IagLbTtzBtdkWSpnpG18YJZJ Qy2g== 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 k198si10793142pga.313.2019.07.17.21.13.49; Wed, 17 Jul 2019 21:14:05 -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 S1726604AbfGRENb (ORCPT + 99 others); Thu, 18 Jul 2019 00:13:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725976AbfGRENa (ORCPT ); Thu, 18 Jul 2019 00:13:30 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9E1FFC053B34; Thu, 18 Jul 2019 04:13:29 +0000 (UTC) Received: from redhat.com (ovpn-120-147.rdu2.redhat.com [10.10.120.147]) by smtp.corp.redhat.com (Postfix) with SMTP id 1D7AC600D1; Thu, 18 Jul 2019 04:13:16 +0000 (UTC) Date: Thu, 18 Jul 2019 00:13:15 -0400 From: "Michael S. Tsirkin" To: "Wang, Wei W" Cc: Alexander Duyck , Nitesh Narayan Lal , kvm list , David Hildenbrand , "Hansen, Dave" , LKML , linux-mm , Andrew Morton , Yang Zhang , "pagupta@redhat.com" , Rik van Riel , Konrad Rzeszutek Wilk , "lcapitulino@redhat.com" , Andrea Arcangeli , Paolo Bonzini , "Williams, Dan J" , Alexander Duyck Subject: Re: use of shrinker in virtio balloon free page hinting Message-ID: <20190718000434-mutt-send-email-mst@kernel.org> References: <20190717071332-mutt-send-email-mst@kernel.org> <286AC319A985734F985F78AFA26841F73E16D4B2@shsmsx102.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <286AC319A985734F985F78AFA26841F73E16D4B2@shsmsx102.ccr.corp.intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 18 Jul 2019 04:13:30 +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 03:46:57PM +0000, Wang, Wei W wrote: > On Wednesday, July 17, 2019 7:21 PM, 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. > > Yes, we wanted to follow the old oom behavior, which allows the oom notifier > to deflate pages only when this feature bit has been negotiated. It makes sense for pages in the balloon (requested by hypervisor). However free page hinting can freeze up lots of memory for its own internal reasons. It does not make sense to ask hypervisor to set flags in order to fix internal guest issues. > > 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 > > Do you mean virtio_balloon_shrinker_count()? It just reports to > do_shrink_slab the amount of freeable memory that balloon has. > (vb->num_pages and vb->num_free_page_blocks are all included ) Right. But that does not include the pages in the hint vq, which could be a significant amount of memory. > > - if free pages are being reported, pages freed > > by shrinker will just get re-allocated again > > fill_balloon will re-try the allocation after sleeping 200ms once allocation fails. Even if ballon was never inflated, if shrinker frees some memory while we are hinting, hint vq will keep going and allocate it back without sleeping. > > > I was unable to make this part of code behave in any reasonable way - was > > shrinker usage tested? What's a good way to test that? > > Please see the example that I tested before : https://lkml.org/lkml/2018/8/6/29 > (just the first one: *1. V3 patches) > > What problem did you see? > I just tried the latest code, and find ballooning reports a #GP (seems caused by > 418a3ab1e). > I'll take a look at the details in the office tomorrow. > > Best, > Wei I saw that VM hangs. Could be the above problem, let me know how it goes.