On 22/03/2023 08:19, Yin Fengwei wrote: > On 3/17/23 18:58, Ryan Roberts wrote: >> Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx> >> --- >> mm/madvise.c | 8 ++++++++ >> 1 file changed, 8 insertions(+) >> >> diff --git a/mm/madvise.c b/mm/madvise.c >> index 340125d08c03..8fb84da744e1 100644 >> --- a/mm/madvise.c >> +++ b/mm/madvise.c >> @@ -447,6 +447,7 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, >> * are sure it's worth. Split it if we are only owner. >> */ >> if (folio_test_large(folio)) { >> +#if 0 >> if (folio_mapcount(folio) != 1) >> break; >> if (pageout_anon_only_filter && !folio_test_anon(folio)) >> @@ -469,6 +470,9 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd, >> pte--; >> addr -= PAGE_SIZE; >> continue; >> +#else >> + break; >> +#endif >> } >> >> /* >> @@ -664,6 +668,7 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned >> long addr, >> * deactivate all pages. >> */ >> if (folio_test_large(folio)) { >> +#if 0 >> if (folio_mapcount(folio) != 1) >> goto out; >> folio_get(folio); >> @@ -684,6 +689,9 @@ static int madvise_free_pte_range(pmd_t *pmd, unsigned >> long addr, >> pte--; >> addr -= PAGE_SIZE; >> continue; >> +#else >> + goto out; >> +#endif >> } > From this workaround change, you hit an case that large folio has > 1 as folio_mapcount()? Can you share the kernel crash log to me? Thanks. Yes I do. I'm not sure why the mapcount is decreasing. I thought perhaps it could be due to CoW or explicit munmap, or something like that. I've been trying to find the reason that the mapcount is being reduced by using the page_ref tracepoints, but its proving difficult. The crash logs are somewhat random. But I'll send some to you separately. Thanks for taking a look! > > > Regards > Yin, Fengwei > >> >> if (folio_test_swapcache(folio) || folio_test_dirty(folio)) { >> -- >> 2.25.1 >> >