On Tue, Mar 14, 2023 at 10:16:09AM +0100, David Hildenbrand wrote: > On 14.03.23 04:09, Yin Fengwei wrote: > > For long term with wider adoption of large folio in kernel (like large > > folio for anonymous page), MADV_PAGEOUT needs be updated to handle > > large folio as whole to avoid splitting it always. > > Just curious what the last sentence implies. Large folios are supposed to be > a transparent optimization. So why should we pageout all surrounding > subpages simply because a single subpage was requested to be paged out? That > might harm performance of some workloads ... more than the actual split. > > So it's not immediately obvious to me why "avoid splitting" is the correct > answer to the problem at hand. Even if your madvise() call says to pageout all pages covered by a folio, the current code will split it. That's what needs to be fixed. At least for anonymous pages, using large folios is an attempt to treat all pages in a particular range the same way. If the user says to only page out some of them, that's a big clue that these pages are different from the other pages, and so we should split a folio where the madvise call does not cover every page in the folio. I'm less convinced that argument holds for page cache pages.