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=-2.5 required=3.0 tests=MAILING_LIST_MULTI,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT 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 77005C28CF6 for ; Wed, 1 Aug 2018 11:34:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29FE120894 for ; Wed, 1 Aug 2018 11:34:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 29FE120894 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388095AbeHANUI (ORCPT ); Wed, 1 Aug 2018 09:20:08 -0400 Received: from mx2.suse.de ([195.135.220.15]:41322 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387552AbeHANUI (ORCPT ); Wed, 1 Aug 2018 09:20:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 814FFAD09; Wed, 1 Aug 2018 11:34:45 +0000 (UTC) Date: Wed, 1 Aug 2018 13:34:44 +0200 From: Michal Hocko To: Wei Wang Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-mm@kvack.org, mst@redhat.com, akpm@linux-foundation.org Subject: Re: [PATCH v2 2/2] virtio_balloon: replace oom notifier with shrinker Message-ID: <20180801113444.GK16767@dhcp22.suse.cz> References: <1532683495-31974-1-git-send-email-wei.w.wang@intel.com> <1532683495-31974-3-git-send-email-wei.w.wang@intel.com> <20180730090041.GC24267@dhcp22.suse.cz> <5B619599.1000307@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5B619599.1000307@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 01-08-18 19:12:25, Wei Wang wrote: > On 07/30/2018 05:00 PM, Michal Hocko wrote: > > On Fri 27-07-18 17:24:55, Wei Wang wrote: > > > The OOM notifier is getting deprecated to use for the reasons mentioned > > > here by Michal Hocko: https://lkml.org/lkml/2018/7/12/314 > > > > > > This patch replaces the virtio-balloon oom notifier with a shrinker > > > to release balloon pages on memory pressure. > > It would be great to document the replacement. This is not a small > > change... > > OK. I plan to document the following to the commit log: > > The OOM notifier is getting deprecated to use for the reasons: > - As a callout from the oom context, it is too subtle and easy to > generate bugs and corner cases which are hard to track; > - It is called too late (after the reclaiming has been performed). > Drivers with large amuont of reclaimable memory is expected to be > released them at an early age of memory pressure; > - The notifier callback isn't aware of the oom contrains; > Link: https://lkml.org/lkml/2018/7/12/314 > > This patch replaces the virtio-balloon oom notifier with a shrinker > to release balloon pages on memory pressure. Users can set the amount of > memory pages to release each time a shrinker_scan is called via the > module parameter balloon_pages_to_shrink, and the default amount is 256 > pages. Historically, the feature VIRTIO_BALLOON_F_DEFLATE_ON_OOM has > been used to release balloon pages on OOM. We continue to use this > feature bit for the shrinker, so the shrinker is only registered when > this feature bit has been negotiated with host. Do you have any numbers for how does this work in practice? Let's say you have a medium page cache workload which triggers kswapd to do a light reclaim? Hardcoded shrinking sounds quite dubious to me but I have no idea how people expect this to work. Shouldn't this be more adaptive? How precious are those pages anyway? -- Michal Hocko SUSE Labs