diff mbox series

[v9,4/4] uprobe: use FOLL_SPLIT_PMD instead of FOLL_SPLIT

Message ID 20190726054654.1623433-5-songliubraving@fb.com (mailing list archive)
State New, archived
Headers show
Series THP aware uprobe | expand

Commit Message

Song Liu July 26, 2019, 5:46 a.m. UTC
This patches uses newly added FOLL_SPLIT_PMD in uprobe. This enables easy
regroup of huge pmd after the uprobe is disabled (in next patch).

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
---
 kernel/events/uprobes.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Andrew Morton July 26, 2019, 11:02 p.m. UTC | #1
On Thu, 25 Jul 2019 22:46:54 -0700 Song Liu <songliubraving@fb.com> wrote:

> This patches uses newly added FOLL_SPLIT_PMD in uprobe. This enables easy
> regroup of huge pmd after the uprobe is disabled (in next patch).

Confused.  There is no "next patch".
Song Liu July 26, 2019, 11:44 p.m. UTC | #2
> On Jul 26, 2019, at 4:02 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> On Thu, 25 Jul 2019 22:46:54 -0700 Song Liu <songliubraving@fb.com> wrote:
> 
>> This patches uses newly added FOLL_SPLIT_PMD in uprobe. This enables easy
>> regroup of huge pmd after the uprobe is disabled (in next patch).
> 
> Confused.  There is no "next patch".

That was the patch 5, which was in earlier versions. I am working on 
addressing Kirill's feedback for it. 

Do I need to resubmit 4/4 with modified change log? 

Thanks,
Song
Andrew Morton July 26, 2019, 11:52 p.m. UTC | #3
On Fri, 26 Jul 2019 23:44:34 +0000 Song Liu <songliubraving@fb.com> wrote:

> 
> 
> > On Jul 26, 2019, at 4:02 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> > 
> > On Thu, 25 Jul 2019 22:46:54 -0700 Song Liu <songliubraving@fb.com> wrote:
> > 
> >> This patches uses newly added FOLL_SPLIT_PMD in uprobe. This enables easy
> >> regroup of huge pmd after the uprobe is disabled (in next patch).
> > 
> > Confused.  There is no "next patch".
> 
> That was the patch 5, which was in earlier versions. I am working on 
> addressing Kirill's feedback for it. 
> 
> Do I need to resubmit 4/4 with modified change log? 

Please just send new changelog text now.  I assume this [4/4] patch is
useful without patch #5, but a description of why it is useful is
appropriate.

I trust the fifth patch is to be sent soon?
Song Liu July 27, 2019, 12:16 a.m. UTC | #4
> On Jul 26, 2019, at 4:52 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> 
> On Fri, 26 Jul 2019 23:44:34 +0000 Song Liu <songliubraving@fb.com> wrote:
> 
>> 
>> 
>>> On Jul 26, 2019, at 4:02 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
>>> 
>>> On Thu, 25 Jul 2019 22:46:54 -0700 Song Liu <songliubraving@fb.com> wrote:
>>> 
>>>> This patches uses newly added FOLL_SPLIT_PMD in uprobe. This enables easy
>>>> regroup of huge pmd after the uprobe is disabled (in next patch).
>>> 
>>> Confused.  There is no "next patch".
>> 
>> That was the patch 5, which was in earlier versions. I am working on 
>> addressing Kirill's feedback for it. 
>> 
>> Do I need to resubmit 4/4 with modified change log? 
> 
> Please just send new changelog text now.  I assume this [4/4] patch is
> useful without patch #5, but a description of why it is useful is
> appropriate.

Yes, 4/4 is useful with #5. Please find the updated change log. 

============= 8< ====================

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>
Signed-off-by: Song Liu <songliubraving@fb.com>

============= 8< ====================

> 
> I trust the fifth patch is to be sent soon?

Yes, I am working on it. 

Thanks,
Song
diff mbox series

Patch

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index bd248af7310c..58ab7fc7272a 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);
@@ -479,7 +477,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;