lkml.org 
[lkml]   [2024]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH v4 6/6] mm: madvise: Avoid split during MADV_PAGEOUT and MADV_COLD
    From
    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);

    I don't think tlb->fullmm makes sense here because we are not clearing the pte,
    so there is no chance of optimization? So planning to call this mkold_ptes() and
    remove that param. Have I missed something?

    >     tlb_remove_tlb_entries(tlb, pte, nr, addr);
    > }
    >


    \
     
     \ /
      Last update: 2024-05-27 15:56    [W:9.735 / U:0.272 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site