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.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 585CDC76199 for ; Sun, 16 Feb 2020 09:46:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0E22820857 for ; Sun, 16 Feb 2020 09:46:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="W5BxFCQB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0E22820857 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B7B1C6B0007; Sun, 16 Feb 2020 04:46:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B50E66B0008; Sun, 16 Feb 2020 04:46:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A40756B000A; Sun, 16 Feb 2020 04:46:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id 8C69A6B0007 for ; Sun, 16 Feb 2020 04:46:25 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 202384DAC for ; Sun, 16 Feb 2020 09:46:25 +0000 (UTC) X-FDA: 76495509930.19.pies26_37ee6436aad16 X-HE-Tag: pies26_37ee6436aad16 X-Filterd-Recvd-Size: 7133 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Sun, 16 Feb 2020 09:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581846382; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/Ez8pc3/SjccCqNHFuNd627JV2gtZUVIb4xEwCz9Tv8=; b=W5BxFCQBZjo0dAd0N+rWI0jxC17hNQQZ0vDcAxF6Z0GcSkQCeBHZlIYbwYVGvUBTT+iYgU 7AQS2MNMOmHnlmDdU0p0/OHmvZ825Jt7UWFpVzsEOkGRSyPSWwFssgPF7O9J4NEJVGJNSV EZ6HqXt/lhJ+10lluvLOyv9g4wAkl+8= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-31-odKZGNAcMAm9Bu4oX-50KA-1; Sun, 16 Feb 2020 04:46:18 -0500 Received: by mail-wm1-f70.google.com with SMTP id 7so5180269wmf.9 for ; Sun, 16 Feb 2020 01:46:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=ZtasoyQFCb5RWLLV8eTtZLdqEWZ7911rlj1gtV4FhTo=; b=Mrv5afRU/1qxAHGR9uzgk8lpLlwbmdb8XbAl1qhN6+nEW8iXLSBfz6IQikTGst/2UO IqA1dFAQ8UX5jpUEiro7e34fdVmt4IHII78l4Vp32u29NftKpbn27Nf7hx7n3+AzsMJm D+R9AF5TNDHnFRd399iY4VDUwD6eU4eU7GWlr3yrUnQ8A5nhhWbZ9n2HYx4eTWSV6u79 NtEva6dcxpyPXxAv3H4r30yBzcJHXXFzD9Fjmszz4fCHSmz98Sc+sTmgbQbqjVsrmFOX bIs7my6wYLNoDOV1ctBf+AD1Fz/y0YmgQSe8UraLoJYtUg9xfuYtIM9AiBH9yaIk/Zzh eQBQ== X-Gm-Message-State: APjAAAVkU32LRSmAvi4lGu0S/FUiE6qAvLXMxB+XJ1k3j8V4iByVPWjr PNd8n51q1lTUCtYCIPbzwwrzDHgRdV3o2QWNSJ/VN1GTJBX1MIJconPk/p3FY/mA/E6FABP8Qz9 6O+hj40Tkxpk= X-Received: by 2002:a05:600c:2406:: with SMTP id 6mr15804492wmp.30.1581846376994; Sun, 16 Feb 2020 01:46:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxiJrJeE35F57XE7BYaxi/pj3GggCLXzH7A0bPaUDDuXSCX0jIpgP45E++A8xFP+UtWDibEKA== X-Received: by 2002:a05:600c:2406:: with SMTP id 6mr15804448wmp.30.1581846376650; Sun, 16 Feb 2020 01:46:16 -0800 (PST) Received: from redhat.com (bzq-79-176-28-95.red.bezeqint.net. [79.176.28.95]) by smtp.gmail.com with ESMTPSA id o15sm15619180wra.83.2020.02.16.01.46.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Feb 2020 01:46:15 -0800 (PST) Date: Sun, 16 Feb 2020 04:46:12 -0500 From: "Michael S. Tsirkin" To: Tyler Sanderson Cc: David Hildenbrand , Michal Hocko , linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org, Wei Wang , Alexander Duyck , David Rientjes , Nadav Amit Subject: Re: [PATCH v1 3/3] virtio-balloon: Switch back to OOM handler for VIRTIO_BALLOON_F_DEFLATE_ON_OOM Message-ID: <20200216044551-mutt-send-email-mst@kernel.org> References: <20200205163402.42627-1-david@redhat.com> <20200205163402.42627-4-david@redhat.com> <20200214140641.GB31689@dhcp22.suse.cz> <802f93b1-1588-bd2c-8238-c12ec7f7ae9e@redhat.com> MIME-Version: 1.0 In-Reply-To: X-MC-Unique: odKZGNAcMAm9Bu4oX-50KA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline 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 Fri, Feb 14, 2020 at 12:48:42PM -0800, Tyler Sanderson wrote: > Regarding Wei's patch that modifies the shrinker implementation, versus t= his > patch which reverts to OOM notifier: > I am in favor of both patches. But I do want to make sure a fix gets back > ported to 4.19 where the performance regression was first introduced. > My concern with reverting to the OOM notifier is, as mst@ put it (in the = other > thread): > "when linux hits OOM=A0all kind of error paths are being hit, latent bugs= start > triggering,=A0latency goes up drastically." > The guest could be in a lot of pain before the OOM notifier is invoked, a= nd it > seems like the shrinker API might allow more fine grained control of when= we > deflate. >=20 > On the other hand, I'm not totally convinced that Wei's patch is an expec= ted > use of the shrinker/page-cache APIs, and maybe it is fragile. Needs more > testing=A0and scrutiny. >=20 > It seems to me like the shrinker API is the right API in the long run, pe= rhaps > with some fixes and modifications. But maybe reverting to OOM notifier is= the > best patch to back port? In that case can I see some Tested-by reports pls? > On Fri, Feb 14, 2020 at 6:19 AM David Hildenbrand wrot= e: >=20 > >> There was a report that this results in undesired side effects whe= n > >> inflating the balloon to shrink the page cache. [1] > >>=A0 =A0 =A0 "When inflating the balloon against page cache (i.e. no= free memory > >>=A0 =A0 =A0 =A0remains) vmscan.c will both shrink page cache, but a= lso invoke the > >>=A0 =A0 =A0 =A0shrinkers -- including the balloon's shrinker. So th= e balloon > >>=A0 =A0 =A0 =A0driver allocates memory which requires reclaim, vmsc= an gets this > >>=A0 =A0 =A0 =A0memory by shrinking the balloon, and then the driver= adds the > >>=A0 =A0 =A0 =A0memory back to the balloon. Basically a busy no-op." > >> > >> The name "deflate on OOM" makes it pretty clear when deflation sho= uld > >> happen - after other approaches to reclaim memory failed, not whil= e > >> reclaiming. This allows to minimize the footprint of a guest - mem= ory > >> will only be taken out of the balloon when really needed. > >> > >> Especially, a drop_slab() will result in the whole balloon getting > >> deflated - undesired. > > > > Could you explain why some more? drop_caches shouldn't be really us= ed in > > any production workloads and if somebody really wants all the cache= to > > be dropped then why is balloon any different? > > >=20 > Deflation should happen when the guest is out of memory, not when > somebody thinks it's time to reclaim some memory. That's what the > feature promised from the beginning: Only give the guest more memory = in > case it *really* needs more memory. >=20 > Deflate on oom, not deflate on reclaim/memory pressure. (that's what = the > report was all about) >=20 > A priority for shrinkers might be a step into the right direction. >=20 > -- > Thanks, >=20 > David / dhildenb >=20 >=20