Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1789855ybv; Fri, 14 Feb 2020 06:07:34 -0800 (PST) X-Google-Smtp-Source: APXvYqzKDXxUPlOSiv1J6m3oBehx8eu0SmzEi9OACE5a/eNF1wOXA28esuEKriqDZVs4S74bRCYW X-Received: by 2002:a05:6830:114f:: with SMTP id x15mr2295728otq.291.1581689254653; Fri, 14 Feb 2020 06:07:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581689254; cv=none; d=google.com; s=arc-20160816; b=IIQ9KOItznqhDsbTOw5P32VYTFEA2TePstJAJsa9FaFVbf5XYUlv05O/cLfCcU4Mzk Ra4mKRa/2lWtvvsl+VbQpkIRnYtbD/VbhRCBKionNpIc5QE8qyVYkMWj+aX31bthVKHY ES/ZJVDGEQZCvK0QMtcdoWjnvUNdCHlNtHiAbScQTXXcvHwaRvRzs+RH2ZfT30KTdW7N oM+Y5uOK2nCVc//ucNiXqIBH47k8/KfnBHomh7oha95/MEdbtGPcMDvJYnf00XkBGrir /BNUfYvTyeUbcBKHxeRYkjHhFj62FDktIQfhnq39veLmq24RkqN8QC6wzyC/fXxIpfz6 sNfw== 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=4/DviMTLAqxW+NTVLow2DllCrC7LZyuIIAbFynwyDuk=; b=0x/kCO9fQQhx/04OqtmzrslR2sGfrM17PM6av1CQ5PazDvXIDg9qUG60vj5IrPfnCc wFTzYb94iClDziIkupE6DmA+McRnNXnb4SZz8MUeGM9XIbOSTSOddpIekkiSg6e96BN/ JXjwct7FltrNgVaSpECL83lpuP5QEDxNls+iQTzNWjtsaa1c2MIjV614mp3e/JQtrJwz CWcMkW8kNrJXc3aoAxXNwv1lIDCZuug5ULsbe8E1b17ZoVHcn3APvDwUu+OLvFcVCubD iSajbW+Ow4Ne22Hj8bH9QziSsbjBAhz7lhBCi1LpQkDVboyG5jqs/1MDsTxJUDGFC5ou IQZg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si3014728oth.243.2020.02.14.06.07.08; Fri, 14 Feb 2020 06:07:34 -0800 (PST) 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387491AbgBNOGs (ORCPT + 99 others); Fri, 14 Feb 2020 09:06:48 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:42797 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729256AbgBNOGs (ORCPT ); Fri, 14 Feb 2020 09:06:48 -0500 Received: by mail-wr1-f67.google.com with SMTP id k11so11030612wrd.9 for ; Fri, 14 Feb 2020 06:06:44 -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:in-reply-to; bh=4/DviMTLAqxW+NTVLow2DllCrC7LZyuIIAbFynwyDuk=; b=c1I8KGZKe5TO/p4kt5zipgo1sQwR9pNOAG3slgku6LoOoLlyl2zuDXrkDH4+PbNAIn ocLtmvtPPXvyxnmFaaYuKqj+EO+BUhJQmCmbiY8EMF/OZ+dfcun7k8se85FiqaqTbz2g yak+2aZMGFYJH0CVhDfoHXq3qZR0sOzUju2yYcQ0CxTn3UMt5826FdItFeydkOcPDSFE P+6BGrYqm/Vj71ObVN6Oqpkt7y7eXZDIUFLPZ/ka9TaP/a4qLUuL39CQm6IhXODqhlZR XkHzaS5q6doxUFc1INbSvTc3Xcxb0Ra+Mc99FbcFWjZ8cam4X5Wp2htcZ71P7lTkTcml 2NRQ== X-Gm-Message-State: APjAAAV98I90B1gSivaJ8dd0XS8pmGIURgo+9640GrClQrkagsddG1Hz WU8lQghw2LaAfhUiUJ2SyxQ= X-Received: by 2002:adf:fa43:: with SMTP id y3mr4204102wrr.65.1581689203326; Fri, 14 Feb 2020 06:06:43 -0800 (PST) Received: from localhost (ip-37-188-133-87.eurotel.cz. [37.188.133.87]) by smtp.gmail.com with ESMTPSA id q14sm7263208wrj.81.2020.02.14.06.06.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 06:06:42 -0800 (PST) Date: Fri, 14 Feb 2020 15:06:41 +0100 From: Michal Hocko To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org, Tyler Sanderson , "Michael S . Tsirkin" , 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: <20200214140641.GB31689@dhcp22.suse.cz> References: <20200205163402.42627-1-david@redhat.com> <20200205163402.42627-4-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200205163402.42627-4-david@redhat.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 05-02-20 17:34:02, David Hildenbrand wrote: > Commit 71994620bb25 ("virtio_balloon: replace oom notifier with shrinker") > changed the behavior when deflation happens automatically. Instead of > deflating when called by the OOM handler, the shrinker is used. > > However, the balloon is not simply some slab cache that should be > shrunk when under memory pressure. The shrinker does not have a concept of > priorities, so this behavior cannot be configured. Adding a priority to the shrinker doesn't sound like a big problem to me. Shrinkers already get shrink_control data structure already and priority could be added there. > There was a report that this results in undesired side effects when > inflating the balloon to shrink the page cache. [1] > "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 balloon > driver allocates memory which requires reclaim, vmscan gets this > memory by shrinking the balloon, and then the driver adds the > memory back to the balloon. Basically a busy no-op." > > The name "deflate on OOM" makes it pretty clear when deflation should > happen - after other approaches to reclaim memory failed, not while > reclaiming. This allows to minimize the footprint of a guest - memory > 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 used in any production workloads and if somebody really wants all the cache to be dropped then why is balloon any different? -- Michal Hocko SUSE Labs