From: Zhenhua Huang quic_zhenhuah@quicinc.com
mainline inclusion from mainline-v6.1-rc1 commit 0bba9af03d55d2cc1aa7616a8b9e522ceb49d180 category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9GSSR
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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
Link: https://lkml.kernel.org/r/1662704326-15899-1-git-send-email-quic_zhenhuah@qu... Link: https://lkml.kernel.org/r/1662633204-10044-1-git-send-email-quic_zhenhuah@qu... Link: https://lkml.kernel.org/r/1662537673-9392-1-git-send-email-quic_zhenhuah@qui... Signed-off-by: Zhenhua Huang quic_zhenhuah@quicinc.com Acked-by: Mel Gorman mgorman@techsingularity.net Signed-off-by: Andrew Morton akpm@linux-foundation.org Signed-off-by: Jinjiang Tu tujinjiang@huawei.com --- mm/page_owner.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/mm/page_owner.c b/mm/page_owner.c index 6aad07c996b3..ea1a1e4063b2 100644 --- a/mm/page_owner.c +++ b/mm/page_owner.c @@ -538,8 +538,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++) { /*