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 32FEDEB64DC for ; Mon, 17 Jul 2023 10:52:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5CC88D0001; Mon, 17 Jul 2023 06:52:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A0D286B0074; Mon, 17 Jul 2023 06:52:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FC1C8D0001; Mon, 17 Jul 2023 06:52:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 827C36B0072 for ; Mon, 17 Jul 2023 06:52:32 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 23091120513 for ; Mon, 17 Jul 2023 10:52:32 +0000 (UTC) X-FDA: 81020790144.17.A5B1150 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf15.hostedemail.com (Postfix) with ESMTP id E41BFA000D for ; Mon, 17 Jul 2023 10:52:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J4x4ivUG; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689591149; 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=kyan6YfrSz/fkVZwfrobXYEXWEEMhJy2Op4R9hj3Vxo=; b=d/uiIkwqKv5jSY/yN6lF/gT8f/dIOqQa9GxpYv01EpeENWDu4S1sR2aIzdVbrm/uHClzqu UIkpXoeqMAnajezRza8Atw0HPMi+qw1gVJUdTH+G5qnGF1Q4UI6xb38kALoHunWQWlsDE3 h/BET0lkw6ZokyUWL3yRH/SJMf9AwjQ= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=J4x4ivUG; spf=pass (imf15.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689591149; a=rsa-sha256; cv=none; b=kMBKF8VGxIOvsfhANkLU+MX7O6q1GJJoeIqwDEJ4CN8vEp7JgL5tF+o5tPW3Q8gCIzKeVS ZXeNkO8cjpudz3ME2RfM9vnG7LMjFtOq3iXAgaQ18SvkPPmNRHcAlF3wE/Qwbirpd2NN1C /1PUkOnBuRXxv2y3Tf8p07vmLz3Hdt4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689591148; 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=kyan6YfrSz/fkVZwfrobXYEXWEEMhJy2Op4R9hj3Vxo=; b=J4x4ivUGVrwttQIlP8WMnKw6KlkfMARAYyCPKNxPiXMgBNLjCHmf1GVLmnhpl2yrJcmleG C+flgkrvf2N6S5swzn3V+OvJebkPiPN9baYpv11bp5vxG4IB6bGnlrxgbjCKcbU2EkoklT sqimHXP/nVVSorEq1l1zLMP+gTSeO0s= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-601-ueLyWMywMNCZvvzxpULE4w-1; Mon, 17 Jul 2023 06:52:26 -0400 X-MC-Unique: ueLyWMywMNCZvvzxpULE4w-1 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-31429e93f26so2779292f8f.2 for ; Mon, 17 Jul 2023 03:52:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689591145; x=1692183145; h=content-transfer-encoding:in-reply-to:subject:cc:organization:from :references:to:content-language:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kyan6YfrSz/fkVZwfrobXYEXWEEMhJy2Op4R9hj3Vxo=; b=JV00M7bRWJ9oyhlnwJ++909tpwk9Mhe5WGq+MkBKHxeacc+g4XwtJmrqhCZpvJlAPd gp6dYSMLeOir4YfiZCuCq5Zq2tWGmPp4z8uySwHDc2iKGicy8en8NsUF01NFndHBtQep C/AoKaEaYxqp6AL/MsOHjPze5NRG9qecAaFcc4uMtqI/09zJwl9DzX6SDWxBRyC0j2lt fUBhEjEuE/h3gTOSTYm/YTW9XuBvqpPdcmAPtFm6pnmITiqMMiNhnnvgahTipsoTyFri 4A5OzOgUc57KICV4onNPsSlf2X7O+rkwdwN4OjwJeswihzOVG8YYUnnjh0S4DFpvU/V1 2p8Q== X-Gm-Message-State: ABy/qLb+ho5wKjDaAJ2r9iS3mPik9XUpnhfdw5T0P/HNIu2njHRoBTWj XR0Jl8+DAmtj7OZUNmaFTcCLZnPlVxMr0YCw1sPxBsob+hTOiMn0THEAv5eQbMsRHMYaczD5Mmj ZJzAwpIxta7E= X-Received: by 2002:a5d:4cc5:0:b0:314:824:3788 with SMTP id c5-20020a5d4cc5000000b0031408243788mr11415627wrt.27.1689591145365; Mon, 17 Jul 2023 03:52:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlG+/PoNRIr6ACY9CzGwADV2siERQr5v3vq2hFdBe0HFfPAfGaLjuOMcx/Dqum83NDS7HKf67Q== X-Received: by 2002:a5d:4cc5:0:b0:314:824:3788 with SMTP id c5-20020a5d4cc5000000b0031408243788mr11415613wrt.27.1689591145053; Mon, 17 Jul 2023 03:52:25 -0700 (PDT) Received: from ?IPV6:2003:cb:c735:400:2501:5a2e:13c6:88da? (p200300cbc735040025015a2e13c688da.dip0.t-ipconnect.de. [2003:cb:c735:400:2501:5a2e:13c6:88da]) by smtp.gmail.com with ESMTPSA id a5-20020a5d53c5000000b002fb60c7995esm18974972wrw.8.2023.07.17.03.52.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Jul 2023 03:52:24 -0700 (PDT) Message-ID: Date: Mon, 17 Jul 2023 12:52:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 To: Caden Ellis , linux-mm@kvack.org References: From: David Hildenbrand Organization: Red Hat Cc: Michal Hocko Subject: Re: Clarification on anon and anon_thp meanings from memory.stat in cgroup v2 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: E41BFA000D X-Rspam-User: X-Stat-Signature: gexf7ue5rqoa6t93f44f1tapu6gofe69 X-Rspamd-Server: rspam01 X-HE-Tag: 1689591148-74043 X-HE-Meta: U2FsdGVkX1/pbgeulhbZ9Z+4eWqm3EwfYj25RH2h0DW5WvWH0nsc5GFcS6hue7quKYXINXpfNZiWF/SM/OvDFYtJos2MHqbyNa4QIr+RoeUh5uoT6VIY2S7UzpvvJOF9AurDG35pLwxLtvmhCRs8FMa8XoOEzhgUEmYC0/x11h71XRzuMAh2G9hW0nuNCzqOuET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Fc0C5IrtJopraP/JxalZ9xG1djsoJhqpTkFbuZFxyhUnM0hJax92MI7EOvYoZOwn3L5OGMy7XMcddy1WNCRbBhtfyliN89G1/pgxxO8GQjYwOB3j8B1Qtz1EixW/WtDhfwBaSQ4 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11.07.23 20:25, Caden Ellis wrote: > I had a question about anon and anon_thp, values that come from > memory.stat in cgroups v2. > From this doc https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files > : > > anon > Amount of memory used in anonymous mappings such as brk(), sbrk(), and > mmap(MAP_ANONYMOUS) > ... > anon_thp > Amount of memory used in anonymous mappings backed by transparent hugepages > My understanding is, that the semantics are the same as the values shown in /proc/meminfo: 1) anon <-> "AnonPages" "(PTE/PMD/PUD/...)-mapped anonymous pages" (IOW, any mapped anon page) 2) anon_thp <-> "AnonHugePages" "PMD-mapped anonymous pages only" Any anon page that is mapped gets accounted under anon/AnonPages. A THP that is PMD-mapped gets accounted under anon_thp/AnonHugePages AND anon/AnonPages. A THP that is mot PMD-mapped (but PTE-mapped) gets accounted as anon/AnonPages only. So "AnonHugePages" should actually have been called "AnonPMDMapped", to resemble ShmemPmdMapped/FilePmdMapped in /proc/meminfo. ... and "AnonPages" should have been called "AnonMapped" to resemble "Mapped". > I read that as anon_thp being a subset of anon, however it is not > explicit. The cgroup v1 documentation was explicit about the "rss" > stat including transparent hugepages. I have tested a few memory > eating programs (making sure that I have the transparent_hugepages > kernel parameter set to "always"), and anon always seems to be bigger > than anon_thp by a little. This helps but doesn't definitively prove > that anon_thp is a subset of anon. It really should be a subset. > > Does anyone know for sure if anon_thp is a subset of anon? Preferable > if you can cite the source code. I have dug in the code for a while > but have not found the answer. mm/rmap.c: * page_add_anon_rmap() * page_remove_rmap() See how they adjust NR_ANON_MAPPED (anon/AnonPages) and NR_ANON_THPS (anon_thp/AnonHugePages). [NR_ANON_THPS should be called NR_ANON_PMDMAPPED to resemble NR_SHMEM_PMDMAPPED/NR_FILE_PMDMAPPED] > > One last related question: Is the cgroups v2 equivalent of "rss" in v1 > anon + swapcached? IIUC, that would not consider pagecache pages. -- Cheers, David / dhildenb