Thread (56 messages) 56 messages, 7 authors, 22d ago

Re: [PATCH 07/25] mm/fbatch: LRU_NEXT_ACTIVATE bit to optimize folio_activate()

From: Kiryl Shutsemau <kas@kernel.org>
Date: 2026-08-27 12:02:31
Also in: linux-fsdevel, linux-mm, lkml

On Mon, Aug 24, 2026 at 07:09:34AM -0700, Hugh Dickins wrote:
quoted hunk ↗ jump to hunk
@@ -355,6 +356,8 @@ bool lru_add_del_folio(struct folio *folio)
 	/* BUG_ON(folio_test_lru(folio)); */
 	if (!(folio->lru_next & BIT(LRU_NEXT_BATCHED)))
 		return false;
+	if (folio->lru_next & BIT(LRU_NEXT_ACTIVATE))
+		folio_set_active(folio);
 	folio->lru.next = LIST_POISON1;
 	/* BUG_ON(folio->lru_next & BIT(LRU_NEXT_BATCHED)); */
 	return true;
folio_activate()'s try_cmpxchg() can land in between two lru_next reads.
Logically, it is safe but I suspect KCSAN would not be happy about it.

Maybe READ_ONCE() here?

Other note, page_pool (pp_magic) seems to be using bit 2, but I don't
think there's a real conflict.

-- 
  Kiryl Shutsemau / Kirill A. Shutemov
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help