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=-5.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 9CEE8C35247 for ; Mon, 3 Feb 2020 16:19:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6809C20838 for ; Mon, 3 Feb 2020 16:19:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6809C20838 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 073DB6B066F; Mon, 3 Feb 2020 11:19:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 024556B0679; Mon, 3 Feb 2020 11:19:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E5E276B0683; Mon, 3 Feb 2020 11:19:50 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id CF12D6B066F for ; Mon, 3 Feb 2020 11:19:50 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 7C417180AC46F for ; Mon, 3 Feb 2020 16:19:50 +0000 (UTC) X-FDA: 76449326940.10.burn61_6ba3870a84307 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id 96ABD1698FF for ; Mon, 3 Feb 2020 16:19:00 +0000 (UTC) X-HE-Tag: burn61_6ba3870a84307 X-Filterd-Recvd-Size: 5755 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf46.hostedemail.com (Postfix) with ESMTP for ; Mon, 3 Feb 2020 16:18:59 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2020 08:18:57 -0800 X-IronPort-AV: E=Sophos;i="5.70,398,1574150400"; d="scan'208";a="378139224" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Feb 2020 08:18:57 -0800 Message-ID: <5ac131de8e3b7fc1fafd05a61feb5f6889aeb917.camel@linux.intel.com> Subject: Re: Balloon pressuring page cache From: Alexander Duyck To: "Michael S. Tsirkin" , Tyler Sanderson Cc: "Wang, Wei W" , David Hildenbrand , "virtualization@lists.linux-foundation.org" , David Rientjes , "linux-mm@kvack.org" , Michal Hocko Date: Mon, 03 Feb 2020 08:18:57 -0800 In-Reply-To: <20200203080520-mutt-send-email-mst@kernel.org> References: <91270a68-ff48-88b0-219c-69801f0c252f@redhat.com> <75d4594f-0864-5172-a0f8-f97affedb366@redhat.com> <286AC319A985734F985F78AFA26841F73E3F8A02@shsmsx102.ccr.corp.intel.com> <20200203080520-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, 2020-02-03 at 08:11 -0500, Michael S. Tsirkin wrote: > On Thu, Jan 30, 2020 at 11:59:46AM -0800, Tyler Sanderson wrote: > >=20 > > On Thu, Jan 30, 2020 at 7:31 AM Wang, Wei W wr= ote: > >=20 > > On Thursday, January 30, 2020 11:03 PM, David Hildenbrand wrote: > > > On 29.01.20 20:11, Tyler Sanderson wrote: > > > > > > > > > > > > On Wed, Jan 29, 2020 at 2:31 AM David Hildenbrand > > > > wrote: > > > > > > > > On 29.01.20 01:22, Tyler Sanderson via Virtualization wro= te: > > > > > A primary advantage of virtio balloon over other memory= reclaim > > > > > mechanisms is that it can pressure the guest's page cac= he into > > > > shrinking. > > > > > > > > > > However, since the balloon driver changed to using the = shrinker > > API > > > > > > > > > > > > > > e99a28e355255a#diff-fd202acf694d9eba19c8c64da3e480c9> this > > > > > use case has become a bit more tricky. I'm wondering wh= at the > > > intended > > > > > device implementation is. > > > > > > > > > > When inflating the balloon against page cache (i.e. no = free > > memory > > > > > remains) vmscan.c will both shrink page cache, but also= invoke > > the > > > > > shrinkers -- including the balloon's shrinker. So the b= alloon > > driver > > > > > allocates memory which requires reclaim, vmscan gets th= is memory > > > by > > > > > shrinking the balloon, and then the driver adds the mem= ory back > > to > > > the > > > > > balloon. Basically a busy no-op. > >=20 > > Per my understanding, the balloon allocation won=E2=80=99t invoke= shrinker as > > __GFP_DIRECT_RECLAIM isn't set, no? > >=20 > > I could be wrong about the mechanism, but the device sees lots of act= ivity on > > the deflate queue. The balloon is being shrunk. And this only starts = once all > > free memory is depleted and we're inflating into page cache. >=20 > So given this looks like a regression, maybe we should revert the > patch in question 71994620bb25 ("virtio_balloon: replace oom notifier w= ith shrinker") > Besides, with VIRTIO_BALLOON_F_FREE_PAGE_HINT > shrinker also ignores VIRTIO_BALLOON_F_MUST_TELL_HOST which isn't nice > at all. >=20 > So it looks like all this rework introduced more issues than it > addressed ... >=20 > I also CC Alex Duyck for an opinion on this. > Alex, what do you use to put pressure on page cache? I would say reverting probably makes sense. I'm not sure there is much value to having a shrinker running deflation when you are actively trying to increase the balloon. It would make more sense to wait until you are actually about to start hitting oom. As far as putting pressure on the page cache I don't have anything actively doing it in my current test environment. I was keeping things simple and just resorting to using "echo 3 > /proc/sys/vm/drop_caches" when I needed to flush out page cache entries. I was planning to work on the page cache pressure piece as a next step. Did you see the thread recently in response to my v16.1 patch set? We actually had a similar discussion about how best to exert pressure on the page cache and one thing I realized with that is that there are already several similar efforts ongoing so my hope is to discuss this at LSF/MM, decide on a way to consolidate the existing work to get to something that will work for most, and get that submitted over the next year. A link to that discussion can be found here: https://lore.kernel.org/lkml/20200122173040.6142.39116.stgit@localhost.lo= caldomain/ Thanks. - Alex