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.2 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 27841C48BE6 for ; Wed, 16 Jun 2021 12:07:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BA9FD6115C for ; Wed, 16 Jun 2021 12:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BA9FD6115C 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 5E8A46B0071; Wed, 16 Jun 2021 08:07:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 598EB6B0072; Wed, 16 Jun 2021 08:07:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3EBC36B0073; Wed, 16 Jun 2021 08:07:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id 07D206B0071 for ; Wed, 16 Jun 2021 08:07:39 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9F91010F06 for ; Wed, 16 Jun 2021 12:07:39 +0000 (UTC) X-FDA: 78259462638.13.E5CC264 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf19.hostedemail.com (Postfix) with ESMTP id EA1299001E7C for ; Wed, 16 Jun 2021 12:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623845258; 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=SeoIWCMAUOT74+Wt948hW/6FdReXMVW6c15yjUPpXrQ=; b=C/vlrH4Uk2PRdrQDh4oLiY7d65c/+don/Kt8zlWHlhV7OzYZswJw+HU1S7Xl5s8BB/U3G9 Qb1tw/NnfVmv/uriK0LqLoR6H/oSPM+Jt/1zDkyGoU30DlRM+frH/NaHRHFUzqTEeUPktH 87mwGV/9+jtVIl4j5dWTqBVsS1CBSFE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-32-8i9ud2vJOui1-Mk-C_2hvQ-1; Wed, 16 Jun 2021 08:07:37 -0400 X-MC-Unique: 8i9ud2vJOui1-Mk-C_2hvQ-1 Received: by mail-wr1-f70.google.com with SMTP id t10-20020a5d49ca0000b029011a61d5c96bso1035650wrs.11 for ; Wed, 16 Jun 2021 05:07:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=SeoIWCMAUOT74+Wt948hW/6FdReXMVW6c15yjUPpXrQ=; b=o1NmDSyKH6sOBOOoZNuF/XtQ5Lgt/CBqk8yiU5wbODNCrSIHJAokB5juIghzf+EK3v PMnVjYfzDoNc4lzxsZfy/TubucmwDR6aBJQK1oSXlhz56/fXDe4iquVibcpmVxln95ev vyCSuzHIrjxH/LufnCTlFaz7ZQUeF0NfYkEYZZ1vYVaDX0j5gNI8sL57F5qfoqycqXCQ uM1CpLn9TBg0ZRwqKIMTZDoe81bUIg/6/Tz6zLRCWxQ5fU4ZtmpKR2Ny1wQd2Z0W1LhO hriEBoeYlGEwNmk2oS7A1U7B1HCzNbncQZ1rbFSUQVLt8keG300ZuHyEvl5hC8nJ6JQm v3UA== X-Gm-Message-State: AOAM532SrdDhvIRASQMqDvUSCQgGsx88XG61c0BCS6m3znwKe5pxOFrh DU4I1EGdTBbLB7H4Ooqwz9YvYYrswQFk+X3R8Bi55IbHxP6Olot25oyV7YDCLbw9R+ZRBNsZ6Ox wGgXZEtXQLrY= X-Received: by 2002:a7b:c042:: with SMTP id u2mr4768369wmc.127.1623845256366; Wed, 16 Jun 2021 05:07:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyA+BIdYpi7Bpa4vjtxKjzsUDhKLoGEbhQaSCt0/4bpAjRqjrX2bfoB9uMhzFj27JRacEd4AA== X-Received: by 2002:a7b:c042:: with SMTP id u2mr4768344wmc.127.1623845256172; Wed, 16 Jun 2021 05:07:36 -0700 (PDT) Received: from [192.168.3.132] (p5b0c6524.dip0.t-ipconnect.de. [91.12.101.36]) by smtp.gmail.com with ESMTPSA id p16sm2003737wrs.52.2021.06.16.05.07.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Jun 2021 05:07:35 -0700 (PDT) To: Gavin Shan , Alexander Duyck Cc: linux-mm , LKML , Andrew Morton , shan.gavin@gmail.com, Anshuman Khandual References: <20210601033319.100737-1-gshan@redhat.com> <76516781-6a70-f2b0-f3e3-da999c84350f@redhat.com> <0c0eb8c8-463d-d6f1-3cec-bbc0af0a229c@redhat.com> <63c06446-3b10-762c-3a29-464854b74e08@redhat.com> <0cb302f1-7fb6-e47c-e138-b7a03f2b02e2@redhat.com> <33b441b2-f10d-a7fb-8163-df2afbf6527d@redhat.com> <9e553b30-ce18-df65-bd3c-c68eaa4d0d91@redhat.com> <3adbcad8-1016-cf48-4574-799de0bba6e4@redhat.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [RFC PATCH] mm/page_reporting: Adjust threshold according to MAX_ORDER Message-ID: <249e5814-e644-3d82-9b38-232928af4dbd@redhat.com> Date: Wed, 16 Jun 2021 14:07:35 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <3adbcad8-1016-cf48-4574-799de0bba6e4@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="C/vlrH4U"; spf=none (imf19.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Stat-Signature: 3f99ife6k1ptrx7wfcc6a3xsma71eswj X-Rspamd-Queue-Id: EA1299001E7C X-Rspamd-Server: rspam06 X-HE-Tag: 1623845246-349154 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: > Indeed. 512MB pageblocks are rare, especially on systems which have bee= n > up and running for long time. >=20 > The free page reporting starts from guest. Taking an extreme case: gues= t has > 512MB memory and it's backed by one THP on host. The free page reportin= g won't > work at all. >=20 > Besides, it seems free page reporting isn't guranteed to work all the t= ime. > For example, on system where we have 4KB base page size. Freeing indivi= dual > 4KB pages can't come up with a free 2MB pageblock due to fragmentation. > In this case, the free'd page won't be reported immediately, but might = be > reported after swapping or compaction due to memory pressure. The free = page > isn't reported immediately at least. Exactly, it's a pure optimization that won't work, especially when guest=20 memory is heavily fragmented. There has to be a balance between=20 reclaiming free memory in the hypervisor, degrading VM performance, and=20 overhead of the feature. Further, there are no guarantees when a VM will reuse the memory again.=20 In the worst case, all VMs that reported free pages reuse memory at the=20 same time. In that case, one definitely needs sufficient backend memory=20 in the hypervisor (-> swap) to not run out of memory, and performance=20 will be degraded. As MST once phrased it, if the feature has a higher overhead than=20 swapping in the hypervisor, it's of little use. >=20 > David, how about taking your suggestion to have different threshold siz= e only > for arm64 (64KB base page size). The threshold will be smaller than pag= eblock_order > for sure. There are two ways to do so and please let me know which is t= he preferred > way to go if you (and Alex) agree to do it. >=20 > (a) Introduce CONFIG_PAGE_REPORTING_ORDER for individual archs to choos= e the > value. The threshold falls back to pageblock_order if isn't confi= gurated. > (b) Rename PAGE_REPORTING_MIN_ORDER to PAGE_REPORTING_ORDER. archs can = decide > its value. If it's not provided by arch, it falls back to pageblo= ck_order. >=20 I wonder if we could further define it as a (module/cmdline) parameter=20 and make it configurable when booting. The default could then be set=20 based on CONFIG_PAGE_REPORTING_ORDER. CONFIG_PAGE_REPORTING_ORDER would=20 default to pageblock_order (if easily possible) and could be=20 special-cases to arm64 with 64k. > By the way, I recently had some performance testing on different page s= izes. > We get much more performance gain from 64KB (vs 4KB) page size in guest= than > 512MB (vs 2MB) THP on host. It means the performance won't be affected = too > much even the 512MB THP is splitted on arm64 host. Yes, if one is even able to get 512MB THP populated in the hypervisor --=20 because once again, 512MB THP are just a bad fit for many workloads. --=20 Thanks, David / dhildenb