Re: [PATCH uprobe, thp 4/4] uprobe: collapse THP pmd after removing all uprobes

From: Kirill A. Shutemov
Date: Fri May 31 2019 - 03:03:47 EST


On Thu, May 30, 2019 at 05:26:38PM +0000, Song Liu wrote:
>
>
> > On May 30, 2019, at 5:20 AM, Kirill A. Shutemov <kirill@xxxxxxxxxxxxx> wrote:
> >
> > On Wed, May 29, 2019 at 02:20:49PM -0700, Song Liu wrote:
> >> After all uprobes are removed from the huge page (with PTE pgtable), it
> >> is possible to collapse the pmd and benefit from THP again. This patch
> >> does the collapse.
> >
> > I don't think it's right way to go. We should deferred it to khugepaged.
> > We need to teach khugepaged to deal with PTE-mapped compound page.
> > And uprobe should only kick khugepaged for a VMA. Maybe synchronously.
> >
>
> I guess that would be the same logic, but run in khugepaged? It doesn't
> have to be done synchronously.

My idea was that since we have all required locking in place we can call
into khugepaged code that does the collapse, without waithing for it to
get to the VMA.

--
Kirill A. Shutemov