Re: [PATCH v2] mm: hold PTL from the first PTE while reclaiming a large folio

From: Matthew Wilcox
Date: Tue Mar 26 2024 - 12:25:22 EST


On Wed, Mar 06, 2024 at 10:52:19PM +1300, Barry Song wrote:
> if (folio_test_pmd_mappable(folio))
> flags |= TTU_SPLIT_HUGE_PMD;
> + /*
> + * Without TTU_SYNC, try_to_unmap will only begin to hold PTL
> + * from the first present PTE within a large folio. Some initial
> + * PTEs might be skipped due to races with parallel PTE writes
> + * in which PTEs can be cleared temporarily before being written
> + * new present values. This will lead to a large folio is still
> + * mapped while some subpages have been partially unmapped after
> + * try_to_unmap; TTU_SYNC helps try_to_unmap acquire PTL from the
> + * first PTE, eliminating the influence of temporary PTE values.
> + */

Please wrap comments at <80 columns. The easiest way to do this is just
to pipe the block of text through "fmt -p \*" (need to quote the * to
prevent it from being a glob/regex)