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]
Date:   Thu, 20 Jan 2022 16:51:47 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     "zhangliang (AG)" <zhangliang5@...wei.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        wangzhigang17@...wei.com,
        Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] mm: reuse the unshared swapcache page in do_wp_page


>> Yes, we are talking past each other and no, I am talking about fully
>> mapped THP, just mapped via PTEs.
>>
>> Please refer to our THP COW logic: do_huge_pmd_wp_page()
> 
> You're going to have to be a bit more explicit.  That's clearly handling
> the case where there's a PMD mapping.  If there is _also_ a PTE mapping,
> then obviously the page is mapped more than once and can't be reused!
> 
>>>
>>>>> Anon THP is always going to start out aligned (and can be moved by
>>>>> mremap()).  Arguably it should be broken up if it's moved so it can be
>>>>> reformed into aligned THPs by khugepaged.
>>>>
>>>> Can you elaborate, I'm missing the point where something gets moved. I
>>>> don't care about mremap() at all here.
>>>>
>>>>
>>>> 1. You have a read-only, PTE mapped THP
>>>> 2. Write fault on the THP
>>>> 3. We PTE-map the THP because we run into a false positive in our COW
>>>>    logic to handle COW on PTE
>>>> 4. Write fault on the PTE
>>>> 5. We always have to COW each and every sub-page and can never reuse,
>>>>    because page_count() > 1
>>>>
>>>> That's essentially what reuse_swap_page() tried to handle before.
>>>> Eventually optimizing for this is certainly the next step, but I'd like
>>>> to document which effect the removal of reuse_swap_page() will have to THP.
>>>
>>> I'm talking about step 0.  How do we get a read-only, PTE-mapped THP?
>>> Through mremap() or perhaps through an mprotect()/mmap()/munmap() that
>>> failed to split the THP.
>>
>> do_huge_pmd_wp_page()
> 
> I feel you could be a little more verbose about what you think is
> going on here.  Are you talking about the fallback: path where we
> call __split_huge_pmd()?

Sorry, I was less verbose because I was just sending out the
patch+description to Linus' reply and was assuming you're going to read
it anyways ;)

Yes, I'm speaking about exactly that fallback path.

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ