Re: [PATCH V2] mm/gup: Clear the LRU flag of a page before adding to LRU batch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looking at this in more detail, I wonder if we can turn that to

if (!folio_test_clear_lru(folio))
      return;
folio_get(folio);

In all cases? The caller must hold a reference, so this should be fine.

Seems the caller madvise_free_pte_range(...), calling
folio_mark_lazyfree(...), doesn't hold a reference on folio.

If that would be the case and the folio could get freed concurrently, 
the folio_get(folio) would be completely broken.
In madvise_free_pte_range() we hold the PTL, so the folio cannot get 
freed concurrently.
folio_get() is only allowed when we are sure the folio cannot get freed 
concurrently, because we know there is a reference that cannot go away.

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux