Re: [QUESTION] Plain dereference and READ_ONCE() in fault handler

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

 



Oh I just looked at the arm64 definition and assumed ptep_get_lockless()
== READ_ONCE() :) Now this makes sense. So I am guessing that we can
still get away with a *vmf.pmd on 64-bit arches?

A separate question: When taking the create_huge_pmd() path with a read
fault and after taking the pmd lock, why shouldn't we check with
pmd_none(pmdp_get_lockless(vmf.pmd)) instead of plain *vmf.pmd...surely
now we must load the actual correct value from memory since we are
committing into mapping the huge zero folio?

So you mean we go via create_huge_pmd()->do_huge_pmd_anonymous_page(), to then end up in the path where we do the mm_get_huge_zero_folio().

If we hold the PMD lock, pmd_none() cannot change, so there is no need for the lockless variant?

So with the lock, you get the actual correct value that cannot change.

And after looking somewhat more, why even is a pmd_none(*pmd) there in
set_huge_zero_folio()...it should be the responsibility of the caller to
verify this? Any caller will just assume that it got the huge zero folio
mapped so this check should be redundant.

Yes, looks more like a VM_WARN_ON() scenario. So I agree that that one does not sound useful. (*maybe* the compiler is smart enough to optimize that check out)

--
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