[PATCH 03/25] mm/fbatch: temporarily disable lazyfree and mlock+munlock batching
Hugh Dickins <[email protected]>
| Newsgroups | org.kvack.linux-mm,org.kernel.vger.linux-block,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
It will not matter if we occasionally get activation or deactivation wrong; but a mistaken lazyfree (MADV_FREE) would likely cause dataloss. So disable its batching while reworking the per-cpu fbatch handling, then re-enable it with more thought afterwards. Similarly disable mlock+munlock batching temporarily: they will need some redesign before re-enabling. Just insert one disabling line for now, leaving the rest of the code as it was, for consideration later. Signed-off-by: Hugh Dickins <[email protected]> --- mm/folio.c | 2 ++ mm/mlock.c | 3 +++ 2 files changed, 5 insertions(+) diff --git a/mm/folio.c b/mm/folio.c index b2bce6b77498..a7010ae3edff 100644 --- a/mm/folio.c +++ b/mm/folio.c @@ -218,6 +218,8 @@ static void __folio_batch_add_and_move(struct folio_batch __percpu *fbatch, local_lock(&cpu_fbatches.lock); if (!folio_batch_add(this_cpu_ptr(fbatch), folio) || + /* XXX Temporarily disable lazyfree batching */ + fbatch == &cpu_fbatches.lru_lazyfree || !folio_may_be_lru_cached(folio) || lru_cache_disabled()) folio_batch_move_lru(this_cpu_ptr(fbatch), move_fn); diff --git a/mm/mlock.c b/mm/mlock.c index efa6716e4dfb..14c02e155d68 100644 --- a/mm/mlock.c +++ b/mm/mlock.c @@ -255,6 +255,7 @@ void mlock_folio(struct folio *folio) folio_get(folio); if (!folio_batch_add(fbatch, mlock_lru(folio)) || + true || /* XXX Temporarily disable mlock batching */ !folio_may_be_lru_cached(folio) || lru_cache_disabled()) mlock_folio_batch(fbatch); local_unlock(&mlock_fbatch.lock); @@ -278,6 +279,7 @@ void mlock_new_folio(struct folio *folio) folio_get(folio); if (!folio_batch_add(fbatch, mlock_new(folio)) || + true || /* XXX Temporarily disable mlock_new batching */ !folio_may_be_lru_cached(folio) || lru_cache_disabled()) mlock_folio_batch(fbatch); local_unlock(&mlock_fbatch.lock); @@ -299,6 +301,7 @@ void munlock_folio(struct folio *folio) */ folio_get(folio); if (!folio_batch_add(fbatch, folio) || + true || /* XXX Temporarily disable munlock batching */ !folio_may_be_lru_cached(folio) || lru_cache_disabled()) mlock_folio_batch(fbatch); local_unlock(&mlock_fbatch.lock); -- 2.51.0