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 X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D52F9C4360D for ; Thu, 26 Sep 2019 03:36:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A37A7207FF for ; Thu, 26 Sep 2019 03:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A37A7207FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3CD266B0006; Wed, 25 Sep 2019 23:36:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3578F6B0008; Wed, 25 Sep 2019 23:36:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 245B06B000A; Wed, 25 Sep 2019 23:36:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0158.hostedemail.com [216.40.44.158]) by kanga.kvack.org (Postfix) with ESMTP id F17176B0006 for ; Wed, 25 Sep 2019 23:36:22 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 6A3258141 for ; Thu, 26 Sep 2019 03:36:22 +0000 (UTC) X-FDA: 75975659004.24.cause09_8ee2ae022d93f X-HE-Tag: cause09_8ee2ae022d93f X-Filterd-Recvd-Size: 4929 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 03:36:21 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8642EACC4; Thu, 26 Sep 2019 03:36:19 +0000 (UTC) Subject: Re: [PATCH 1/2] perf script python: integrate page reclaim analyze script From: Tony Jones To: Yafang Shao , peterz@infradead.org, acme@kernel.org, namhyung@kernel.org, akpm@linux-foundation.org, jolsa@redhat.com, mingo@redhat.com Cc: linux-mm@kvack.org, florian.schmidt@nutanix.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org References: <1568817522-8754-1-git-send-email-laoar.shao@gmail.com> <1568817522-8754-2-git-send-email-laoar.shao@gmail.com> <456c8216-a9f4-6821-e688-744e93df826f@suse.de> Openpgp: preference=signencrypt Autocrypt: addr=tonyj@suse.de; prefer-encrypt=mutual; keydata= mQGiBEkQmbwRBACDch7wo/RzlNt2HA8jLICsO2w8yOkJ7UTzHYNn3Q83Ro0qev2KokfE3EDw il+vam9CDR7jIDmswHqaMe0/O+UnZtO5PlDgylZcrwNwbBzHfm/KGejbi1RBGAoETrvcfwGi w83bR/aDnoRXY5Ho1uphQ05/065EMpbJOOBdn9qQ4wCgv2Q6C/QeYDGsxJPRO+20nLu5K00D /Rde4OTZ5biM+vb6ObTmgPNeiMrTwGpMokN7audIl7njwvD+lYrlgQjmDzcaPFz29rYWwT7g 6t6hcFgjpU1he/v3qxeQlTJoi2+u5Mqj42z//49h6DqNjT859Z/6h5IwKBo/EZC17iBIlS2G VXAstNiZASGiaIlONozWJ/GSjUaRA/9wZTV1nXF/+xX+qmc7SvTg1w6jWyjxVumQLoq2SeA4 1Sy5X2IATkAGCCjbeoQGnFdbOnHRSJdlTazObgwreqGPlPnIROpr9QESkfxsa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se.de> Date: Wed, 25 Sep 2019 20:36:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.2 MIME-Version: 1.0 In-Reply-To: <456c8216-a9f4-6821-e688-744e93df826f@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable 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: On 9/25/19 6:56 PM, Tony Jones wrote: > On 9/18/19 7:38 AM, Yafang Shao wrote: >> A new perf script page-reclaim is introduced in this patch. This new s= cript >> is used to report the page reclaim details. The possible usage of this >> script is as bellow, >> - identify latency spike caused by direct reclaim >> - whehter the latency spike is relevant with pageout >> - why is page reclaim requested, i.e. whether it is because of memory >> fragmentation >> - page reclaim efficiency >> etc >> In the future we may also enhance it to analyze the memcg reclaim. >> >> Bellow is how to use this script, >> # Record, one of the following >> $ perf record -e 'vmscan:mm_vmscan_*' ./workload >> $ perf script record page-reclaim >> >> # Report >> $ perf script report page-reclaim >> >> # Report per process latency >> $ perf script report page-reclaim -- -p >=20 >=20 > I tested it with global-dhp__pagereclaim-performance from mmtests and g= ot what appears to be reasonable results and the output looks correct and= useful.=C2=A0 However I'm not a vm expert so I can't comment further.=C2= =A0 Hopefully someone on linux-mm can give more specific feedback. >=20 > There is one issue with Python3,=C2=A0 see below.=C2=A0 I didn't test w= ith Python2. Ok, I guess this wasn't actually tested with Python3 as itervalues() is P= ython2 only. Any scripts need to work with both Python2.6+ and Python3. # perf script -i /tmp/perf.out -s page-reclaim.py -- -p ... Traceback (most recent call last): File "page-reclaim.py", line 305, in trace_end i.display_proc(), File "page-reclaim.py", line 268, in display_proc print_proc_latency(sorted(self.stat.stats['latency'].itervalues(), AttributeError: 'dict' object has no attribute 'itervalues' Fatal Python error: problem in Python trace event handler Use a try/except to handle this. Thanks Tony