On 2024/3/27 23:58, Matthew Wilcox wrote:
On Wed, Mar 27, 2024 at 11:10:48AM -0400, Zi Yan wrote:
On 27 Mar 2024, at 10:54, Matthew Wilcox wrote:
How much of this is safe without a refcount on the folio?
folio_to_pfn() should be fine, isolate_hugetlb() checks the folio
under hugetlb_lock, but folio_nr_pages() might return a bogus number
that makes pfn go beyond end_pfn and ends for loop early. The code
below increases the refcount, so it might be better to move this
part of the code after refcount is increased.
I really want to instill a little bit of fear in Kefeng.
This is all really subtle code because it's running without a refcount.
I've mostly stayed away from it because I know that I don't know what
I'm doing. Kefeng has no idea that he doesn't know what he's doing.
And so we get these patches, and they're sometimes subtly wrong, and it
takes a lot of arguing and revision and thinking and Kefeng is doing
very little of the thinking part!
Kefeng, please stick to working on code that you understand. Or take
the time to learn code you don't understand before sending patches to
it. This kind of Leeroy Jenkins approach to development is not good.
Oh, I remember your reminder and be in awe of changes and try to think
more about changes, for this one, I only convert page to folio after
refcount increased with get_page_unless_zero(), and as replied to Zi,
PageHWPoison part need more consideration and this one only aims to
remove isolate_lru/movable_page, so don't touch the page before
get_page_unless_zero().
Thanks for your review and help all the time.