<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-stable.git/tools/vm/page_owner_sort.c, branch master</title>
<subtitle>Linux kernel stable tree</subtitle>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/'/>
<entry>
<title>tools/vm: rename tools/vm to tools/mm</title>
<updated>2023-01-19T01:12:55+00:00</updated>
<author>
<name>SeongJae Park</name>
<email>sj@kernel.org</email>
</author>
<published>2023-01-03T18:07:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=799fb82aa132fa3a3886b7872997a5a84e820062'/>
<id>799fb82aa132fa3a3886b7872997a5a84e820062</id>
<content type='text'>
Rename tools/vm to tools/mm for being more consistent with the code and
documentation directories, and won't be confused with virtual machines.

Link: https://lkml.kernel.org/r/20230103180754.129637-4-sj@kernel.org
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Rename tools/vm to tools/mm for being more consistent with the code and
documentation directories, and won't be confused with virtual machines.

Link: https://lkml.kernel.org/r/20230103180754.129637-4-sj@kernel.org
Signed-off-by: SeongJae Park &lt;sj@kernel.org&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Shuah Khan &lt;shuah@kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort: free memory before exit</title>
<updated>2023-01-19T01:12:45+00:00</updated>
<author>
<name>Jianlin Lv</name>
<email>iecedge@gmail.com</email>
</author>
<published>2022-12-19T16:49:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ef1faf0e370a8e33fe625088ddc5fde02cf8c4c4'/>
<id>ef1faf0e370a8e33fe625088ddc5fde02cf8c4c4</id>
<content type='text'>
Although when a process terminates, the kernel will removes memory
associated with that process, It's neither good style nor proper design to
leave it to kernel.  This patch free allocated memory before process exit.

Link: https://lkml.kernel.org/r/20221219164917.14132-1-iecedge@gmail.com
Signed-off-by: Jianlin Lv &lt;iecedge@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Although when a process terminates, the kernel will removes memory
associated with that process, It's neither good style nor proper design to
leave it to kernel.  This patch free allocated memory before process exit.

Link: https://lkml.kernel.org/r/20221219164917.14132-1-iecedge@gmail.com
Signed-off-by: Jianlin Lv &lt;iecedge@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort: fix -f option</title>
<updated>2022-09-12T03:25:51+00:00</updated>
<author>
<name>Yixuan Cao</name>
<email>caoyixuan2019@email.szu.edu.cn</email>
</author>
<published>2022-08-12T15:55:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=57eb60c04d2c7b0de91eac2bc5d0331f8fe72fd7'/>
<id>57eb60c04d2c7b0de91eac2bc5d0331f8fe72fd7</id>
<content type='text'>
The -f option is to filter out the information of blocks whose memory has
not been released, I noticed some blocks should not be filtered out.

Commit 9cc7e96aa846 ("mm/page_owner: record timestamp and pid") records
the allocation timestamp (ts_nsec) of all pages.

Commit 866b48526217 ("mm/page_owner: record the timestamp of all pages
during free") records the free timestamp (free_ts_nsec) of all pages. 
When the page is allocated for the first time, the initial value of
free_ts_nsec is 0, and the corresponding time will be obtained when the
page is released.  But during reallocation the free_ts_nsec will not reset
to 0 again.  In particular, when page migration occurs, these two
timestamps will be the same.

Now page_owner_sort removes all text blocks whose free_ts_nsec is not 0
when using -f option.  However, this way can only select pages allocated
for the first time.  If a freed page is reallocated, free_ts_nsec will be
less than ts_nsec; if page migration occurs, the two timestamps will be
equal.  These cases should be considered as pages are not released.

So I fix the function is_need() to keep text blocks that meet the above
two conditions when using -f option.

Link: https://lkml.kernel.org/r/20220812155515.30846-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Georgi Djakov &lt;georgi.djakov@linaro.org&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Cc: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The -f option is to filter out the information of blocks whose memory has
not been released, I noticed some blocks should not be filtered out.

Commit 9cc7e96aa846 ("mm/page_owner: record timestamp and pid") records
the allocation timestamp (ts_nsec) of all pages.

Commit 866b48526217 ("mm/page_owner: record the timestamp of all pages
during free") records the free timestamp (free_ts_nsec) of all pages. 
When the page is allocated for the first time, the initial value of
free_ts_nsec is 0, and the corresponding time will be obtained when the
page is released.  But during reallocation the free_ts_nsec will not reset
to 0 again.  In particular, when page migration occurs, these two
timestamps will be the same.

Now page_owner_sort removes all text blocks whose free_ts_nsec is not 0
when using -f option.  However, this way can only select pages allocated
for the first time.  If a freed page is reallocated, free_ts_nsec will be
less than ts_nsec; if page migration occurs, the two timestamps will be
equal.  These cases should be considered as pages are not released.

So I fix the function is_need() to keep text blocks that meet the above
two conditions when using -f option.

Link: https://lkml.kernel.org/r/20220812155515.30846-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Liam Mark &lt;lmark@codeaurora.org&gt;
Cc: Georgi Djakov &lt;georgi.djakov@linaro.org&gt;
Cc: Vlastimil Babka &lt;vbabka@suse.cz&gt;
Cc: Joonsoo Kim &lt;iamjoonsoo.kim@lge.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort.c: adjust the indent in is_need()</title>
<updated>2022-07-30T01:07:16+00:00</updated>
<author>
<name>Yixuan Cao</name>
<email>caoyixuan2019@email.szu.edu.cn</email>
</author>
<published>2022-07-17T19:55:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=9b7a4039d6856f66521486da68c76838929039eb'/>
<id>9b7a4039d6856f66521486da68c76838929039eb</id>
<content type='text'>
I noticed one more indentation than necessary in is_need().

Link: https://lkml.kernel.org/r/20220717195506.7602-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed one more indentation than necessary in is_need().

Link: https://lkml.kernel.org/r/20220717195506.7602-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>docs: rename Documentation/vm to Documentation/mm</title>
<updated>2022-06-27T19:52:53+00:00</updated>
<author>
<name>Mike Rapoport</name>
<email>rppt@linux.ibm.com</email>
</author>
<published>2022-06-27T06:00:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ee65728e103bb7dd99d8604bf6c7aa89c7d7e446'/>
<id>ee65728e103bb7dd99d8604bf6c7aa89c7d7e446</id>
<content type='text'>
so it will be consistent with code mm directory and with
Documentation/admin-guide/mm and won't be confused with virtual machines.

Signed-off-by: Mike Rapoport &lt;rppt@linux.ibm.com&gt;
Suggested-by: Matthew Wilcox &lt;willy@infradead.org&gt;
Tested-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Acked-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Acked-by: Wu XiangCheng &lt;bobwxc@email.cn&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
so it will be consistent with code mm directory and with
Documentation/admin-guide/mm and won't be confused with virtual machines.

Signed-off-by: Mike Rapoport &lt;rppt@linux.ibm.com&gt;
Suggested-by: Matthew Wilcox &lt;willy@infradead.org&gt;
Tested-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Acked-by: Jonathan Corbet &lt;corbet@lwn.net&gt;
Acked-by: Wu XiangCheng &lt;bobwxc@email.cn&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort.c: avoid repeated judgments</title>
<updated>2022-04-29T06:15:57+00:00</updated>
<author>
<name>Yixuan Cao</name>
<email>caoyixuan2019@email.szu.edu.cn</email>
</author>
<published>2022-04-29T06:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=c7c4ab859642830a14c45785ca7866659b65fc44'/>
<id>c7c4ab859642830a14c45785ca7866659b65fc44</id>
<content type='text'>
I noticed a detail that needs to be adjusted.  When judging whether a page
is allocated by vmalloc, the value of the variable "tmp" was repeatedly
judged, so the code was adjusted.

This work is coauthored by Yinan Zhang, Jiajian Ye, Shenghong Han, Chongxi
Zhao, Yuhong Feng and Yongqiang Liu.

Link: https://lkml.kernel.org/r/20220414042744.13896-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I noticed a detail that needs to be adjusted.  When judging whether a page
is allocated by vmalloc, the value of the variable "tmp" was repeatedly
judged, so the code was adjusted.

This work is coauthored by Yinan Zhang, Jiajian Ye, Shenghong Han, Chongxi
Zhao, Yuhong Feng and Yongqiang Liu.

Link: https://lkml.kernel.org/r/20220414042744.13896-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort.c: provide allocator labelling and update --cull and --sort options</title>
<updated>2022-04-29T06:15:57+00:00</updated>
<author>
<name>Yixuan Cao</name>
<email>caoyixuan2019@email.szu.edu.cn</email>
</author>
<published>2022-04-29T06:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=f09654bb88127473b4baf3bc0b68d4d4695aca7b'/>
<id>f09654bb88127473b4baf3bc0b68d4d4695aca7b</id>
<content type='text'>
An application is suspected of having memory leak when its memory
consumption is high and keeps increasing.  There are several commonly used
memory allocators: slab, cma, vmalloc, etc.  The memory leak
identification can be sped up if the page information allocated by an
allocator can be analyzed separately.

This patch provides supports for memory allocator labelling for slab,
vmalloc, and cma.  The pages allocated by slab and cma can be confirmed
from the "PFN" line according to the kernel codes, and the label of the
vmalloc allocator can be obtained by analyzing the stack trace.  Thanks
for Vlastimil Babka's constructive suggestions.

Based on Yinan Zhang's study, the call chain of vmalloc() is vmalloc() -&gt;
...  -&gt; __vmalloc_node_range() -&gt; __vmalloc_area_node(). 
__vmalloc_area_node() requests memory through the interface of buddy
allocation system.  In the current version, __vmalloc_area_node() uses
four interfaces: alloc_pages_bulk_array_mempolicy(),
alloc_pages_bulk_array_node(), alloc_pages() and alloc_pages_node().  By
disassembling the code, we find that __vmalloc_area_node() is expanded in
__vmalloc_node_range().  So __vmalloc_area_node is not in the stack trace.

On the test machine, the stack trace of pages allocated by vmalloc has the
following four forms:

__alloc_pages_bulk+0x230/0x6a0
__vmalloc_node_range+0x19c/0x598

alloc_pages_bulk_array_mempolicy+0xbc/0x278
__vmalloc_node_range+0x1e8/0x598

__alloc_pages+0x160/0x2b0
__vmalloc_node_range+0x234/0x598

alloc_pages+0xac/0x150
__vmalloc_node_range+0x44c/0x598

Therefore, in two consecutive lines of stacktrace, if the first line
contains the word "alloc_pages" and the second line contains the word
"__vmalloc_node_range", it can be determined that the page is allocated by
vmalloc.  And the function offset and size are not the same on different
machines, so there is no need to match them.

At the same time, this patch updates the --cull and --sort options to
support allocator-based merge statistics and sorting.  The added functions
are fully compatible with the original work.  When using, you can use
"allocator", or abbreviated as "ator".  Relevant updates have also been
made in the documentation(Documentation/vm/page_owner.rst).

Example:
./page_owner_sort &lt;input&gt; &lt;output&gt; --cull=st,pid,name,allocator
./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=ator,pid,name

This work is coauthored by Jiajian Ye, Yinan Zhang, Shenghong Han,
Chongxi Zhao, Yuhong Feng and Yongqiang Liu.

Link: https://lkml.kernel.org/r/20220410132932.9402-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
An application is suspected of having memory leak when its memory
consumption is high and keeps increasing.  There are several commonly used
memory allocators: slab, cma, vmalloc, etc.  The memory leak
identification can be sped up if the page information allocated by an
allocator can be analyzed separately.

This patch provides supports for memory allocator labelling for slab,
vmalloc, and cma.  The pages allocated by slab and cma can be confirmed
from the "PFN" line according to the kernel codes, and the label of the
vmalloc allocator can be obtained by analyzing the stack trace.  Thanks
for Vlastimil Babka's constructive suggestions.

Based on Yinan Zhang's study, the call chain of vmalloc() is vmalloc() -&gt;
...  -&gt; __vmalloc_node_range() -&gt; __vmalloc_area_node(). 
__vmalloc_area_node() requests memory through the interface of buddy
allocation system.  In the current version, __vmalloc_area_node() uses
four interfaces: alloc_pages_bulk_array_mempolicy(),
alloc_pages_bulk_array_node(), alloc_pages() and alloc_pages_node().  By
disassembling the code, we find that __vmalloc_area_node() is expanded in
__vmalloc_node_range().  So __vmalloc_area_node is not in the stack trace.

On the test machine, the stack trace of pages allocated by vmalloc has the
following four forms:

__alloc_pages_bulk+0x230/0x6a0
__vmalloc_node_range+0x19c/0x598

alloc_pages_bulk_array_mempolicy+0xbc/0x278
__vmalloc_node_range+0x1e8/0x598

__alloc_pages+0x160/0x2b0
__vmalloc_node_range+0x234/0x598

alloc_pages+0xac/0x150
__vmalloc_node_range+0x44c/0x598

Therefore, in two consecutive lines of stacktrace, if the first line
contains the word "alloc_pages" and the second line contains the word
"__vmalloc_node_range", it can be determined that the page is allocated by
vmalloc.  And the function offset and size are not the same on different
machines, so there is no need to match them.

At the same time, this patch updates the --cull and --sort options to
support allocator-based merge statistics and sorting.  The added functions
are fully compatible with the original work.  When using, you can use
"allocator", or abbreviated as "ator".  Relevant updates have also been
made in the documentation(Documentation/vm/page_owner.rst).

Example:
./page_owner_sort &lt;input&gt; &lt;output&gt; --cull=st,pid,name,allocator
./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=ator,pid,name

This work is coauthored by Jiajian Ye, Yinan Zhang, Shenghong Han,
Chongxi Zhao, Yuhong Feng and Yongqiang Liu.

Link: https://lkml.kernel.org/r/20220410132932.9402-1-caoyixuan2019@email.szu.edu.cn
Signed-off-by: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner: support debug log to avoid huge log print</title>
<updated>2022-04-29T06:15:57+00:00</updated>
<author>
<name>Haowen Bai</name>
<email>baihaowen@meizu.com</email>
</author>
<published>2022-04-29T06:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=a72469aa593881c2a5ad3a38cfb3e7871c50f169'/>
<id>a72469aa593881c2a5ad3a38cfb3e7871c50f169</id>
<content type='text'>
As normal usage, tool will print huge parser log and spend a lot of time
printing, so it would be preferable add "-d" debug control to avoid this
problem.

Link: https://lkml.kernel.org/r/1649672446-5685-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As normal usage, tool will print huge parser log and spend a lot of time
printing, so it would be preferable add "-d" debug control to avoid this
problem.

Link: https://lkml.kernel.org/r/1649672446-5685-1-git-send-email-baihaowen@meizu.com
Signed-off-by: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort.c: support sorting blocks by multiple keys</title>
<updated>2022-04-29T06:15:57+00:00</updated>
<author>
<name>Jiajian Ye</name>
<email>yejiajian2018@email.szu.edu.cn</email>
</author>
<published>2022-04-29T06:15:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=ebbeae36387ccf1326c896167872c3acf6c3c956'/>
<id>ebbeae36387ccf1326c896167872c3acf6c3c956</id>
<content type='text'>
When viewing page owner information, we may want to sort blocks of
information by multiple keys, since one single key does not uniquely
identify a block. Therefore, following adjustments are made:

1. Add a new --sort option to support sorting blocks of information by
multiple keys.

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=&lt;order&gt;
	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort &lt;order&gt;

&lt;order&gt; is a single argument in the form of a comma-separated list,
which offers a way to specify sorting order.

Sorting syntax is [+|-]key[,[+|-]key[,...]]. The ascending or descending
order can be specified by adding the + (ascending, default) or - (descend
-ing) prefix to the key:

	./page_owner_sort &lt;input&gt; &lt;output&gt; [option] --sort -key1,+key2,key3...

For example, to sort the blocks first by task command name in lexicographic
order and then by pid in ascending numerical order, use the following:

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=name,+pid

To sort the blocks first by pid in ascending order and then by timestamp
of the page when it is allocated in descending order, use the following:

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=pid,-alloc_ts

2. Add explanations of a newly added --sort option in the function usage()
and the document(Documentation/vm/page_owner.rst).

This work is coauthored by
	Yixuan Cao
	Shenghong Han
	Yinan Zhang
	Chongxi Zhao
	Yuhong Feng
	Yongqiang Liu

Link: https://lkml.kernel.org/r/20220401024856.767-3-yejiajian2018@email.szu.edu.cn
Signed-off-by: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When viewing page owner information, we may want to sort blocks of
information by multiple keys, since one single key does not uniquely
identify a block. Therefore, following adjustments are made:

1. Add a new --sort option to support sorting blocks of information by
multiple keys.

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=&lt;order&gt;
	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort &lt;order&gt;

&lt;order&gt; is a single argument in the form of a comma-separated list,
which offers a way to specify sorting order.

Sorting syntax is [+|-]key[,[+|-]key[,...]]. The ascending or descending
order can be specified by adding the + (ascending, default) or - (descend
-ing) prefix to the key:

	./page_owner_sort &lt;input&gt; &lt;output&gt; [option] --sort -key1,+key2,key3...

For example, to sort the blocks first by task command name in lexicographic
order and then by pid in ascending numerical order, use the following:

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=name,+pid

To sort the blocks first by pid in ascending order and then by timestamp
of the page when it is allocated in descending order, use the following:

	./page_owner_sort &lt;input&gt; &lt;output&gt; --sort=pid,-alloc_ts

2. Add explanations of a newly added --sort option in the function usage()
and the document(Documentation/vm/page_owner.rst).

This work is coauthored by
	Yixuan Cao
	Shenghong Han
	Yinan Zhang
	Chongxi Zhao
	Yuhong Feng
	Yongqiang Liu

Link: https://lkml.kernel.org/r/20220401024856.767-3-yejiajian2018@email.szu.edu.cn
Signed-off-by: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>tools/vm/page_owner_sort.c: support for multi-value selection in single argument</title>
<updated>2022-04-29T06:15:56+00:00</updated>
<author>
<name>Jiajian Ye</name>
<email>yejiajian2018@email.szu.edu.cn</email>
</author>
<published>2022-04-29T06:15:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.tavy.me/linux-stable.git/commit/?id=75382a2dca0e9e9e57e88b479cf537549461a934'/>
<id>75382a2dca0e9e9e57e88b479cf537549461a934</id>
<content type='text'>
When viewing page owner information, we may want to select blocks whose
PID/TGID/TASK_COMM_NAME appears in a user-specified list for data analysis
and aggregation.  But currently page_owner_sort only supports selecting
blocks associated with only one specified PID/TGID/TASK_COMM_NAME.

Therefore, following adjustments are made to fix the problem:

1. Enhance selecting function to support the selection of multiple
   PIDs/TGIDs/TASK_COMM_NAMEs.

The enhanced usages are as follows:

--pid &lt;pidlist&gt;         Select by pid. This selects the blocks whose PID
                        numbers appear in &lt;pidlist&gt;.
--tgid &lt;tgidlist&gt;       Select by tgid. This selects the blocks whose
                        TGID numbers appear in &lt;tgidlist&gt;.
--name &lt;cmdlist&gt;        Select by task command name. This selects the
                        blocks whose task command name appear in &lt;cmdlist&gt;.

Where &lt;pidlist&gt;, &lt;tgidlist&gt;, &lt;cmdlist&gt; are single arguments in the form of
a comma-separated list,which offers a way to specify individual selecting
rules.

For example, if you want to select blocks whose tgids are 1, 2 or 3, you
have to use 4 commands as follows:

        ./page_owner_sort &lt;input&gt; &lt;output1&gt; --tgid=1
        ./page_owner_sort &lt;input&gt; &lt;output2&gt; --tgid=2
        ./page_owner_sort &lt;input&gt; &lt;output3&gt; --tgid=3
        cat &lt;output1&gt; &lt;output2&gt; &lt;output3&gt; &gt; &lt;output&gt;

With this patch, you can use only 1 command to obtain the same result as
above:

        ./page_owner_sort &lt;input&gt; &lt;output1&gt; --tgid=1,2,3

2. Update explanations of --pid, --tgid and --name in the function
   usage() and the document(Documents/vm/page_owner.rst).

This work is coauthored by
        Yixuan Cao
        Shenghong Han
        Yinan Zhang
        Chongxi Zhao
        Yuhong Feng
        Yongqiang Liu

Link: https://lkml.kernel.org/r/20220401024856.767-2-yejiajian2018@email.szu.edu.cn
Signed-off-by: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When viewing page owner information, we may want to select blocks whose
PID/TGID/TASK_COMM_NAME appears in a user-specified list for data analysis
and aggregation.  But currently page_owner_sort only supports selecting
blocks associated with only one specified PID/TGID/TASK_COMM_NAME.

Therefore, following adjustments are made to fix the problem:

1. Enhance selecting function to support the selection of multiple
   PIDs/TGIDs/TASK_COMM_NAMEs.

The enhanced usages are as follows:

--pid &lt;pidlist&gt;         Select by pid. This selects the blocks whose PID
                        numbers appear in &lt;pidlist&gt;.
--tgid &lt;tgidlist&gt;       Select by tgid. This selects the blocks whose
                        TGID numbers appear in &lt;tgidlist&gt;.
--name &lt;cmdlist&gt;        Select by task command name. This selects the
                        blocks whose task command name appear in &lt;cmdlist&gt;.

Where &lt;pidlist&gt;, &lt;tgidlist&gt;, &lt;cmdlist&gt; are single arguments in the form of
a comma-separated list,which offers a way to specify individual selecting
rules.

For example, if you want to select blocks whose tgids are 1, 2 or 3, you
have to use 4 commands as follows:

        ./page_owner_sort &lt;input&gt; &lt;output1&gt; --tgid=1
        ./page_owner_sort &lt;input&gt; &lt;output2&gt; --tgid=2
        ./page_owner_sort &lt;input&gt; &lt;output3&gt; --tgid=3
        cat &lt;output1&gt; &lt;output2&gt; &lt;output3&gt; &gt; &lt;output&gt;

With this patch, you can use only 1 command to obtain the same result as
above:

        ./page_owner_sort &lt;input&gt; &lt;output1&gt; --tgid=1,2,3

2. Update explanations of --pid, --tgid and --name in the function
   usage() and the document(Documents/vm/page_owner.rst).

This work is coauthored by
        Yixuan Cao
        Shenghong Han
        Yinan Zhang
        Chongxi Zhao
        Yuhong Feng
        Yongqiang Liu

Link: https://lkml.kernel.org/r/20220401024856.767-2-yejiajian2018@email.szu.edu.cn
Signed-off-by: Jiajian Ye &lt;yejiajian2018@email.szu.edu.cn&gt;
Cc: Chongxi Zhao &lt;zhaochongxi2019@email.szu.edu.cn&gt;
Cc: Shenghong Han &lt;hanshenghong2019@email.szu.edu.cn&gt;
Cc: Yinan Zhang &lt;zhangyinan2019@email.szu.edu.cn&gt;
Cc: Yixuan Cao &lt;caoyixuan2019@email.szu.edu.cn&gt;
Cc: Yongqiang Liu &lt;liuyongqiang13@huawei.com&gt;
Cc: Yuhong Feng &lt;yuhongf@szu.edu.cn&gt;
Cc: Haowen Bai &lt;baihaowen@meizu.com&gt;
Cc: Sean Anderson &lt;seanga2@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
