BACKPORT: mm/vmscan: drop checking if _deferred_list is empty before using TTU_SYNC

The optimization of list_empty(&folio->_deferred_list) aimed to prevent
increasing the PTL duration when a large folio is partially unmapped, for
example, from subpage 0 to subpage (nr - 2).

But Ryan's commit 5ed890ce51 ("mm: vmscan: avoid split during
shrink_folio_list()") actually splits this kind of large folios.  This
makes the "optimization" useless.

Additionally, the list_empty() technically required a data_race()
annotation.

Link: https://lkml.kernel.org/r/20240629234155.53524-1-21cnbao@gmail.com
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Reviewed-by: Ryan Roberts <ryan.roberts@arm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit e5a119c4a6)
[ Fix trivial conflict in mm/vmscan.c - Kalesh Singh ]
Bug: 313807618
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Change-Id: I23d6be0c8a5001818ed5d5e4de39bd1c474047da
This commit is contained in:
Barry Song 2024-06-30 11:41:55 +12:00 committed by Kalesh Singh
parent 66f7137c92
commit 6bdb6c7cb1

View File

@ -2011,7 +2011,7 @@ retry:
* try_to_unmap acquire PTL from the first PTE,
* eliminating the influence of temporary PTE values.
*/
if (folio_test_large(folio) && list_empty(&folio->_deferred_list))
if (folio_test_large(folio))
flags |= TTU_SYNC;
if (!ignore_references)