On Fri, Aug 26, 2022 at 11:19:37AM -0700, Yang Shi wrote: > On Fri, Aug 26, 2022 at 10:53 AM Minchan Kim <minchan@xxxxxxxxxx> wrote: > > > > On Fri, Aug 26, 2022 at 11:27:53AM -0600, Yu Zhao wrote: > > > On Fri, Aug 26, 2022 at 11:15 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > > > > > > > On Fri, Aug 26, 2022 at 11:20:58AM +0800, Yin, Fengwei wrote: > > > > > On 8/26/2022 2:46 AM, Matthew Wilcox wrote: > > > > > > There's a number of ways of solving this. I'm interested in seeing > > > > > > which one Minchan thinks is best. > > > > > > > > > > My understanding is: > > > > > PageTransCompound() return false for compound page if THP is disabled > > > > > in kernel config. Replacing PageTransCompound() with PageCompound() > > > > > could work here. But for the long term, folio should be the answer. :). > > > > > > > > Yes, ultimately, isolate_lru_page() is going away as an interface > > > > and one will have to call folio_isolate_lru(). But should > > > > madvise_cold_or_pageout_pte_range() even be getting called for VMAs > > > > which are mmaps of af_packet? can_madv_lru_vma() rules out a number > > > > of different types of VMA; should it also be ruling out af_packet VMAs? > > > > > > Agreed. > > > > > > > If so, how? > > > > > > We should add a reliable helper to tell whether a file VMA is > > > reclaimable or not. I don't think we have one. Currently MGLRU checks > > > mapping->a_ops->read_folio for file VMAs to determine whether they are > > > reclaimable. > > > > > > > Long term, that's better idea(For stable backport, I'd like to go with > > simple PageLRU check). > > > > I wonder it's possible to mix LRU pages and non-struct pages together > > in a VMA. Otherwise, could we reuse(abuse) VM_MIXEDMAP? > > I don't think the mix is going to happen via regular mmap call. At a quick glance of vm_insert_page, it could change vm_flags into VM_MIXEDMAP dynamically. I am worry that a driver may call the vm_insert_page in the vma which already has LRU pages before so the VMA could have both LRU pages and non-LRU pages in the VMA. If it's doable, we may miss LRU pages if we filter VM_MIXEDMAP out in can_madv_lru_vma. Not sure it's common case. Otherwise, yeah, we may introduce a new vm_flag, something like, VM_NON_LRU. Just thought.