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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 8F744C4360D for ; Thu, 26 Sep 2019 04:38:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5342C2146E for ; Thu, 26 Sep 2019 04:38:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SPuG1E35" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5342C2146E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C2B3C6B0006; Thu, 26 Sep 2019 00:38:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BDC076B0008; Thu, 26 Sep 2019 00:38:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ACA226B000A; Thu, 26 Sep 2019 00:38:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0189.hostedemail.com [216.40.44.189]) by kanga.kvack.org (Postfix) with ESMTP id 850226B0006 for ; Thu, 26 Sep 2019 00:38:06 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 19D83180AD802 for ; Thu, 26 Sep 2019 04:38:06 +0000 (UTC) X-FDA: 75975814572.14.sun26_63c7a97e4a64d X-HE-Tag: sun26_63c7a97e4a64d X-Filterd-Recvd-Size: 5289 Received: from mail-io1-f68.google.com (mail-io1-f68.google.com [209.85.166.68]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Thu, 26 Sep 2019 04:38:05 +0000 (UTC) Received: by mail-io1-f68.google.com with SMTP id q1so3063068ion.1 for ; Wed, 25 Sep 2019 21:38:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=9sRAyjsHaXznk/whN2C+BXH4RuFtDZdSG5+S735+JJM=; b=SPuG1E35Hn7AfnFw8iEbKYWQBrQjDAHEwyKsicP+UUHH//fku50xWbOkmON4EvyMXI uuFDaE8PuWBPUUirm2v7YBASMNw41M1wwKxInrxZPKQzT3TNbxkNgFx9ymeYdhhlldDb E2n4QoR+0vadcqGxnXPk0/yQy5Gtkt7c8FktDG5uofn1MgWhTjvl+OSf9T6EpZfR0WIY Elg5+VDByhCijeDo1lUQn4L1wdPnNECxWCQrZoPH4sXP2c8tUlZ1AYvtFWEDTV53L+qv g34dJUxAWSJ6oBzvY/zXlBoYsZAb4nTBLL7XAti8HF1FRZA2vdS2J39+bfu5zD68t1YF X0VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9sRAyjsHaXznk/whN2C+BXH4RuFtDZdSG5+S735+JJM=; b=IMK4AefkQrCnuzNqTtEDW42yBntqq3YwtC8HnHuA9Mq4IL1jcI1ThDNoFzmv9tdWex qrUKtwINbHdf9A6IsTYHrcSNwgbEwWyJnd8wUbKXQVZ2hLcnDE/a7J1bl3Vf0af8VN92 PCJ04RqbrGfHIYBR7/0YG/aRQ1BcAFtRcTR+2Dl5O7I8fBnuNHqotgbrNfvVN7fzyskw LLYHPLBCotUTpVXg1OqgTFf0PLqJUQLFasMhQaNckRlmWM52z267hs32DzjcnI+7kY6l 8wf/VUMefYELI5UF7sUfbRfn4Ns+S1RQ+XsPmx1JUyxfoKXohxty77W9CYZA90p5Hb8w TwMw== X-Gm-Message-State: APjAAAVmXL8PGbW+O5pPpKvjOsRpDVKAb9EkFfcSxehh6/AqGJNAZYQo oRqLVQ5xhs7uD3kRkl32TqhoVCUd2Zm8mjoK5aU= X-Google-Smtp-Source: APXvYqxYrrby9K9CuvLt+zGBeIinH/stC9TWA+D1xNwNWg6RyCYsjHxh7cV21Jdy4HvEd/N11UFmHi+62RwaPFoJur4= X-Received: by 2002:a5e:d817:: with SMTP id l23mr1693125iok.142.1569472684945; Wed, 25 Sep 2019 21:38:04 -0700 (PDT) MIME-Version: 1.0 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> <49489979-0bf1-881c-ebd5-87d0892a7da4@suse.de> In-Reply-To: <49489979-0bf1-881c-ebd5-87d0892a7da4@suse.de> From: Yafang Shao Date: Thu, 26 Sep 2019 12:37:28 +0800 Message-ID: Subject: Re: [PATCH 1/2] perf script python: integrate page reclaim analyze script To: Tony Jones Cc: Peter Zijlstra , acme@kernel.org, namhyung@kernel.org, Andrew Morton , jolsa@redhat.com, mingo@redhat.com, Linux MM , Florian Schmidt , Daniel Jordan , LKML Content-Type: text/plain; charset="UTF-8" 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 Thu, Sep 26, 2019 at 11:36 AM Tony Jones wrote: > > 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 > > > > > > 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 u= seful. However I'm not a vm expert so I can't comment further. Hopefully = someone on linux-mm can give more specific feedback. > > > > There is one issue with Python3, see below. I didn't test with Python= 2. > > 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. > Hi Tony, Thanks for your review. I only verified it with python2. I will improve it to make it work with both python2.6+ and python3. Thanks Yafang