Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6699347ybe; Wed, 18 Sep 2019 07:41:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyX5qdX7OOxUHA23BZZiBm5H+RF9Pq5aq2FFbpuKnGQuMzWofN+sx8AyyY1hww/vxx0D8wv X-Received: by 2002:a17:906:ecea:: with SMTP id qt10mr10038045ejb.23.1568817681872; Wed, 18 Sep 2019 07:41:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568817681; cv=none; d=google.com; s=arc-20160816; b=vF/iT9ejLSu5bI4z6wdngCg47Zgexjc9UvoDmCHmgy6EfqzCNtYbavJu0dv9VwM5/v 7m5EhQV6BWPqVKSzz3Xhx9Btq8wEfwb8RwexgIFzNYCl7nZXghS+CZolt2lTEeljHrS1 LiJ1jEmk7lVyWpCIInxhEVBrE8T0cESkJjf+TVC99ujvm6C93vn9XDUCQnsk28uf6Hc0 +WYPVHOt8KMK51VoZFVFkyJwS15aCxRNYtAVKXlilAseejNui01Wop9P5NhGmJm4twAr qB30S/E2iliYMJ4hzDk6AgXTE3HZhTb0r8zer2PaONamRP3sFA3TgrhP9WQ+D6CGai/P MvXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=9JcxK53FZm41dsdkmHTZFxMR9/ow92BRA5QtCOLMTqI=; b=Wl3i+Yhv+nPcA01909cyzyaBHuQvRWFSXJJpijde2IRsA5oZo/kFQhXP/MCWth5yYs 3pqw8dvR6qtv/Zkzwyg0o5b7IzBs26bfUHMVxGbwTGQE40ZzBI9zp+P+jKAawhWiw6DE 3Gan+88GgHhflTvqLhjCnA3pi6g3+a9IDKzXpZ20Uvqj9IeHR1iIC1XS6V51FZD6w2Hv WDsm+OOnxANRShvn22kyh06gn+agNOuEr7tqhV9lclb0mgh0S3hV9t9lpZjSMMVUcHHB fjqLD8RBB9zz5MAIgnZ6FadsLQocEs2MpOfOaJmLzKRsnK+QCcoIgzN7oaHtz+njuKtZ MR9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="JvA/At6K"; 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 j6si2874324ejm.157.2019.09.18.07.40.57; Wed, 18 Sep 2019 07:41:21 -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="JvA/At6K"; 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 S1731139AbfIROjD (ORCPT + 99 others); Wed, 18 Sep 2019 10:39:03 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:40321 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725902AbfIROjD (ORCPT ); Wed, 18 Sep 2019 10:39:03 -0400 Received: by mail-pf1-f196.google.com with SMTP id x127so88788pfb.7 for ; Wed, 18 Sep 2019 07:39:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9JcxK53FZm41dsdkmHTZFxMR9/ow92BRA5QtCOLMTqI=; b=JvA/At6KxqCIT2TkoRxJhIZ86JYauc/e8toiz53hGvSovTZjhRC211Umhm+C25x+S1 SU6xXohKCmUHeyjMSJFUG3GPgiOd/PSVFybFzW0MeCCVWTOa8Y5RrpNI+l9ibK0m5Aen 2HWyL1+h505SyniP6JFrNFbLH90S3lhMAWp2cqFexLRzvF9HRElf6Z0S2cATFjFKCnqk MvWCwPwH7I1u2fRJ8C/CV6YPcd9b1HX1MDYpC8vxS2el13F5bidZbmmj/NrlCjXKndLJ UXNam3idKXVS5RX0Turo8c257XITRSjPirXsIjOwx24VUvnBwqGNgpesHBcGRBasDBm7 rQhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9JcxK53FZm41dsdkmHTZFxMR9/ow92BRA5QtCOLMTqI=; b=lWMluEHkQPzkcP3N5C7eKy0/xr/mldExMu+zlSWBQxcafw9Ha8oDXL+DW5bhn+B+fP awZ9vgb5fa1FN/GoyG1zrPwRnQn8i3z0I8sOXIn3J3E5FHiFMsFvP+8StWK6SjFM1hc6 md7bSBj0C940IKRtqYPOXQp7AJupAzMPTY8cLTzeBc+p3oK+tkKiv+uHKup9hV0y6Mq0 qdrdwuIKHL9BlblQ+hCDuHG3U9LzmKesEJZKLsPE6a/+Gwg+anbgWcA+xNyVBXwV7vK2 cyj+CMxWL+RfKXuaN8NL56NC6TODErsKGDBzgMe6YBF4qKW0RP9fGxliUYx1DEYpDSbA C9lA== X-Gm-Message-State: APjAAAXhPkAS5ekl8hkkNqEHLy9UDRkThs1I/h80tUSGQ5421X3J/j/f YfAEGuId7VXUx+bNcMqxr4o= X-Received: by 2002:a62:1cf:: with SMTP id 198mr4689068pfb.31.1568817542266; Wed, 18 Sep 2019 07:39:02 -0700 (PDT) Received: from dev.localdomain ([203.100.54.194]) by smtp.gmail.com with ESMTPSA id l11sm5272197pgq.58.2019.09.18.07.38.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Sep 2019 07:39:01 -0700 (PDT) From: Yafang Shao To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, jolsa@redhat.com, namhyung@kernel.org, akpm@linux-foundation.org Cc: tonyj@suse.com, florian.schmidt@nutanix.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yafang Shao Subject: [PATCH 0/2] introduce new perf-script page-reclaim Date: Wed, 18 Sep 2019 10:38:40 -0400 Message-Id: <1568817522-8754-1-git-send-email-laoar.shao@gmail.com> X-Mailer: git-send-email 1.8.3.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A new perf script page-reclaim is introduced in this patchset. This new script 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 # Report per process latency details. At what time and how long it # stalls at each time. $ perf script report page-reclaim -- -v An example of the script's report, $ perf script report page-reclaim Direct reclaims: 4924 Direct latency (ms) total max avg min 177823.211 6378.977 36.114 0.051 Direct file reclaimed 22920 Direct file scanned 28306 Direct file sync write I/O 0 Direct file async write I/O 0 Direct anon reclaimed 212567 Direct anon scanned 1446854 Direct anon sync write I/O 0 Direct anon async write I/O 278325 Direct order 0 1 3 4870 23 31 Wake kswapd requests 716 Wake order 0 1 715 1 Kswapd reclaims: 9 Kswapd latency (ms) total max avg min 86353.046 42128.816 9594.783 120.736 Kswapd file reclaimed 366461 Kswapd file scanned 369554 Kswapd file sync write I/O 0 Kswapd file async write I/O 0 Kswapd anon reclaimed 362594 Kswapd anon scanned 693938 Kswapd anon sync write I/O 0 Kswapd anon async write I/O 330663 Kswapd order 0 1 3 3 1 5 Kswapd re-wakes 705 Per process latency (ms): pid[comm] total max avg min timestamp latency(ns) 1[systemd] 276.764 248.933 21.29 0.293 3406860552338: 16819800 3406877381650: 5532855 3407458799399: 929517 3407459796042: 916682 3407460763220: 418989 3407461250236: 332355 3407461637534: 401731 3407462092234: 449219 3407462605855: 292857 3407462952343: 372700 3407463364947: 414880 3407463829547: 949162 3407464813883: 248933444 163[kswapd0] 86353.046 42128.816 9594.783 120.736 3357637025977: 1026962745 3358915619888: 41268642175 3400239664127: 42128816204 3443784780373: 679641989 3444847948969: 120735792 3445001978784: 342713657 3445835850664: 316851589 3446865035476: 247457873 3449355401352: 221223878 ... This script must be in sync with bellow vmscan tracepoints, mm_vmscan_direct_reclaim_begin mm_vmscan_direct_reclaim_end mm_vmscan_kswapd_wake mm_vmscan_kswapd_sleep mm_vmscan_wakeup_kswapd mm_vmscan_lru_shrink_inactive mm_vmscan_writepage Currently there's no easy way to make perf scripts in sync with tracepoints. One possible way is to run perf's tests regularly, another way is once we changes the definitions of tracepoints we must keep in mind that the perf scripts which are using these tracepoints must be changed as well. So I add some comment for the new introduced page-reclaim script as a reminder. Yafang Shao (2): perf script python: integrate page reclaim analyze script tracing, vmscan: add comments for perf script page-reclaim include/trace/events/vmscan.h | 15 +- tools/perf/scripts/python/bin/page-reclaim-record | 2 + tools/perf/scripts/python/bin/page-reclaim-report | 4 + tools/perf/scripts/python/page-reclaim.py | 378 ++++++++++++++++++++++ 4 files changed, 398 insertions(+), 1 deletion(-) create mode 100644 tools/perf/scripts/python/bin/page-reclaim-record create mode 100644 tools/perf/scripts/python/bin/page-reclaim-report create mode 100644 tools/perf/scripts/python/page-reclaim.py -- 1.8.3.1