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] [day] [month] [year] [list]
Message-ID: <02228f42-438b-7840-5653-f076fc190f14@linux.alibaba.com>
Date:   Tue, 24 Jul 2018 10:56:31 -0700
From:   Yang Shi <yang.shi@...ux.alibaba.com>
To:     Laurent Dufour <ldufour@...ux.vnet.ibm.com>, mhocko@...nel.org,
        willy@...radead.org, kirill@...temov.name,
        akpm@...ux-foundation.org
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC v5 PATCH 2/2] mm: mmap: zap pages with read mmap_sem in
 munmap


>>>> +static int vm_munmap_zap_rlock(unsigned long start, size_t len)
>>>> +{
>>>> +    int ret;
>>>> +    struct mm_struct *mm = current->mm;
>>>> +    LIST_HEAD(uf);
>>>> +
>>>> +    ret = do_munmap_zap_rlock(mm, start, len, &uf);
>>>> +    userfaultfd_unmap_complete(mm, &uf);
>>>> +    return ret;
>>>> +}
>>>> +
>>>>    int vm_munmap(unsigned long start, size_t len)
>>>>    {
>>>>        int ret;
>>> A stupid question, since the overhead of vm_munmap_zap_rlock() compared to
>>> vm_munmap() is not significant, why not putting that in vm_munmap() instead of
>>> introducing a new vm_munmap_zap_rlock() ?
>> Since vm_munmap() is called in other paths too, i.e. drm driver, kvm, etc. I'm
>> not quite sure if those paths are safe enough to this optimization. And, it
>> looks they are not the main sources of the latency, so here I introduced
>> vm_munmap_zap_rlock() for munmap() only.
> For my information, what could be unsafe for these paths ?

I'm just not sure if they are safe enough nor not, because I'm not 
knowledgeable enough to kvm and drm drivers. They might be safe, but I 
don't know how to prove that.

So, since they might be not the main sources of latency (I haven't seen 
any hung report due to them), so it sounds safe to not touch them for now.

>
>> If someone reports or we see they are the sources of latency too, and the
>> optimization is proved safe to them, we can definitely extend this to all
>> vm_munmap() calls
>>
>> Thanks,
>> Yang
>>
>>>> @@ -2855,10 +2939,9 @@ int vm_munmap(unsigned long start, size_t len)
>>>>    SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
>>>>    {
>>>>        profile_munmap(addr);
>>>> -    return vm_munmap(addr, len);
>>>> +    return vm_munmap_zap_rlock(addr, len);
>>>>    }
>>>>
>>>> -
>>>>    /*
>>>>     * Emulation of deprecated remap_file_pages() syscall.
>>>>     */
>>>> @@ -3146,7 +3229,7 @@ void exit_mmap(struct mm_struct *mm)
>>>>        tlb_gather_mmu(&tlb, mm, 0, -1);
>>>>        /* update_hiwater_rss(mm) here? but nobody should be looking */
>>>>        /* Use -1 here to ensure all VMAs in the mm are unmapped */
>>>> -    unmap_vmas(&tlb, vma, 0, -1);
>>>> +    unmap_vmas(&tlb, vma, 0, -1, false);
>>>>        free_pgtables(&tlb, vma, FIRST_USER_ADDRESS, USER_PGTABLES_CEILING);
>>>>        tlb_finish_mmu(&tlb, 0, -1);
>>>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ