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: <4388c2c5-7346-447a-b76a-de97a1fe1ad2@redhat.com>
Date: Fri, 15 Mar 2024 12:13:14 +0100
From: David Hildenbrand <david@...hat.com>
To: Ryan Roberts <ryan.roberts@....com>,
 Andrew Morton <akpm@...ux-foundation.org>,
 Matthew Wilcox <willy@...radead.org>, Huang Ying <ying.huang@...el.com>,
 Gao Xiang <xiang@...nel.org>, Yu Zhao <yuzhao@...gle.com>,
 Yang Shi <shy828301@...il.com>, Michal Hocko <mhocko@...e.com>,
 Kefeng Wang <wangkefeng.wang@...wei.com>, Barry Song <21cnbao@...il.com>,
 Chris Li <chrisl@...nel.org>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 6/6] mm: madvise: Avoid split during MADV_PAGEOUT and
 MADV_COLD

On 15.03.24 11:55, Ryan Roberts wrote:
> On 15/03/2024 10:35, David Hildenbrand wrote:
>>> -        if (!pageout && pte_young(ptent)) {
>>> -            ptent = ptep_get_and_clear_full(mm, addr, pte,
>>> -                            tlb->fullmm);
>>> -            ptent = pte_mkold(ptent);
>>> -            set_pte_at(mm, addr, pte, ptent);
>>> -            tlb_remove_tlb_entry(tlb, pte, addr);
>>> +        if (!pageout) {
>>> +            for (; nr != 0; nr--, pte++, addr += PAGE_SIZE) {
>>> +                if (ptep_test_and_clear_young(vma, addr, pte))
>>> +                    tlb_remove_tlb_entry(tlb, pte, addr);
>>> +            }
>>>            }
>>
>>
>> The following might turn out a bit nicer: Make folio_pte_batch() collect
>> "any_young", then doing something like we do with "any_writable" in the fork()
>> case:
>>
>> ...
>>      nr = folio_pte_batch(folio, addr, pte, ptent, max_nr,
>>                   fpb_flags, NULL, any_young);
>>      if (any_young)
>>          pte_mkyoung(ptent)
>> ...
>>
>> if (!pageout && pte_young(ptent)) {
>>      mkold_full_ptes(mm, addr, pte, nr, tlb->fullmm);
>>      tlb_remove_tlb_entries(tlb, pte, nr, addr);
>> }
>>
> 
> I thought about that but decided that it would be better to only TLBI the actual
> entries that were young. Although looking at tlb_remove_tlb_entry() I see that
> it just maintains a range between the lowest and highest address, so this won't
> actually make any difference.

Yes, tlb_remove_tlb_entries() looks scarier than it actually is :)

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ