From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <kirill.shutemov@linux.intel.com>
Cc: <riel@redhat.com>, <ebru.akagunduz@gmail.com>,
<dan.carpenter@oracle.com>, <linux-kernel@vger.kernel.org>,
<linux-mm@kvack.org>, <linmiaohe@huawei.com>
Subject: [PATCH v2 4/4] khugepaged: fix wrong result value for trace_mm_collapse_huge_page_isolate()
Date: Fri, 5 Mar 2021 22:29:47 -0500 [thread overview]
Message-ID: <20210306032947.35921-5-linmiaohe@huawei.com> (raw)
In-Reply-To: <20210306032947.35921-1-linmiaohe@huawei.com>
In writable and !referenced case, the result value should be
SCAN_LACK_REFERENCED_PAGE for trace_mm_collapse_huge_page_isolate()
instead of default 0 (SCAN_FAIL) here.
Fixes: 7d2eba0557c1 ("mm: add tracepoint for scanning pages")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
mm/khugepaged.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/mm/khugepaged.c b/mm/khugepaged.c
index e886a8618c33..adf677246d86 100644
--- a/mm/khugepaged.c
+++ b/mm/khugepaged.c
@@ -716,17 +716,17 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
if (pte_write(pteval))
writable = true;
}
- if (likely(writable)) {
- if (likely(referenced)) {
- result = SCAN_SUCCEED;
- trace_mm_collapse_huge_page_isolate(page, none_or_zero,
- referenced, writable, result);
- return 1;
- }
- } else {
+
+ if (unlikely(!writable)) {
result = SCAN_PAGE_RO;
+ } else if (unlikely(!referenced)) {
+ result = SCAN_LACK_REFERENCED_PAGE;
+ } else {
+ result = SCAN_SUCCEED;
+ trace_mm_collapse_huge_page_isolate(page, none_or_zero,
+ referenced, writable, result);
+ return 1;
}
-
out:
release_pte_pages(pte, _pte, compound_pagelist);
trace_mm_collapse_huge_page_isolate(page, none_or_zero,
--
2.19.1
prev parent reply other threads:[~2021-03-06 3:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-06 3:29 [PATCH v2 0/4] Cleanup and fixup for khugepaged Miaohe Lin
2021-03-06 3:29 ` [PATCH v2 1/4] khugepaged: remove unneeded return value of khugepaged_collapse_pte_mapped_thps() Miaohe Lin
2021-03-06 3:29 ` [PATCH v2 2/4] khugepaged: reuse the smp_wmb() inside __SetPageUptodate() Miaohe Lin
2021-03-06 3:29 ` [PATCH v2 3/4] khugepaged: use helper khugepaged_test_exit() in __khugepaged_enter() Miaohe Lin
2021-03-06 3:29 ` Miaohe Lin [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210306032947.35921-5-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=dan.carpenter@oracle.com \
--cc=ebru.akagunduz@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox