lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DB6689FE-8528-4883-8CD9-CFE5F3BEC321@fb.com>
Date:   Fri, 21 Jun 2019 18:04:14 +0000
From:   Song Liu <songliubraving@...com>
To:     "Kirill A. Shutemov" <kirill@...temov.name>
CC:     LKML <linux-kernel@...r.kernel.org>, Linux-MM <linux-mm@...ck.org>,
        "oleg@...hat.com" <oleg@...hat.com>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        "mhiramat@...nel.org" <mhiramat@...nel.org>,
        "matthew.wilcox@...cle.com" <matthew.wilcox@...cle.com>,
        "kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
        "Kernel Team" <Kernel-team@...com>
Subject: Re: [PATCH v4 5/5] uprobe: collapse THP pmd after removing all
 uprobes



> On Jun 21, 2019, at 9:30 AM, Song Liu <songliubraving@...com> wrote:
> 
> 
> 
>> On Jun 21, 2019, at 6:45 AM, Song Liu <songliubraving@...com> wrote:
>> 
>> 
>> 
>>> On Jun 21, 2019, at 6:36 AM, Kirill A. Shutemov <kirill@...temov.name> wrote:
>>> 
>>> On Fri, Jun 21, 2019 at 01:17:05PM +0000, Song Liu wrote:
>>>> 
>>>> 
>>>>> On Jun 21, 2019, at 5:48 AM, Kirill A. Shutemov <kirill@...temov.name> wrote:
>>>>> 
>>>>> On Thu, Jun 13, 2019 at 10:57:47AM -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.
>>>>>> 
>>>>>> An issue on earlier version was discovered by kbuild test robot.
>>>>>> 
>>>>>> Reported-by: kbuild test robot <lkp@...el.com>
>>>>>> Signed-off-by: Song Liu <songliubraving@...com>
>>>>>> ---
>>>>>> include/linux/huge_mm.h |  7 +++++
>>>>>> kernel/events/uprobes.c |  5 ++-
>>>>>> mm/huge_memory.c        | 69 +++++++++++++++++++++++++++++++++++++++++
>>>>> 
>>>>> I still sync it's duplication of khugepaged functinallity. We need to fix
>>>>> khugepaged to handle SCAN_PAGE_COMPOUND and probably refactor the code to
>>>>> be able to call for collapse of particular range if we have all locks
>>>>> taken (as we do in uprobe case).
>>>>> 
>>>> 
>>>> I see the point now. I misunderstood it for a while. 
>>>> 
>>>> If we add this to khugepaged, it will have some conflicts with my other 
>>>> patchset. How about we move the functionality to khugepaged after these
>>>> two sets get in? 
>>> 
>>> Is the last patch of the patchset essential? I think this part can be done
>>> a bit later in a proper way, no?
>> 
>> Technically, we need this patch to regroup pmd mapped page, and thus get 
>> the performance benefit after the uprobe is detached. 
>> 
>> On the other hand, if we get the first 4 patches of the this set and the 
>> other set in soonish. I will work on improving this patch right after that..
> 
> Actually, it might be pretty easy. We can just call try_collapse_huge_pmd() 
> in khugepaged.c (in khugepaged_scan_shmem() or khugepaged_scan_file() after 
> my other set). 
> 
> Let me fold that in and send v5. 

On a second thought, if we would have khugepaged to do collapse, we need a
dedicated bit to tell khugepaged which pmd to collapse. Otherwise, it may 
accidentally collapse pmd that are split by other split_huge_pmd. 

I could not think of a good solution here. In this case, we really need a
flag for this specific pmd. Flags for the compound_page or for the vma 
would not work, as those could be shared by multiple pmds. 

If the analysis above is correct, we probably need uprobe to specifically
call try_collapse_huge_pmd() for now.

Please share your suggestions. 

Thanks!
Song







Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ