linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages
@ 2022-09-08 10:33 Zhenhua Huang
  2022-09-08 14:55 ` Mel Gorman
  0 siblings, 1 reply; 3+ messages in thread
From: Zhenhua Huang @ 2022-09-08 10:33 UTC (permalink / raw)
  To: akpm, mgorman; +Cc: Zhenhua Huang, linux-mm, quic_tingweiz

Remove an expensive and unnecessary operation as PCP pages are safely
skipped when reading page owner. PCP pages can be skipped because
PAGE_EXT_OWNER_ALLOCATED is cleared.

With draining PCP pages, these pages are moved to buddy list so they
can be identified as buddy pages and skipped quickly. Although it improved
efficiency of PFN walker, the drain is guaranteed expensive that is
unlikely to be offset by a slight increase in efficiency when skipping
free pages.

PAGE_EXT_OWNER_ALLOCATED is cleared in the page owner reset path below:
	free_unref_page
		-> free_unref_page_prepare
			-> free_pcp_prepare
				-> free_pages_prepare which do page owner
				reset
		-> free_unref_page_commit which add pages into pcp list

Acked-by: Mel Gorman <mgorman@techsingularity.net>
Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
---
 mm/page_owner.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/mm/page_owner.c b/mm/page_owner.c
index 90023f9..54f3e03 100644
--- a/mm/page_owner.c
+++ b/mm/page_owner.c
@@ -524,8 +524,6 @@ read_page_owner(struct file *file, char __user *buf, size_t count, loff_t *ppos)
 	while (!pfn_valid(pfn) && (pfn & (MAX_ORDER_NR_PAGES - 1)) != 0)
 		pfn++;
 
-	drain_all_pages(NULL);
-
 	/* Find an allocated page */
 	for (; pfn < max_pfn; pfn++) {
 		/*
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages
  2022-09-08 10:33 [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages Zhenhua Huang
@ 2022-09-08 14:55 ` Mel Gorman
  2022-09-09  6:18   ` Zhenhua Huang
  0 siblings, 1 reply; 3+ messages in thread
From: Mel Gorman @ 2022-09-08 14:55 UTC (permalink / raw)
  To: Zhenhua Huang; +Cc: akpm, linux-mm, quic_tingweiz

On Thu, Sep 08, 2022 at 06:33:24PM +0800, Zhenhua Huang wrote:
> Remove an expensive and unnecessary operation as PCP pages are safely
> skipped when reading page owner. PCP pages can be skipped because
> PAGE_EXT_OWNER_ALLOCATED is cleared.
> 
> With draining PCP pages, these pages are moved to buddy list so they
> can be identified as buddy pages and skipped quickly. Although it improved
> efficiency of PFN walker, the drain is guaranteed expensive that is
> unlikely to be offset by a slight increase in efficiency when skipping
> free pages.
> 
> PAGE_EXT_OWNER_ALLOCATED is cleared in the page owner reset path below:
> 	free_unref_page
> 		-> free_unref_page_prepare
> 			-> free_pcp_prepare
> 				-> free_pages_prepare which do page owner
> 				reset
> 		-> free_unref_page_commit which add pages into pcp list
> 
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>

Should be;

Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>

Otherwise looks good!

-- 
Mel Gorman
SUSE Labs


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages
  2022-09-08 14:55 ` Mel Gorman
@ 2022-09-09  6:18   ` Zhenhua Huang
  0 siblings, 0 replies; 3+ messages in thread
From: Zhenhua Huang @ 2022-09-09  6:18 UTC (permalink / raw)
  To: Mel Gorman; +Cc: akpm, linux-mm, quic_tingweiz



On 2022/9/8 22:55, Mel Gorman wrote:
> On Thu, Sep 08, 2022 at 06:33:24PM +0800, Zhenhua Huang wrote:
>> Remove an expensive and unnecessary operation as PCP pages are safely
>> skipped when reading page owner. PCP pages can be skipped because
>> PAGE_EXT_OWNER_ALLOCATED is cleared.
>>
>> With draining PCP pages, these pages are moved to buddy list so they
>> can be identified as buddy pages and skipped quickly. Although it improved
>> efficiency of PFN walker, the drain is guaranteed expensive that is
>> unlikely to be offset by a slight increase in efficiency when skipping
>> free pages.
>>
>> PAGE_EXT_OWNER_ALLOCATED is cleared in the page owner reset path below:
>> 	free_unref_page
>> 		-> free_unref_page_prepare
>> 			-> free_pcp_prepare
>> 				-> free_pages_prepare which do page owner
>> 				reset
>> 		-> free_unref_page_commit which add pages into pcp list
>>
>> Acked-by: Mel Gorman <mgorman@techsingularity.net>
>> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
> 
> Should be;
> 
> Signed-off-by: Zhenhua Huang <quic_zhenhuah@quicinc.com>
> Acked-by: Mel Gorman <mgorman@techsingularity.net>
> 
> Otherwise looks good!

Thanks Mel for your guide.
Will update.

> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-09  6:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08 10:33 [PATCH v2] mm/page_owner.c: remove redudant drain_all_pages Zhenhua Huang
2022-09-08 14:55 ` Mel Gorman
2022-09-09  6:18   ` Zhenhua Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).