From: Song Liu <songliubraving@fb.com>
To: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
<akpm@linux-foundation.org>
Cc: <hannes@cmpxchg.org>, <matthew.wilcox@oracle.com>,
<kirill.shutemov@linux.intel.com>, <oleg@redhat.com>,
<kernel-team@fb.com>, <william.kucharski@oracle.com>,
<srikar@linux.vnet.ibm.com>, Song Liu <songliubraving@fb.com>
Subject: [PATCH v13 4/6] uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT
Date: Thu, 15 Aug 2019 09:45:23 -0700 [thread overview]
Message-ID: <20190815164525.1848545-5-songliubraving@fb.com> (raw)
In-Reply-To: <20190815164525.1848545-1-songliubraving@fb.com>
This patch uses newly added FOLL_SPLIT_PMD in uprobe. This preserves the
huge page when the uprobe is enabled. When the uprobe is disabled, newer
instances of the same application could still benefit from huge page.
For the next step, we will enable khugepaged to regroup the pmd, so that
existing instances of the application could also benefit from huge page
after the uprobe is disabled.
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Reviewed-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
kernel/events/uprobes.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 648f47553bff..27b596f14463 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -155,7 +155,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
{
struct mm_struct *mm = vma->vm_mm;
struct page_vma_mapped_walk pvmw = {
- .page = old_page,
+ .page = compound_head(old_page),
.vma = vma,
.address = addr,
};
@@ -166,8 +166,6 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, addr,
addr + PAGE_SIZE);
- VM_BUG_ON_PAGE(PageTransHuge(old_page), old_page);
-
if (new_page) {
err = mem_cgroup_try_charge(new_page, vma->vm_mm, GFP_KERNEL,
&memcg, false);
@@ -481,7 +479,7 @@ int uprobe_write_opcode(struct arch_uprobe *auprobe, struct mm_struct *mm,
retry:
/* Read the page with vaddr into memory */
ret = get_user_pages_remote(NULL, mm, vaddr, 1,
- FOLL_FORCE | FOLL_SPLIT, &old_page, &vma, NULL);
+ FOLL_FORCE | FOLL_SPLIT_PMD, &old_page, &vma, NULL);
if (ret <= 0)
return ret;
--
2.17.1
next prev parent reply other threads:[~2019-08-15 16:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-15 16:45 [PATCH v13 0/6] THP aware uprobe Song Liu
2019-08-15 16:45 ` [PATCH v13 1/6] mm: move memcmp_pages() and pages_identical() Song Liu
2019-08-15 16:45 ` [PATCH v13 2/6] uprobe: use original page when all uprobes are removed Song Liu
2019-08-15 16:45 ` [PATCH v13 3/6] mm, thp: introduce FOLL_SPLIT_PMD Song Liu
2019-08-15 16:45 ` Song Liu [this message]
2019-08-15 16:45 ` [PATCH v13 5/6] khugepaged: enable collapse pmd for pte-mapped THP Song Liu
2019-08-15 16:45 ` [PATCH v13 6/6] uprobe: collapse THP pmd after removing all uprobes Song Liu
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=20190815164525.1848545-5-songliubraving@fb.com \
--to=songliubraving@fb.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=kernel-team@fb.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.wilcox@oracle.com \
--cc=oleg@redhat.com \
--cc=srikar@linux.vnet.ibm.com \
--cc=william.kucharski@oracle.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