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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7046CC6FA8E for ; Thu, 2 Mar 2023 09:32:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF0BF6B0071; Thu, 2 Mar 2023 04:32:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA0DD6B0073; Thu, 2 Mar 2023 04:32:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A413E6B0074; Thu, 2 Mar 2023 04:32:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9215D6B0071 for ; Thu, 2 Mar 2023 04:32:33 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 670F2A0DC7 for ; Thu, 2 Mar 2023 09:32:33 +0000 (UTC) X-FDA: 80523442986.28.B8AB5E9 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf29.hostedemail.com (Postfix) with ESMTP id 77D8B120017 for ; Thu, 2 Mar 2023 09:32:30 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QQtHpLAE; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677749551; h=from:from:sender: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:dkim-signature; bh=hkrOJUQ60Wu48EXn1l+hwmQScNz7d/g4W7cVaHobRd0=; b=c1UEhPA7L4XoDoZ6ZeXXwiYGMKofAviHLHOOU9h4Q708tvYTorCYjn2VW8mGB0tDHb2+gj ETpKN7Xcsu6svBgqs+Jj1QdqfIaKdMufh9dVYRwR7J7zUnWjxyuMrjDsCLpP36eP1MzHeK qKlix9lV19qzmhQhY04jhkAyJysKICY= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=QQtHpLAE; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677749551; a=rsa-sha256; cv=none; b=M0fHRlt1oif8NqCAZsLHbcvgq171fo84QBP+Ba82CVAf8KstkeEldxCZYkiLLnvcP0izkw I08/h9R0QC5Lf79m0lUora4Nv1dQ0tkvmpVFDFU0CmF9/ne1iUiSywfbQ57NIDWm4ozzOn dFp84/rqKdWxXkKzjE/WeRw+AM06vww= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677749549; 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=hkrOJUQ60Wu48EXn1l+hwmQScNz7d/g4W7cVaHobRd0=; b=QQtHpLAEOQxw15oj+vwNqJ8sapurn8XdqrPmzaYvvQt76wZ1Zd5t+uviOxJdkHjykxhJBC 2QwJaiM/Yb4YcVjky9pLE6jUFiFSIzOll4B6XHvAnTuUlWeqyNv/KDRtMjQf4Lveh7cee0 CXd4IbnCE/1kI8dUSflcRaA+Mwb4OC8= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-617-v-PQADE0O1KYROVVZ1MH4g-1; Thu, 02 Mar 2023 04:32:21 -0500 X-MC-Unique: v-PQADE0O1KYROVVZ1MH4g-1 Received: by mail-wr1-f69.google.com with SMTP id bh3-20020a05600005c300b002c70d6e2014so3100169wrb.10 for ; Thu, 02 Mar 2023 01:32:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hkrOJUQ60Wu48EXn1l+hwmQScNz7d/g4W7cVaHobRd0=; b=6m+7uxWxHMoz0lI6nF6lf+Ou7mqNzRZ97J6L9UlefyfOnNBq6L1TRcS0iS13ugm8R1 lgO7TA5CVzx0ADk3FzP+4imZWePAXQC552EWbpZD8b8UM1Q7JzyWcSPqJn67BSer0qgQ bG3A/stk/yUadEigvFiiM0HUg2Dv3ajOP0yZRHtiBfvydfzv/U+wHMJbU42kK41ZPnY5 65KCZPQBGa/G0CKqjbRo7apjd2E96Rt68lP7MnAfKLLufMOWcXLRAbTJDT/98ikCuxiZ vwOUirfOoKoXc4RLa9JTx0oCcijEifC+2nWCOPVhnEMzLA74hSm41jtUv1dHiHSSNaeG 3zDA== X-Gm-Message-State: AO0yUKVD3GiVABSo+DGLFmMZOKwqED1sXvRvq08YasRUZWITSZUALBlg 5+Mhw0yMhfxDJH5NAhBMIvJO4rSmog+jBhpv5RXplaKC4WZtWNo17ylwKixiAs0Y8wfTvs6ZENF ukHfqRNXDzLM= X-Received: by 2002:a05:600c:908:b0:3eb:20f6:2d5c with SMTP id m8-20020a05600c090800b003eb20f62d5cmr7595246wmp.35.1677749540153; Thu, 02 Mar 2023 01:32:20 -0800 (PST) X-Google-Smtp-Source: AK7set/EkA1BVOmlC4m1V0JoTxXzQ7lRvvoVOnyBHvW2/3P7CH7tSLE6ruLitx/3WkxtqGZKJ8Y7zg== X-Received: by 2002:a05:600c:908:b0:3eb:20f6:2d5c with SMTP id m8-20020a05600c090800b003eb20f62d5cmr7595230wmp.35.1677749539819; Thu, 02 Mar 2023 01:32:19 -0800 (PST) Received: from ?IPV6:2003:cb:c70e:4f00:87ba:e9e9:3821:677b? (p200300cbc70e4f0087bae9e93821677b.dip0.t-ipconnect.de. [2003:cb:c70e:4f00:87ba:e9e9:3821:677b]) by smtp.gmail.com with ESMTPSA id t10-20020a05600c198a00b003e11f280b8bsm2360750wmq.44.2023.03.02.01.32.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Mar 2023 01:32:19 -0800 (PST) Message-ID: Date: Thu, 2 Mar 2023 10:32:18 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [LSF/MM/BPF TOPIC] VM Memory Overcommit To: David Rientjes Cc: SeongJae Park , "T.J. Alumbaugh" , lsf-pc@lists.linux-foundation.org, "Sudarshan Rajagopalan (QUIC)" , hch@lst.de, kai.huang@intel.com, jon@nutanix.com, Yuanchu Xie , linux-mm , damon@lists.linux.dev References: <20230228223859.114846-1-sj@kernel.org> <5751ca20-9848-af42-bd1d-c7671b5796db@redhat.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 77D8B120017 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: yen59b3het7xodo61t4dn5icacqiny8m X-HE-Tag: 1677749550-914617 X-HE-Meta: U2FsdGVkX1/ija8PANgtwaRvTo3fgZm2PE3eHyMZyb1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eGRNt2BtLLSIP7sHb5PsMPkcgsKYp9dcwjhFoQMN9aQoyzpC68wuBZQ2I/FdeecMJMvrhgOVQyZfZxqC30Dg2i2QP8HpR4a3as7slyEJJq9YicdQ/zIh9HnJUv6hjk0IVqlEE4TVifNO0zrPRH8T6pWBKQD6EOmmF4WVTlm4CouWOB3zogNkyzIByy+i93zXUWH9sFeNcbrzmkOfX0qx/JukUgh8VNVnBcfq/aT5aIMOpbuEcZwJSeYR5uIJFqvuCFy81URqQ/0ODzyKPcpqAr+5mjsp7g0OT9cwHmHhr72eMVMpyBTwj00R1jzkqyh/JE3Y= 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 02.03.23 04:26, David Rientjes wrote: > On Tue, 28 Feb 2023, David Hildenbrand wrote: > >> On 28.02.23 23:38, SeongJae Park wrote: >>> On Tue, 28 Feb 2023 10:20:57 +0100 David Hildenbrand >>> wrote: >>> >>>> On 23.02.23 00:59, T.J. Alumbaugh wrote: >>>>> Hi, >>>>> >>>>> This topic proposal would be to present and discuss multiple MM >>>>> features to improve host memory overcommit while running VMs. There >>>>> are two general cases: >>>>> >>>>> 1. The host and its guests operate independently, >>>>> >>>>> 2. The host and its guests cooperate by techniques like ballooning. >>>>> >>>>> In the first case, we would discuss some new techniques, e.g., fast >>>>> access bit harvesting in the KVM MMU, and some difficulties, e.g., >>>>> double zswapping. >>>>> >>>>> In the second case, we would like to discuss a novel working set size >>>>> (WSS) notifier framework and some improvements to the ballooning >>>>> policy. The WSS notifier, when available, can report WSS to its >>>>> listeners. VM Memory Overcommit is one of its use cases: the >>>>> virtio-balloon driver can register for WSS notifications and relay WSS >>>>> to the host. The host can leverage the WSS notifications and improve >>>>> the ballooning policy. >>>>> >>>>> This topic would be of interest to a wide range of audience, e.g., >>>>> phones, laptops and servers. >>>>> Co-presented with Yuanchu Xie. >>>> >>>> In general, having the WSS available to the hypervisor might be >>>> beneficial. I recall, that there was an idea to leverage MGLRU and to >>>> communicate MGLRU statistics to the hypervisor, such that the hypervisor >>>> can make decisions using these statistics. >>>> >>>> But note that I don't think that the future will be traditional memory >>>> balloon inflation/deflation. I think it might be useful in related >>>> context, though. >>>> >>>> What we actually might want is a way to tell the OS ruining inside the >>>> VM to "please try not using more than XXX MiB of physical memory" but >>>> treat it as a soft limit. So in case we mess up, or there is a sudden >>>> peak in memory consumption due to a workload, we won't harm the guest >>>> OS/workload, and don't have to act immediately to avoid trouble. One can >>>> think of it like an evolution of memory ballooning: instead of creating >>>> artificial memory pressure by inflating the balloon that is fairly event >>>> driven and requires explicit memory deflation, we teach the OS to do it >>>> natively and pair it with free page reporting. >>>> >>>> All free physical memory inside the VM can be reported using free page >>>> reporting to the hypervisor, and the OS will try sticking to the >>>> requested "logical" VM size, unless there is real demand for more memory. >>> >>> I think use of DAMON_RECLAIM[1] inside VM together with free pages reporting >>> could be an option. Some users tried that in a manual way and reported some >>> positive results. I'm trying to find a good way to provide some control of >>> the >>> in-VM DAMON_RECLAIM utilization to hypervisor. >>> >> >> I think we might want to go one step further and not only reclaim >> (pro)actively, but also limit e.g., the growth of caches, such as the >> pagecache, to make them also aware of a soft-limit. Having that said, I still >> have to learn more about DAMON reclaim :) >> > > I'm curious, is this limitation possible to impose with memcg today or are > specifically looking to provide a cap on page cache, dentries, inodes, > etc, without specifically requiring memcg? Good question, I remember the last time that topic was raised, the common understanding was that existing mechanisms (i.e., memcg) were not sufficient. But I am no expert on this, so this sure sounds like a good topic to discuss in a bigger group, with hopefully some memcg experts around :) -- Thanks, David / dhildenb