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 63C36C4707B for ; Wed, 10 Jan 2024 12:05:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF26D6B009A; Wed, 10 Jan 2024 07:05:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA29B6B009B; Wed, 10 Jan 2024 07:05:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A42F76B009C; Wed, 10 Jan 2024 07:05:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 938EE6B009A for ; Wed, 10 Jan 2024 07:05:33 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 66D981A0B71 for ; Wed, 10 Jan 2024 12:05:33 +0000 (UTC) X-FDA: 81663271746.03.B188B45 Received: from mail-ua1-f47.google.com (mail-ua1-f47.google.com [209.85.222.47]) by imf16.hostedemail.com (Postfix) with ESMTP id 9B89918001E for ; Wed, 10 Jan 2024 12:05:31 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jPZL4OSo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.47 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704888331; a=rsa-sha256; cv=none; b=WY7/CIPQ8bkfckT+vT+SDgzDrNXJPLhzHaLGCIkk6B4XRHY4cdRvAewLPzoxxdFUCW2wSX HbNKxa+cqg64FJqzHM622/ZNIyDqsOfqdKo3/vIvka7SqyUejmRx1pMa0d2aLqMh8H6M1L J2u1NUhtlve35k5aUvUIYBRvu55WCs8= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jPZL4OSo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.47 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704888331; 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=aU/Ywp5UyLuhhvA4RWzp2UtIUflCuTL0VQ//z079pac=; b=lm9w8w+0ryHoWSfwomg2kwkff3iKZkXCfG2OSyKypCMTJ4dl9Ic7Et9kZCGvHsgKq6cSv5 52sbkHWAjBN4wZXRJseDm7TitipvW/FlO6Zf9cY1jZyZRPlTyMS/x86ypa8mZRgW+jsUzC fPJA43qd9ODk4Lr0OpOpMyIfJ/D7sSM= Received: by mail-ua1-f47.google.com with SMTP id a1e0cc1a2514c-7cc14b91230so2859056241.0 for ; Wed, 10 Jan 2024 04:05:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704888330; x=1705493130; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=aU/Ywp5UyLuhhvA4RWzp2UtIUflCuTL0VQ//z079pac=; b=jPZL4OSo66bOaawV5u94KaQm96Go33bAaJ0QrKeyqmvxknLbEc/j7ULmnHCTvNGDE6 e7L2rRBJMf5dGMr81Pn+CPzQBGhvTGVxMuZi5+9r94GVPXqY3TiCQISv3XRvhWI+5ucf BW0C9JJZGd2ELIlbQmFL0q755fOXmuLDN2SbBCFMY6nRr0g1CLfbhFgHL6NZsrFwbOTA t1Z63C2w6/Q0jJAmi4ByEsmU+RvjBQmKk6+kweBa1DpwJB79BciO9ErrbHmjEe++Jp8k qK6PDGPJg/MaTK8of/AFzJZdXphTGdaWYReQgYsIVqb4FCkiDc3dlQYoz3SZtqj5vlX5 EzWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704888330; x=1705493130; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aU/Ywp5UyLuhhvA4RWzp2UtIUflCuTL0VQ//z079pac=; b=HpTbddbjaj1GGyL/ESkyMI/aF0+PhnYELPrnoHiMuw/mVCepcDpcmmHIrsK/NfqH5j fychUBbdTJd1wXvDyn9eoUEYav6Go0UVLiC6FgRT9qqgl/EFYrHTi5TtRUjs5ypkApsN GUosGFSKq/ODwO9P+em3vYQaBHazX/UPSkmIxXD9Qi2O5Ld4Ra3v4Z5mzMF0jvmTujGC HqctIf0patzUSwGcH5yWpmai7UM82ggJcH3aJ1re0Bk+bBj8WfYpLuD0D5h9E815NF6T x2FByrplUcayrDp08MhDmP/mxFPn9Kb/k5AFR7ivvCd5p2q1Yg2q9dfIxmUDDIa06veR 4nww== X-Gm-Message-State: AOJu0YyRJeKvybwkY3Zyta1Jaqff8qf/K55qrLb0LK26suuSGM2tS2Wa laPsqdR1jwe7lijZiC6WMBJfvxzO/Rhlk8xpLwU= X-Google-Smtp-Source: AGHT+IGJ8gj1HNwv3A6cFnfr83VWdtK7kjHT7ElOlBoZMNFnC1etIyDTlojvWcR/eSiV9ErVfEWesIQD5XjIcO+/CCo= X-Received: by 2002:a05:6122:511:b0:4b8:7a16:b757 with SMTP id x17-20020a056122051100b004b87a16b757mr1690221vko.5.1704888330544; Wed, 10 Jan 2024 04:05:30 -0800 (PST) MIME-Version: 1.0 References: <20240102153828.1002295-1-ryan.roberts@arm.com> <4e7445a0-acc9-487f-999f-a2b6d03d265e@nvidia.com> <3bd5e4a3-9f67-4483-9a0e-9abb5eb783cd@arm.com> <94ebe62b-5f55-4be9-b464-4105b4692496@arm.com> <68d5ce7e-6587-47c6-bd0f-988adf5d92a4@arm.com> <974a2670-7fa9-425e-921e-8d54a596e6cf@arm.com> <6c77f143-9c2c-4d17-9a2a-d69d9adf2eea@arm.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Wed, 10 Jan 2024 20:05:18 +0800 Message-ID: Subject: Re: [RFC PATCH v1] tools/mm: Add thpmaps script to dump THP usage info To: Ryan Roberts Cc: David Hildenbrand , John Hubbard , Andrew Morton , Zenghui Yu , Matthew Wilcox , Kefeng Wang , Zi Yan , Alistair Popple , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 9B89918001E X-Stat-Signature: 3yp58diese9yjhz3934nugg536an8p3q X-HE-Tag: 1704888331-866545 X-HE-Meta: U2FsdGVkX1+drXSm+cyDtC6bkJI0pJCISNROKXWmVO5NFHPiXXv/sO5IlUE3jE0J++HuYDIUzhw+vX9zJC2MOUTYcamd5GgBM72btXbAtpQXhMEEVCdOnwce/2TwGk/bNJ0ESgEuzxmqFZMHmfUm0ZWbYa+APkcuAXHQ0WGaf5JsIeOoH9Xcgtskr0Fa9gSY8eR5aicAKJdfX1GALY7UddSrU9lpH9gBtjK8RiaPYhzgrabcwdPw1fTYJdFxrtKRiJonqQTt2pAVE2s8JA2vOlTrkY1G0PQeH8z8CWYlQKa/Vb3qKBcoub28L+kGGhZmehoKJFGm1NH3X5+TflOxMZT1OwYcRjV6FkhnH84esQUpaxEY3kNXkOj71WD/6zyf+8fBvnUFfpCCZ4ekuSJcJEr25XYpZhLkpP7w+kj53UriVW+mhLZl4i88r3nUw0MivPnXrvnuDA0G5eSAAuC8BR0gNK6gwoJkj2JIGQT2ExjV2GptBBA6SvwcukR1v65d9bIkS1p3HTqzeiqvOg0wgtEDkF8xYC/YBb0dagpDxuFP0H4vLoiwFc7vK/9cfIhsn57dVlsARR0vh9IC4opaRBkJdbd04GqhH0XzszQF1id4m3Pey64fZQj5L2uqI64DSUuU4xcNbglyZH2iSLBGKWeCHhkwx1L6KYKAu3+Dq+tBRZaJ0MxG5QrxuJrzQVoKUNexm5Ufx+sOpZvSvqvdPFUmQmKfMBpwpVHbiFRlnxnt32N5ENDO9MW+fehWVJq7wAVwRRs3mz+12A9Azqyjz/JCihD4D5PtSwteCQ7qAaPXTEwW2Sz4kU+O/+fy72nWA8pVFi8/xo60YRBNV83R/Kcb6Kb8W0RMbwHV6iyRyr9u2ZVyGW8qLZpRYFfQ7fbnjBf/krpfJ2kxHT34jugywiFBk0AkB+c7xf/ydMWlrQGfPZ1CubhPbX8AZ1J+4jGnADN5bBftO798DeDQQBv 15uRCqbH fHhPP6Ndjc4eJo8xzfpAd9EyKoaZK310NlPIWHaEWnhkSF7EVdZnBbvRRwAt840cke/wsBXv39nMkPVMIe7VYYkQZQ7KZKR4BxEzZfv/OILLvao5dc+KLLKt3NChkbiP34vD/R72ivSoGpQiKFfZd9TrgVqD7BxoTSaCz0KFK0raaAY7OsoGQLSD0PUZQwoICLE6jJFK+W1mOMuZ75x7nujNtwIyqLP4lQ+6+gzqb4oRU/P4lmpDU4dGcNYQfREZoLwZtLhnlMbjf7Im76zAOPzUvbnYpD1zaQq/YiNNeLPZ+l2ThLFgfmfHb6bw1BiePBEKHH0EYgd/BpQXFUf2+Xi8u6RKJx/6R+JV1W3vAZAq90izxoCCcXKx8GNIBe03gpYJZ/K6wXX8boQ/sXoxgTpR/E5nPwNhfL0zw2ib+ahXy7eROK6Hy1KJ+4w== 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: List-Subscribe: List-Unsubscribe: On Wed, Jan 10, 2024 at 7:59=E2=80=AFPM Ryan Roberts = wrote: > > On 10/01/2024 11:38, Barry Song wrote: > > On Wed, Jan 10, 2024 at 7:21=E2=80=AFPM Ryan Roberts wrote: > >> > >> On 10/01/2024 11:00, David Hildenbrand wrote: > >>> On 10.01.24 11:55, Ryan Roberts wrote: > >>>> On 10/01/2024 10:42, David Hildenbrand wrote: > >>>>> On 10.01.24 11:38, Ryan Roberts wrote: > >>>>>> On 10/01/2024 10:30, Barry Song wrote: > >>>>>>> On Wed, Jan 10, 2024 at 6:23=E2=80=AFPM Ryan Roberts wrote: > >>>>>>>> > >>>>>>>> On 10/01/2024 09:09, Barry Song wrote: > >>>>>>>>> On Wed, Jan 10, 2024 at 4:58=E2=80=AFPM Ryan Roberts wrote: > >>>>>>>>>> > >>>>>>>>>> On 10/01/2024 08:02, Barry Song wrote: > >>>>>>>>>>> On Wed, Jan 10, 2024 at 12:16=E2=80=AFPM John Hubbard wrote: > >>>>>>>>>>>> > >>>>>>>>>>>> On 1/9/24 19:51, Barry Song wrote: > >>>>>>>>>>>>> On Wed, Jan 10, 2024 at 11:35=E2=80=AFAM John Hubbard > >>>>>>>>>>>>> wrote: > >>>>>>>>>>>> ... > >>>>>>>>>>>>>> Hi Ryan, > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> One thing that immediately came up during some recent test= ing of mTHP > >>>>>>>>>>>>>> on arm64: the pid requirement is sometimes a little awkwar= d. I'm > >>>>>>>>>>>>>> running > >>>>>>>>>>>>>> tests on a machine at a time for now, inside various conta= iners and > >>>>>>>>>>>>>> such, and it would be nice if there were an easy way to ge= t some > >>>>>>>>>>>>>> numbers > >>>>>>>>>>>>>> for the mTHPs across the whole machine. > >>>>>>>>>> > >>>>>>>>>> Just to confirm, you're expecting these "global" stats be true= ly global > >>>>>>>>>> and not > >>>>>>>>>> per-container? (asking because you exploicitly mentioned being= in a > >>>>>>>>>> container). > >>>>>>>>>> If you want per-container, then you can probably just create t= he container > >>>>>>>>>> in a > >>>>>>>>>> cgroup? > >>>>>>>>>> > >>>>>>>>>>>>>> > >>>>>>>>>>>>>> I'm not sure if that changes anything about thpmaps here. = Probably > >>>>>>>>>>>>>> this is fine as-is. But I wanted to give some initial reac= tions from > >>>>>>>>>>>>>> just some quick runs: the global state would be convenient= . > >>>>>>>>>> > >>>>>>>>>> Thanks for taking this for a spin! Appreciate the feedback. > >>>>>>>>>> > >>>>>>>>>>>>> > >>>>>>>>>>>>> +1. but this seems to be impossible by scanning pagemap? > >>>>>>>>>>>>> so may we add this statistics information in kernel just li= ke > >>>>>>>>>>>>> /proc/meminfo or a separate /proc/mthp_info? > >>>>>>>>>>>>> > >>>>>>>>>>>> > >>>>>>>>>>>> Yes. From my perspective, it looks like the global stats are= more useful > >>>>>>>>>>>> initially, and the more detailed per-pid or per-cgroup stats= are the > >>>>>>>>>>>> next level of investigation. So feels odd to start with the = more > >>>>>>>>>>>> detailed stats. > >>>>>>>>>>>> > >>>>>>>>>>> > >>>>>>>>>>> probably because this can be done without the modification of= the kernel. > >>>>>>>>>> > >>>>>>>>>> Yes indeed, as John said in an earlier thread, my previous att= empts to add > >>>>>>>>>> stats > >>>>>>>>>> directly in the kernel got pushback; DavidH was concerned that= we don't > >>>>>>>>>> really > >>>>>>>>>> know exectly how to account mTHPs yet > >>>>>>>>>> (whole/partial/aligned/unaligned/per-size/etc) so didn't want = to end up > >>>>>>>>>> adding > >>>>>>>>>> the wrong ABI and having to maintain it forever. There has als= o been some > >>>>>>>>>> pushback regarding adding more values to multi-value files in = sysfs, so > >>>>>>>>>> David > >>>>>>>>>> was suggesting coming up with a whole new scheme at some point= (I know > >>>>>>>>>> /proc/meminfo isn't sysfs, but the equivalent files for NUMA n= odes and > >>>>>>>>>> cgroups > >>>>>>>>>> do live in sysfs). > >>>>>>>>>> > >>>>>>>>>> Anyway, this script was my attempt to 1) provide a short term = solution > >>>>>>>>>> to the > >>>>>>>>>> "we need some stats" request and 2) provide a context in which= to explore > >>>>>>>>>> what > >>>>>>>>>> the right stats are - this script can evolve without the ABI p= roblem. > >>>>>>>>>> > >>>>>>>>>>> The detailed per-pid or per-cgroup is still quite useful to m= y case in > >>>>>>>>>>> which > >>>>>>>>>>> we set mTHP enabled/disabled and allowed sizes according to v= ma types, > >>>>>>>>>>> eg. libc_malloc, java heaps etc. > >>>>>>>>>>> > >>>>>>>>>>> Different vma types can have different anon_name. So I can us= e the > >>>>>>>>>>> detailed > >>>>>>>>>>> info to find out if specific VMAs have gotten mTHP properly a= nd how many > >>>>>>>>>>> they have gotten. > >>>>>>>>>>> > >>>>>>>>>>>> However, Ryan did clearly say, above, "In future we may wish= to > >>>>>>>>>>>> introduce stats directly into the kernel (e.g. smaps or simi= lar)". And > >>>>>>>>>>>> earlier he ran into some pushback on trying to set up /proc = or /sys > >>>>>>>>>>>> values because this is still such an early feature. > >>>>>>>>>>>> > >>>>>>>>>>>> I wonder if we could put the global stats in debugfs for now= ? That's > >>>>>>>>>>>> specifically supposed to be a "we promise *not* to keep this= ABI stable" > >>>>>>>>>>>> location. > >>>>>>>>>> > >>>>>>>>>> Now that I think about it, I wonder if we can add a --global m= ode to the > >>>>>>>>>> script > >>>>>>>>>> (or just infer global when neither --pid nor --cgroup are prov= ided). I > >>>>>>>>>> think I > >>>>>>>>>> should be able to determine all the physical memory ranges fro= m > >>>>>>>>>> /proc/iomem, > >>>>>>>>>> then grab all the info we need from /proc/kpageflags. We shoul= d then be > >>>>>>>>>> able to > >>>>>>>>>> process it all in much the same way as for --pid/--cgroup and = provide the > >>>>>>>>>> same > >>>>>>>>>> stats, but it will apply globally. What do you think? > >>>>>>>> > >>>>>>>> Having now thought about this for a few mins (in the shower, if = anyone wants > >>>>>>>> the > >>>>>>>> complete picture :) ), this won't quite work. This approach does= n't have the > >>>>>>>> virtual mapping information so the best it can do is tell us "ho= w many of > >>>>>>>> each > >>>>>>>> size of THP are allocated?" - it doesn't tell us anything about = whether they > >>>>>>>> are > >>>>>>>> fully or partially mapped or what their alignment is (all necess= ary if we > >>>>>>>> want > >>>>>>>> to know if they are contpte-mapped). So I don't think this appro= ach is > >>>>>>>> going to > >>>>>>>> be particularly useful. > >>>>>>>> > >>>>>>>> And this is also the big problem if we want to gather stats insi= de the > >>>>>>>> kernel; > >>>>>>>> if we want something equivalant to /proc/meminfo's > >>>>>>>> AnonHugePages/ShmemPmdMapped/FilePmdMapped, we need to consider = not just the > >>>>>>>> allocation of the THP but also whether it is mapped. That's easy= for > >>>>>>>> PMD-mappings, because there is only one entry to consider - when= you set it, > >>>>>>>> you > >>>>>>>> increment the number of PMD-mapped THPs, when you clear it, you = decrement. > >>>>>>>> But > >>>>>>>> for PTE-mappings it's harder; you know the size when you are map= ping so its > >>>>>>>> easy > >>>>>>>> to increment, but you can do a partial unmap, so you would need = to scan the > >>>>>>>> PTEs > >>>>>>>> to figure out if we are unmapping the first page of a previously > >>>>>>>> fully-PTE-mapped THP, which is expensive. We would need a cheap = mechanism to > >>>>>>>> determine "is this folio fully and contiguously mapped in at lea= st one > >>>>>>>> process?". > >>>>>>> > >>>>>>> as OPPO's approach I shared to you before is maintaining two mapc= ount > >>>>>>> 1. entire map > >>>>>>> 2. subpage's map > >>>>>>> 3. if 1 and 2 both exist, it is DoubleMapped. > >>>>>>> > >>>>>>> This isn't a problem for us. and everytime if we do a partial unm= ap, > >>>>>>> we have an explicit > >>>>>>> cont_pte split which will decrease the entire map and increase th= e > >>>>>>> subpage's mapcount. > >>>>>>> > >>>>>>> but its downside is that we expose this info to mm-core. > >>>>>> > >>>>>> OK, but I think we have a slightly more generic situation going on= with the > >>>>>> upstream; If I've understood correctly, you are using the PTE_CONT= bit in the > >>>>>> PTE to determne if its fully mapped? That works for your case wher= e you only > >>>>>> have 1 size of THP that you care about (contpte-size). But for the= upstream, we > >>>>>> have multi-size THP so we can't use the PTE_CONT bit to determine = if its fully > >>>>>> mapped because we can only use that bit if the THP is at least 64K= and aligned, > >>>>>> and only on arm64. We would need a SW bit for this purpose, and th= e mm would > >>>>>> need to update that SW bit for every PTE one the full -> partial m= ap > >>>>>> transition. > >>>>> > >>>>> Oh no. Let's not make everything more complicated for the purpose o= f some stats. > >>>>> > >>>> > >>>> Indeed, I was intending to argue *against* doing it this way. Fundam= entally, if > >>>> we want to know what's fully mapped and what's not, then I don't see= any way > >>>> other than by scanning the page tables and we might as well do that = in user > >>>> space with this script. > >>>> > >>>> Although, I expect you will shortly make a proposal that is simple t= o implement > >>>> and prove me wrong ;-) > >>> > >>> Unlikely :) As you said, once you have multiple folio sizes, it stops= really > >>> making sense. > >>> > >>> Assume you have a 128 kiB pageache folio, and half of that is mapped.= You can > >>> set cont-pte bits on that half and all is fine. Or AMD can benefit fr= om it's > >>> optimizations without the cont-pte bit and everything is fine. > >> > >> Yes, but for debug and optimization, its useful to know when THPs are > >> fully/partially mapped, when they are unaligned etc. Anyway, the scrip= t does > >> that for us, and I think we are tending towards agreement that there a= re > >> unlikely to be any cost benefits by moving it into the kernel. > > > > frequent partial unmap can defeat all purpose for us to use large folio= s. > > just imagine a large folio can soon be splitted after it is formed. we = lose > > the performance gain and might get regression instead. > > nit: just because a THP gets partially unmapped in a process doesn't mean= it > gets split into order-0 pages. If the folio still has all its pages mappe= d at > least once then no further action is taken. If the page being unmapped wa= s the > last mapping of that page, then the THP is put on the deferred split queu= e, so > that it can be split in future if needed. yes. That is exactly what the kernel is doing, but this is not so important for us to resolve performance issues. > > > > and this can be very frequent, for example, one userspace heap manageme= nt > > is releasing memory page by page. > > > > In our real product deployment, we might not care about the second part= ial > > unmapped, we do care about the first partial unmapped as we can use th= is > > to know if split has ever happened on this large folios. an partial unm= apped > > subpage can be unlikely re-mapped back. > > > > so i guess 1st unmap is probably enough, at least for my product. I mea= n we > > care about if partial unmap has ever happened on a large folio more tha= n how > > they are exactly partially unmapped :-) > > I'm not sure what you are suggesting here? A global boolean that tells yo= u if > any folio in the system has ever been partially unmapped? That will almos= t > certainly always be true, even for a very well tuned system. > > > > >> > >>> > >>> We want simple stats that tell us which folio sizes are actually allo= cated. For > >>> everything else, just scan the process to figure out what exactly is = going on. > >>> > >> > >> Certainly that's much easier to do. But is it valuable? It might be if= we also > >> keep stats for the number of failures to allocate the various sizes - = then we > >> can see what percentage of high order allocation attempts are successf= ul, which > >> is probably useful. My point is that we split large folios into two simple categories, 1. large folios which have never been partially unmapped 2. large folios which have ever been partially unmapped. we can totally ignore all details except "never" and "ever". it won't be accurate, but it has been useful enough at least for my product and according to our experiences deploying large folios on millions of real android phones. In real product deployment, we modified userspace a lot to decrease 2 as mu= ch as possible. so we did observe 2 very often in our past debugging. Thanks Barry