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 AEEC9C3DA6E for ; Wed, 10 Jan 2024 08:03:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 129546B0075; Wed, 10 Jan 2024 03:03:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D9576B007B; Wed, 10 Jan 2024 03:03:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EE3706B007D; Wed, 10 Jan 2024 03:02:59 -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 DC6906B0075 for ; Wed, 10 Jan 2024 03:02:59 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 977E4A1FF0 for ; Wed, 10 Jan 2024 08:02:59 +0000 (UTC) X-FDA: 81662660478.05.C210BC7 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by imf25.hostedemail.com (Postfix) with ESMTP id B1510A000B for ; Wed, 10 Jan 2024 08:02:52 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gcfRQfx8; spf=pass (imf25.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.175 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704873772; a=rsa-sha256; cv=none; b=mCkcUn/0nfLFWUBYLc0pgzxY8Lq4sWeAjuy538S7cNXJPrOoSryKyLaP6Tx5dA2cYfeTls gCLTGyraZh5BhDwT7woqbjajMDhXvSzKGdd+1tE+gXuoiWLzroMec7+q6PkywU3hBd5ieG GpFwe5ew9ukSQJkVYCMpvIupN4BY48c= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gcfRQfx8; spf=pass (imf25.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.221.175 as permitted sender) smtp.mailfrom=21cnbao@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704873772; 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=XjTF+tbYK/FTCdnSvY68VavtiZGyWFwTPRuOKPFtXnI=; b=pqbmOjSihBRET1uqvDpylK1ZTxwgLtLXcfgiG7gGRbUDTncXAJ7/5KzEHNtv+PhWPJiS2g S1OTgBelobGIQr8z+XLDH2cKBMjbHcTeHUcxrRGib7NpMJuw/rtkwvRnNpiu+vmjntzEX9 7jb+rrKn+eKOt3eaAKyMeaGe06T3Wqg= Received: by mail-vk1-f175.google.com with SMTP id 71dfb90a1353d-4b857733f9aso776828e0c.2 for ; Wed, 10 Jan 2024 00:02:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704873771; x=1705478571; 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=XjTF+tbYK/FTCdnSvY68VavtiZGyWFwTPRuOKPFtXnI=; b=gcfRQfx83R5mxJVeyitZdoBZi50LRxL02a4JLakC++KPz5Dr2RRL5QuUjb1/vj9d/b MMRxsd1YSEDtB9PXGWpOLVqLfZCsheHflxEjvX6iNi0N2kwoaB1qbKwCeuBDbTy3WB1r zGmqCK1EIKkN0PORF/sIeH972fRSYhkiD6h+36XQbObVSwn7I66/sd2exC+RB2p1kq6w DNrjg3WanpcRxZWk/aZVL3DEu8tPvyOOIEOA4/rdlGMgzK8BSJ+ufwOSYLwSXeM0wmiA jmgC65Ub4w/YEllwfjud637ziGBkivbsJ7xoCta3c0L+yn+Hwwqy5M61hqkDvljlAGoS CcUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704873771; x=1705478571; 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=XjTF+tbYK/FTCdnSvY68VavtiZGyWFwTPRuOKPFtXnI=; b=rRmMoE9hyEkOW5O9GkrmW6pGawK/OA6oL2iJqUjvcHdIeQIS3n8UUumnpbq9gVZzT9 HJmr0JoXxluu2WVl8E95PD7XoXODEAoOEAQXht8H23VWOWJkMoGNBlSdfVeH60ZKvmNs rjmxsw48k704HIOTq2aOSKSagl+Z5iDTQSWhXvZCSqR2/Sw/Z6BXdNzC0mHDayLdXvZs asuTGMY/4CVXeIYqoubqMczysNwzpuNuZYt5ssT3/1iDQNr+HI6hVwixt5VSsbm2HY7L ddM2U0WFrLiO+5dbMrzwdYmKt8E7Bq3zramsbiWHn860XFslxJg5DnEuoJJroXYbieJ3 yneg== X-Gm-Message-State: AOJu0Yxq8lSvy/FvDNV0N6oifM562LB2P4v0TFcIHsa7Y8xyq33KVbd7 hRKRM0pTJPgLN/RsADNc+vkUJ4W/sLhFCOyW8ZA= X-Google-Smtp-Source: AGHT+IHu9tvDbJw/1ZvLMHvgeXN/Om73PVlmB3+j7Wrp8igG6/ziepKAV56HwKosrHrG9J4TkQtyLAMNT8juA6Lvg1E= X-Received: by 2002:a05:6122:1c8f:b0:4b6:da2d:6444 with SMTP id eu15-20020a0561221c8f00b004b6da2d6444mr194661vkb.19.1704873771670; Wed, 10 Jan 2024 00:02:51 -0800 (PST) MIME-Version: 1.0 References: <20240102153828.1002295-1-ryan.roberts@arm.com> <4e7445a0-acc9-487f-999f-a2b6d03d265e@nvidia.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Wed, 10 Jan 2024 16:02:40 +0800 Message-ID: Subject: Re: [RFC PATCH v1] tools/mm: Add thpmaps script to dump THP usage info To: John Hubbard Cc: Ryan Roberts , Andrew Morton , Zenghui Yu , Matthew Wilcox , David Hildenbrand , Kefeng Wang , Zi Yan , Alistair Popple , linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B1510A000B X-Stat-Signature: zm7bnrssn5f6pi165a78hym4xtg9js6a X-Rspam-User: X-HE-Tag: 1704873772-859627 X-HE-Meta: U2FsdGVkX1/Ri7jOZJ3GVDGDIxEcSUTVk0OCkoZiMWZlyfG3rHmLwf2sRTmWA/soDC4DOzNCGgxvjE5S7ghvZWzlV+1fWOdFnJhuuBdzD1ejtZB4QW+tJ4I0wSIZBjWD6sO5gn1oW+UuHTXRsXe3/AAKpalkdP+zsIY+/KfDZslTeV5i2eubPR48OOvEyzwxTmHxm6ux3zBFuFMsGHWTT5l7xn5caWxstxH8cNGl06WUbdZr1UwyDADEQDi4aNCBW4tLsCuPOKszBRxhN/zXZyq+D3sHf3VwYX1cbva+uPjoNoPO7DTMWsDqtxwCtd+GbCoAm+sVeuvQH7NkkfMG7W0WPkCbL9na+s6l+dlV4nFUlHkNcjhB4TVeauuWL4umhG6tizUkZYC8Kg05ZnWYis0cqVfS27IAWWm8GFvXo7i67iFYDBy9GrmhE+NOSQ2N21ZGV+WghSerX48XmDx+1Fvcht5v0dBvm9Xku4kbSZsyLWSs4ytvSkqWGQyisu5xsnKWXtI8snngBBWmmUNmvRQpw3jD0q1VnrvBiPKH4ZhvUrGAHAE+Wtm+TOeL3yg1pRpy/r0eUCee4B/tIi1DJL7nyfeOnMkdjQLYOsPFmR0h3D+EHnBSTD8CVpJW2SqZ4WhhcuWxZzWbI64IKazVI3cArK/dpG/fwSPAEP4buoG6wS7sTgIYsGhnftyUQa4+50Vn7eSpIblMUpXWOr4XySTlF+r7e/zMK7Av87DVuY/rnWiQpu2Y0/JFfEMeN2+XCTZQeXU2zmwpNlLVgaiNIRaIvnvBnQXGpeg1vDtzRlAyi2yNjwGVhi82ifU3UrDK9Qf5OkwPIEAa8XQEaTt0R84PvqgyOx7PyYryQuvQE9/X4ykNiA4FnNzSKepsgASG9VPrUdA1HeKFaFd+SnA7tcmJsfyPNJlOukiJcjonO5uXvEXJ0uedQ0aaSD9KOTq1zxdX+3jV1sp6iD/ByID Z8Uq+VIk 9fyW4jKA0Rhos1vI3AHJmo7ciYxKcJD48CbCMm3FyIyAZizjipFs68ElGls7XaCHPNNg1T9ebg0785f06iv9vRFNbYyx4umw8nbtfVfOkgL5UkdvUb+iicrpsU2Ivnj7mDLdEoOIqlNFDipQ1cs68msYltWhedrCu6kq4uDgcxBXOfT3namyG9dYBLaksrSi3b/WTeEaKCYpIfkEn1sVc6C82Qk50Y5HmfkVYrwZuTHAEIyt3lvPCoK7i7rRDX80xpgYdhL0l6Ic6dR1N2RZuDcVQM/3Zyds6vjZXQzXFD7ougY3ZLVk1nCk+GwkgEDUGhSA3uH3IiSyabIqvmEOiMajvhs7ZwxtY222qLSQCVIfsEb19cCV/IIHwBQ== 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 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 testing of mTHP > >> on arm64: the pid requirement is sometimes a little awkward. I'm runni= ng > >> tests on a machine at a time for now, inside various containers and > >> such, and it would be nice if there were an easy way to get some numbe= rs > >> for the mTHPs across the whole machine. > >> > >> I'm not sure if that changes anything about thpmaps here. Probably > >> this is fine as-is. But I wanted to give some initial reactions from > >> just some quick runs: the global state would be convenient. > > > > +1. but this seems to be impossible by scanning pagemap? > > so may we add this statistics information in kernel just like > > /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. The detailed per-pid or per-cgroup is still quite useful to my case in whic= h we set mTHP enabled/disabled and allowed sizes according to vma types, eg. libc_malloc, java heaps etc. Different vma types can have different anon_name. So I can use the detailed info to find out if specific VMAs have gotten mTHP properly and 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 similar)". 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. +1. > > > thanks, > -- > John Hubbard > NVIDIA > Thanks Barry