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 2335BC3DA6E for ; Wed, 3 Jan 2024 09:35:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7794A6B00CC; Wed, 3 Jan 2024 04:35:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 728E18D005C; Wed, 3 Jan 2024 04:35:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5F2BC8D0053; Wed, 3 Jan 2024 04:35:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 4CBF16B00CC for ; Wed, 3 Jan 2024 04:35:32 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 23B6FA1BC2 for ; Wed, 3 Jan 2024 09:35:32 +0000 (UTC) X-FDA: 81637492104.22.22BC4A6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf21.hostedemail.com (Postfix) with ESMTP id 601ED1C000A for ; Wed, 3 Jan 2024 09:35:29 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704274529; 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; bh=7Hx5ZBK126y2DuIapzHJsk2E7MxBloQ4o7uT7U1mTiA=; b=NYX+lYM1QLGiJ/rAHHX5sFKPvkZOs//mUbExHtTG6RCvynR9nWv/ShDqjlmsmSybRJC3Bk V/ELzh1/BM6ISqe1irmXlXWoRsgHmda2Q7AnpMo4t/4XcU7IkcZ1i3nPxFXlyL5Yb0aP/c kuM4qN86fwMxUTilbN8dj4MaLyMmypE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704274529; a=rsa-sha256; cv=none; b=mO9aiqSGRqGh7NGDK7xkDR1Zr+Pstr3C9BLpOEYJazP1U+FQGyt7hReRM8idzd1RJ+esfa ItgNTGFXRtVhdXLh0iv840liKITxIagNxFZUEcIw0S3xMdTqXpnivtIVh/dT1gb6cHwR/r Gf6pGOmQy734BybEgtLQdJ/7DlzS/GQ= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5830BC15; Wed, 3 Jan 2024 01:36:14 -0800 (PST) Received: from [10.57.74.226] (unknown [10.57.74.226]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6393C3F7A6; Wed, 3 Jan 2024 01:35:26 -0800 (PST) Message-ID: <0d06b0fd-01f3-4a93-811d-f39c0b326b23@arm.com> Date: Wed, 3 Jan 2024 09:35:24 +0000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v1] tools/mm: Add thpmaps script to dump THP usage info Content-Language: en-GB To: Barry Song <21cnbao@gmail.com> Cc: William Kucharski , Andrew Morton , Zenghui Yu , Matthew Wilcox , David Hildenbrand , Kefeng Wang , John Hubbard , Zi Yan , Alistair Popple , "linux-mm@kvack.org" References: <20240102153828.1002295-1-ryan.roberts@arm.com> <29007216-8A9B-4CA2-8A87-EB33E338CBA7@oracle.com> <84b43094-9b16-40a5-94e8-6dd4e859a01f@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 601ED1C000A X-Rspam-User: X-Stat-Signature: rz7poe9j9zafuaj1wdjj8ddn66rnz3js X-Rspamd-Server: rspam01 X-HE-Tag: 1704274529-35112 X-HE-Meta: U2FsdGVkX18ozV2yDXoKlRBGNUDU/dVLW+F1dK/YT6Jst8o+XlN5GNmZMGfGx+IMp90CrPeVg5Hijap7C++/9nJbOrt+tY4pNYgsoGTze3Sk246iQAHp4jIhI3flkGpTBo2drdECmku7afLAQslLq9jHdNFiMvYx1dc4BfQwvdFHpqfye9G0h/DCVlWLONUrGoFOR+Y83UXbulbPxba57GJHbsA/jlo2U+OBpc/4ms4gnmOuqm5sTSvaCpcVpYgq03SRj1yCEK+0GQJ/f+pnhwtvkSssSsv/w1fOziwKqffmMPNssQc1qpTbSTomUhmR0c3DCTOWWS0Tug3LnBcmVEMsDLYOvotDLM/9zym6XW+NhCYe4Lcf6ebIl9OnxdkiB4H4elU3rctSFnr2IrOQmGpp70NrpxDQmDRE6X26a02FEPP77RkA4yeyFITKB0tu0plNgbt/STrB0RkE+zQJyzS0gz5rgwBOpzh2tYtptQqcPTEhwADgp+sQEBP/5iwpAI/WygQsHhQiusFlpR4/VD3gZ5sifFDDghfcDFWQq3JZvEyj4uuwrj9XClE59lus0po6z/35Da2Y6SaSNdGi75IbptRl7X7F1FBKMPZUkfOz4xPoHoIYVN1Axd7xYSnBkKkSLkAMFcu8GPNDoQJc8BuDe9an6gNyzU0HEet/64FbOHJzC5sY+qFBuW0OH3y0+Yw0IeRFuxtg1mVyknzEIBf4ktTx7gMA+jRdZbPyK4+QK65a2WF23TS+42oOSIeZV0QIAxLIO+18X5Jp+j345bMul4CcOcWX+PNBGvl7ysU4pj1aUPdMQjoup0M/sCSehRQ/SLB6whe0A/Tx83/lUx0MVIBdSfTXwULofQKI6U6tpqq8MN71lCtSBod3qQ0K1OTlYgR33OfDhoseyOE6ZwIj6yMErRIeGeQy6lYwN5IU94njk5Oaq7/g1+YRVCpymu0YOaKspfngXg171LY 52qNdUqv rvpDqgIJBf061U5iVTrqIPplPbAWm8b6nolNNYG7undOwMdomTATPRvDg+oD2v/IGuHR0sDy1Nil3kByWFrvHV7bCyEJGfv78SH2zxffUNDmG2TROPoX10SWOrytqOGwvpo5biirvzKZYFKLGOjV+dVdsYnBWLyONohhdnY0m3z/PNkUwKzVuZ26kVinHw72ZoStgvLUdK2Uv1m+ET2bG12543MWpI0XD7jozk3ueWEseKCQ8Cptw5s37oPRQtWQ8Us6x35a0IOx2L2b69CPfAyrfHglRsAH/hDlnX+0fSWvtBn2dkfzEK2DhK423sUwBvDufpZZoPjMGCeU= 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 03/01/2024 09:16, Barry Song wrote: > On Wed, Jan 3, 2024 at 9:25 PM Ryan Roberts wrote: >> >> On 03/01/2024 08:07, William Kucharski wrote: >>> >>>> On Jan 2, 2024, at 23:44, Barry Song <21cnbao@gmail.com> wrote: >>>> >>>> Hi Ryan, >>>> >>>> I ran a couple of test cases with different parameters, it seems to >>>> work correctly. >>>> just i don't understand the below, what is the meaning of 000000ce at >>>> the beginning of >>>> each line? >>> >>> It's the pid; 0xce is the specified pid, 206. >> >> Yes indeed. I added the pid to the front for the case where you are using >> --cgroup without --summary; in that case, each vma will be printed for each pid >> in the cgroup and it seemed sensible to be able to see which pid each vma >> belonged to. > > I don't understand why we have to add the pid before each line as this tool > already has pid in the parameter :-) The reason is that it is also possible to invoke the tool with --cgroup instead of --pid. In this case, the tool will iterate over all the pids in the cgroup so (when --summary is not specified) having the pid associated with each vma is useful. I could change it to conditionally output the pid only when --cgroup is specified? > this seems like duplicated information > to me. but it doesn't matter too much as this tool is really nice though it is > not so easy to deploy on Android. Hmm. I've seen tutorials where people have Python running under Android, but I agree its not zero effort. Perhaps it would be better in C. Unfortuantely, I can't commit to doing a port at this point. > > Please feel free to add, > > Tested-by: Barry Song Thanks! > >> >>> >>> Perhaps the pid should be printed in decimal? >> >> I thought about printing in decimal, but every other value in the vma is in hex >> without a leading "0x" (I'm trying to follow the smaps convention). So I thought >> it could be more confusing in decimal. >> >> I'm happy to change it to decimal if that's the preference though? Although I'd >> like to continue to present it in a fixed width field, padded with 0s on the >> left so that everything lines up. >> >>> >>> -- William Kucharski >>> >>>> /thpmaps --pid 206 --cont 64K >>>> 000000ce 0000aaaadbb20000-0000aaaadbb21000 r-xp 00000000 fe:00 >>>> 00426969 /root/a.out >>>> 000000ce 0000aaaadbb3f000-0000aaaadbb40000 r--p 0000f000 fe:00 >>>> 00426969 /root/a.out >>>> 000000ce 0000aaaadbb40000-0000aaaadbb41000 rw-p 00010000 fe:00 >>>> 00426969 /root/a.out >>>> 000000ce 0000ffff702c0000-0000ffffb02c0000 rw-p 00000000 00:00 00000000 >>>> anon-thp-aligned-64kB: 473920 kB (100%) >>>> anon-cont-aligned-64kB: 473920 kB (100%) >>>> 000000ce 0000ffffb02c0000-0000ffffb044c000 r-xp 00000000 fe:00 >>>> 00395429 /usr/lib/aarch64-linux-gnu/libc.so.6 >>>> 000000ce 0000ffffb044c000-0000ffffb045d000 ---p 0018c000 fe:00 >>>> 00395429 /usr/lib/aarch64-linux-gnu/libc.so.6 >>>> 000000ce 0000ffffb045d000-0000ffffb0460000 r--p 0018d000 fe:00 >>>> 00395429 /usr/lib/aarch64-linux-gnu/libc.so.6 >>>> 000000ce 0000ffffb0460000-0000ffffb0462000 rw-p 00190000 fe:00 >>>> 00395429 /usr/lib/aarch64-linux-gnu/libc.so.6 >>>> 000000ce 0000ffffb0462000-0000ffffb046f000 rw-p 00000000 00:00 00000000 >>>> 000000ce 0000ffffb0477000-0000ffffb049d000 r-xp 00000000 fe:00 >>>> 00393893 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 >>>> 000000ce 0000ffffb04b0000-0000ffffb04b2000 rw-p 00000000 00:00 00000000 >>>> 000000ce 0000ffffb04b2000-0000ffffb04b4000 r--p 00000000 00:00 00000000 [vvar] >>>> 000000ce 0000ffffb04b4000-0000ffffb04b5000 r-xp 00000000 00:00 00000000 [vdso] >>>> 000000ce 0000ffffb04b5000-0000ffffb04b7000 r--p 0002e000 fe:00 >>>> 00393893 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 >>>> 000000ce 0000ffffb04b7000-0000ffffb04b9000 rw-p 00030000 fe:00 >>>> 00393893 /usr/lib/aarch64-linux-gnu/ld-linux-aarch64.so.1 >>>> 000000ce 0000ffffdaba4000-0000ffffdabc5000 rw-p 00000000 00:00 00000000 [stack] >>> > > Thanks > Barry