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 EE879C3DA6E for ; Wed, 3 Jan 2024 10:20:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 688E76B0109; Wed, 3 Jan 2024 05:20:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 639456B028D; Wed, 3 Jan 2024 05:20:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 416936B010A; Wed, 3 Jan 2024 05:20:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 31C8F6B0107 for ; Wed, 3 Jan 2024 05:20:56 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 031BF160208 for ; Wed, 3 Jan 2024 10:20:55 +0000 (UTC) X-FDA: 81637606512.16.D9B458C Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id DE1CE40025 for ; Wed, 3 Jan 2024 10:20:53 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704277254; 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=Vu2/zvmNOZKh6Hr9GJ2z4uTZMx2vTpBOUEobze2LRe0=; b=A8tZMB5nHPvjQibNNu4lM0yR+U8w1X8vzec3uzUqOOyeHLo3GLP7ACRLmuY9K5toCNT21G rtBB38+bqjUrJ2HH/dXcyMis5cLsXoYDA4LV+2pJrbi+cy+RNiSxV54nriQg4eqQhiJnV1 CHpH0SzC+KyluSUiXWQfpYH+JG+/zeU= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=arm.com; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704277254; a=rsa-sha256; cv=none; b=4nHrgehNgHbmc24+4aPGc/OwpC4zQYD6kdIiTgGqu/qgdg7jQISLE/XLKenE3wIkVNnIrY Y9eHZgGImbrcok8sDqH+a2OrMfCLM/X2ep13W/Lc/SQUEYOSzLclKbuAy6lwsRJFwPjjR2 AuyGu+AbikvoszlC2PO59kQ4Q1/cJ24= 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 A5303C15; Wed, 3 Jan 2024 02:21:38 -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 D4D633F7A6; Wed, 3 Jan 2024 02:20:50 -0800 (PST) Message-ID: Date: Wed, 3 Jan 2024 10:20:49 +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: William Kucharski Cc: Barry Song <21cnbao@gmail.com>, 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> <0d06b0fd-01f3-4a93-811d-f39c0b326b23@arm.com> From: Ryan Roberts In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: DE1CE40025 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: iyewthu7fad1qbiy3ojqm5m5kc8ighi4 X-HE-Tag: 1704277253-644695 X-HE-Meta: U2FsdGVkX18OlBA+Xo9/6cR88/V8E2qAQRHIxmph6KDfIyCNqTab2OOMr/1XqQfhVxIzQj82Gzm+ui3IW7NF3tz94i6ja+ngCGd0Wzvo1RPIkAu05WKO79MvEoPqL0X9R8oqR/e00DQOk8/C72O+6ttmcjLqh+rM8NxRkMaSeIPyUpEpXaJlgVf09snkoUxBGj5FEQRS7XcvGPl9/tCZnAObiviay2zVHVCUBYf+ElcE7h6rcQpB7FyZS/CeK5pcvrRTigmdgMCBLkpCgFJKEKojgXylNI7JdJf4yNc2VDW78m4lzKKADDS/RuTmBEIppwZZLjyPOxMcGwxAc3XDixs9OvvAkP/4SLl80noTn/w2ROBBDitWfWHYneMjkSuCQ1pIqKI0ItzVITBYbifiV4w9MJCKnBqe9Acjctw904a+/KkLdfB9tUxoOmh4MhrxdmYwOriUzZ2ut2Zmpm2PIeFkKLkQSk+cjFzZUSgBVGSmbjZBhW+gHMvuIn9ULmBkuiktTph3llPvdUSZ5cn2XViASzA9bh5phnJCgNq7PCvqXZ52BR/lTBnYKrZYP+hKT23bBDeBH75rT8dyVtw0bAL9ae3ui89pLFIaNeA3mxjALiyh+gjdxV2zzmK92x3TvuKrCg6TBYz3ufTlThd041QyW4w+aO7pvoMTcxrc3Hgcy0Ailzp2OHsZuI+IeAD4jAe3ryLprPVUUtvgHVhFmxF77CPpQ4y+1EgP9wr0os2K0sdAv8hzuSLDtP2Bj2mR9tOQ8Xo8tvzDGXAJPoLgJei4NDx3QhvLPdF5Yxiv4/rIkXwjSU1GawJRI6F2d2Bj3D3APY4B3ukzjd07kRvgLxnFjY3in6+DnS99CBC1R+n+hTnCMwdw+ffcb1ME4FJfQWSOU21OQuNyiRgt80LpYi4KUJkjmm5OUxGNDB3LLKs0fkwsLTeDT5KLX0htPWTqRPy69DR7nXzE940VY6H AW3ASbaR 0Xk2uP6THMNxjOcbY8I5jj6o0T6nYtifQ6LoGyyfnR6D9pihJOXyJY8hXt9aMtSkzd2HVwVy+JM31OwHV1FSSoaPlQnPGQHgIMUUB1yLQjueTLJeEwTB55tE5RxL/0MWD5BU9JQEDmFjWJX93a7Hf0mFceqemUvu2GvYpysQ8SHkhP4gLQmwVTbcNyCUjSjb46AGyq1d/fSwxWNqotjgPwPmRij54FBtOlDMnqBDvsuEGn9J8K/VK4JzKrWHa4AgyXSl6U3kugTLnEEiXYTBK84v8nGB2l+GYTQIG3ZqJ531Hgi+NO7g5baAe+AsZjTSlOxO1Nz++zSR7uKA= 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 10:09, William Kucharski wrote: > > >> On Jan 3, 2024, at 02:35, Ryan Roberts wrote: >> >> 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? > > You could, or perhaps emit a colon after the pid to delineate it, e.g.: > >> 000000ce: 0000aaaadbb20000-0000aaaadbb21000 r-xp 00000000 fe:0000426969 /root/a.out Yeah that sounds like the least worst option. Let's go with that. > > but then some people would probably read it as a memory address, so who knows. > > -- William Kucharski > >> >>> 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 >> >> >