Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1858973ybn; Thu, 26 Sep 2019 03:19:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqyiO5o5QuHPggj2NSwaEbf7B6B7DciyQ+jRjePVLJwrfkEITtD8awEPFctck7YhbskAw3Rt X-Received: by 2002:a50:ac0d:: with SMTP id v13mr2615393edc.189.1569493159251; Thu, 26 Sep 2019 03:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569493159; cv=none; d=google.com; s=arc-20160816; b=y/E9+CQIzmF/R5a4FvvOoN9V0CL3D1ZI/3iTOsQ/GVn+4KcJj833i/1EQmaj/zRxcJ DAfL5z9pkpJohotwplYysk5lWsySf027lT7UPUKua1bUwQ6gyeI154RWPCbyxjkm3wOD iSm6uDSHwAiifd+vuwl9ZRhLdUWqYi70oXZb3xn0Lrq4nGx+07DvBaKOFXTDdyjlujLK P7M3zQdgMcBCakW97nwGQsbT6S8jtaeEOI6dzE1Ud8XDBp7gseRneo/dz46tV+0Utw9g xswtzED48xzlL0+ie8GVHtwooI7tHOVq3qU/Rh+GWUUckPeqHs5S6dSMIFQJtix2QFR0 RiUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=OFA5Uz5BCNq/MfwnbLzI5wj5RSqOhUTcf5ZFKST8Ysc=; b=kZCZN/HRloiscahLlpCUZhtev7S9O0aA5x57B2fARJJib8zMoLW0EHucDqKRM2PTmD aZwtuxkgyNHCJk0Wqxr9TFjY9n7aeRrbAq5/V3JXtZhSU1qwsv8VPDEn1thJ5nwhN4AZ 1El90qJRpatU5e/+dR78gGUQVh50KNvSyqQEf6bHtI9e0gdQ8FP6C/FdWI1Xx/c2ezdX 6H4/RdlzIxFosQtHQwcGtTVw/a0KJOOkptAUxe8vH5GXXJ0LL9zHr5WfU8xhFD9NfdBy 9ZPLI+dN3HYYwUaYxzs4LlupS8sfOEIRgpOHsOcOyY+KiuWkV78z/9wBUdpKr5aAuOcE XcRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G8y3gKmw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a15si987744eda.222.2019.09.26.03.18.55; Thu, 26 Sep 2019 03:19:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G8y3gKmw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728929AbfIZEm6 (ORCPT + 99 others); Thu, 26 Sep 2019 00:42:58 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:42892 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725844AbfIZEm5 (ORCPT ); Thu, 26 Sep 2019 00:42:57 -0400 Received: by mail-io1-f68.google.com with SMTP id n197so2950059iod.9 for ; Wed, 25 Sep 2019 21:42:57 -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=OFA5Uz5BCNq/MfwnbLzI5wj5RSqOhUTcf5ZFKST8Ysc=; b=G8y3gKmwchxeBHsPxLv2M7F8LxqYDpNRcEbzbe7SRU/i9dDi/U+0VW6ODvf8b4f2yq JrShp8aBM55VlFtxiBc+tBHa+GLdnJwcrHMic49pdkJya0U3WKfDfHf/egSde+9D+U6P BMSzyayB+kChdm2pL4hf/yFw4Iq2f1BYRprUpdDltmcqfRMVCEIQ42dlfG2W9HTEUXDV oKtuuqC7WrKvU2XRxI+ThTahHE21Rb7TwsVCBRbae6pf3AwygmYUvo4Nsq/miX9Iaalc mSLtaSVp/4wRCCBrIESWH9aS5TaKHBiOvJJbGF7Wjzej59+TDFAbmsp/k30/RPc72XFb vGNg== 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=OFA5Uz5BCNq/MfwnbLzI5wj5RSqOhUTcf5ZFKST8Ysc=; b=TZb8m0kxf74a0UsR34LplIqWB51SzN2TMqlTM9WADF85mxJ6jgqIWOwcfWb0F+JTMe 79SEQ7MzeY9V0BD8dpmefrHmsGXaG5ZO0cjrPR2u9N3MKT7IdCM86dZEhTqHRdhPwaBH doL8e34QcmnuRolrPx9vPXHaiF00VTsBaKAtLF3XgWLqqvFp8I+2ctPfqUDs/kUYHq9R j7p5n11NKcRsm3EIcPgK+8DxGi6NGMmmbmYhSda53hWV4i3X5qdHhcL1S6+7L4eCSQ5x n5FEXxQ4nYUSAyAad5wZgAGU9dGO3AVRVZ/VdCM8qKcpG2gOA4wXfIl6eLzsZDwkR+TC oGzQ== X-Gm-Message-State: APjAAAU4rCB/ZeMRDgi/oL3666WxohoBO25dERcmgQhn1AqFuNzziAnT C51ncaO2tyyFZz3xCFE/gDr9BZ+lvEQsk3zDSB4= X-Received: by 2002:a02:7009:: with SMTP id f9mr1897459jac.81.1569472976794; Wed, 25 Sep 2019 21:42:56 -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> In-Reply-To: <456c8216-a9f4-6821-e688-744e93df826f@suse.de> From: Yafang Shao Date: Thu, 26 Sep 2019 12:42:20 +0800 Message-ID: Subject: Re: [PATCH 1/2] perf script python: integrate page reclaim analyze script To: Tony Jones , Mel Gorman 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 26, 2019 at 9:56 AM 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 sc= ript > > 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 got= what appears to be reasonable results and the output looks correct and use= ful. However I'm not a vm expert so I can't comment further. Hopefully so= meone on linux-mm can give more specific feedback. > + Mel Hi Mel, This is motivated by Documentation/trace/postprocess/trace-vmscan-postprocess.pl created by you. Could you pls. help take a look ? Thanks Yafang > There is one issue with Python3, see below. I didn't test with Python2. > > > > > + @classmethod > > + def shrink_inactive(cls, pid, scanned, reclaimed, flags): > > + event =3D cls.events.get(pid) > > + if event and event.tracing(): > > + # RECLAIM_WB_ANON 0x1 > > + # RECLAIM_WB_FILE 0x2 > > + _type =3D (flags & 0x2) >> 1 > > + event.process_lru(lru[_type], scanned, reclaimed) > > + > > + @classmethod > > + def writepage(cls, pid, flags): > > + event =3D cls.events.get(pid) > > + if event and event.tracing(): > > + # RECLAIM_WB_ANON 0x1 > > + # RECLAIM_WB_FILE 0x2 > > + # RECLAIM_WB_SYNC 0x4 > > + # RECLAIM_WB_ASYNC 0x8 > > + _type =3D (flags & 0x2) >> 1 > > + _io =3D (flags & 0x4) >> 2 > > + > > + event.process_writepage(lru[_type], sync_io[_io]) > > + > > + @classmethod > > Space indentation on line above. For python3 this results in: > > File "tools/perf/scripts/python/page-reclaim.py", line 217 > @classmethod > ^ > TabError: inconsistent use of tabs and spaces in indentation > > > + def iterate_proc(cls): > > + if show_opt !=3D Show.DEFAULT: > > + print("\nPer process latency (ms):") > > + print_proc_latency(latency_metric, 'pid', '[comm]= ') > > + > > + if show_opt =3D=3D Show.VERBOSE: > > + print("%20s %s" % ('timestamp','latency(= ns)')) > > > Thanks > > Tony >