Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S968149AbdD0Qts (ORCPT ); Thu, 27 Apr 2017 12:49:48 -0400 Received: from mail.kernel.org ([198.145.29.136]:33306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967296AbdD0Qtp (ORCPT ); Thu, 27 Apr 2017 12:49:45 -0400 Date: Thu, 27 Apr 2017 12:49:40 -0400 From: Steven Rostedt To: Pratyush Anand Cc: linux-kernel@vger.kernel.org, dyoung@redhat.com, xlpang@redhat.com Subject: Re: [trace-cmd Patch RFC] trace-cmd: top: A new interface to detect peak memory Message-ID: <20170427124940.62ca6a06@gandalf.local.home> In-Reply-To: <727920fa-219c-6d8d-3ba6-2f0553b2cbdc@redhat.com> References: <2e2d52edc0488adfefa6d19e27b8b9beae95a7b6.1488380367.git.panand@redhat.com> <20170426100135.758cb098@gandalf.local.home> <727920fa-219c-6d8d-3ba6-2f0553b2cbdc@redhat.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1732 Lines: 46 On Thu, 27 Apr 2017 19:32:43 +0530 Pratyush Anand wrote: > I will implement your review comments and will send next revision. > However, I had couple of observation which I was unable to justify: > > # ./trace-cmd top -s /tmp/test > # ./trace-cmd top -p /tmp/test | grep trace-cmd > 15292 trace-cmd 22144 15808 What does it give for your /tmp/test ? Note, tracing doesn't start till after trace-cmd is loaded. Everything before is not going to be seen. > Here,15292 is the pid of trace-cmd task > 22144 KB is the peak memory usage > 15808 KB is the current memory usage > > Now check rss component from statm > # cat /proc/15292/statm > 50 35 23 7 0 12 0 36 > > This is a result on ARM64/64KB page size. Therefore, as per statm rss is 35 > pages = 35*64 = 2240KB > I patched my kernel [2] for test purpose, so that statm reports peak memory as > well. Here, the last extra entry in statm output is peak memory and it is 36 > pages = 2304KB. > So, this is a huge difference between what has been reported by statm and what > we get from trace-cmd. > I understand that `trace-cmd top` output would only be approximate, because > many of the memory could be allocated by task and freed in interrupt context. > So, many a time it can differ. But, is such a huge difference justified? If > yes, can we count on the output of this utility to find early boot time oom > issues? Doesn't it only just trace the memory usage of when the tracing starts? -- Steve > > > [1] > https://github.com/pratyushanand/trace-cmd/commit/602c2cd96aa613633ad20c6d382e41f7db37a2a4 > [2] > https://github.com/pratyushanand/linux/commit/197e2045361b6b70085c46c78ea6607d8afce517