Re: [PATCH 1/2] perf script python: integrate page reclaim analyze script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 9/18/19 7:38 AM, Yafang Shao wrote:
> A new perf script page-reclaim is introduced in this patch. 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


I tested it with global-dhp__pagereclaim-performance from mmtests and got what appears to be reasonable results and the output looks correct and useful.  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 Python2.

>
> +	@classmethod
> +	def shrink_inactive(cls, pid, scanned, reclaimed, flags):
> +		event = cls.events.get(pid)
> +		if event and event.tracing():
> +			# RECLAIM_WB_ANON 0x1
> +			# RECLAIM_WB_FILE 0x2
> +			_type = (flags & 0x2) >> 1
> +			event.process_lru(lru[_type], scanned, reclaimed)
> +
> +	@classmethod
> +	def writepage(cls, pid, flags):
> +		event = 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 = (flags & 0x2) >> 1
> +			_io = (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 != Show.DEFAULT:
> +			print("\nPer process latency (ms):")
> +			print_proc_latency(latency_metric, 'pid', '[comm]')
> +
> +			if show_opt == Show.VERBOSE:
> +				print("%20s  %s" % ('timestamp','latency(ns)'))


Thanks

Tony






[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux