Will Deacon
2020-Apr-20 21:03 UTC
[Nouveau] [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote:> pmd_present() is expected to test positive after pmdp_mknotpresent() as the > PMD entry still points to a valid huge page in memory. pmdp_mknotpresent() > implies that given PMD entry is just invalidated from MMU perspective while > still holding on to pmd_page() referred valid huge page thus also clearing > pmd_present() test. This creates the following situation which is counter > intuitive. > > [pmd_present(pmd_mknotpresent(pmd)) = true] > > This renames pmd_mknotpresent() as pmd_mknotvalid() reflecting the helper's > functionality more accurately while changing the above mentioned situation > as follows. This does not create any functional change. > > [pmd_present(pmd_mknotvalid(pmd)) = true] > > This is not applicable for platforms that define own pmdp_invalidate() via > __HAVE_ARCH_PMDP_INVALIDATE. Suggestion for renaming came during a previous > discussion here.Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is a one-trick pony for pmdp_invalidate()? Will
Anshuman Khandual
2020-Apr-20 23:27 UTC
[Nouveau] [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
On 04/21/2020 02:33 AM, Will Deacon wrote:> On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote: >> pmd_present() is expected to test positive after pmdp_mknotpresent() as the >> PMD entry still points to a valid huge page in memory. pmdp_mknotpresent() >> implies that given PMD entry is just invalidated from MMU perspective while >> still holding on to pmd_page() referred valid huge page thus also clearing >> pmd_present() test. This creates the following situation which is counter >> intuitive. >> >> [pmd_present(pmd_mknotpresent(pmd)) = true] >> >> This renames pmd_mknotpresent() as pmd_mknotvalid() reflecting the helper's >> functionality more accurately while changing the above mentioned situation >> as follows. This does not create any functional change. >> >> [pmd_present(pmd_mknotvalid(pmd)) = true] >> >> This is not applicable for platforms that define own pmdp_invalidate() via >> __HAVE_ARCH_PMDP_INVALIDATE. Suggestion for renaming came during a previous >> discussion here. > > Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is > a one-trick pony for pmdp_invalidate()?I had thought about making it pmd_mkinvalid() earlier. But as we were replacing pmd_mknotpresent(), hence went with similar pattern pmd_mknotvalid() which was originally suggested by Catalin. There is an existing pte_mknotpresent() in arc platform as well. I dont have a very strong opinion either way, will be happy to rename. But then still wondering if we really need to.> > Will >
Will Deacon
2020-Apr-21 07:07 UTC
[Nouveau] [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
On Tue, Apr 21, 2020 at 04:57:26AM +0530, Anshuman Khandual wrote:> > > On 04/21/2020 02:33 AM, Will Deacon wrote: > > On Fri, Mar 20, 2020 at 10:24:17AM +0530, Anshuman Khandual wrote: > >> pmd_present() is expected to test positive after pmdp_mknotpresent() as the > >> PMD entry still points to a valid huge page in memory. pmdp_mknotpresent() > >> implies that given PMD entry is just invalidated from MMU perspective while > >> still holding on to pmd_page() referred valid huge page thus also clearing > >> pmd_present() test. This creates the following situation which is counter > >> intuitive. > >> > >> [pmd_present(pmd_mknotpresent(pmd)) = true] > >> > >> This renames pmd_mknotpresent() as pmd_mknotvalid() reflecting the helper's > >> functionality more accurately while changing the above mentioned situation > >> as follows. This does not create any functional change. > >> > >> [pmd_present(pmd_mknotvalid(pmd)) = true] > >> > >> This is not applicable for platforms that define own pmdp_invalidate() via > >> __HAVE_ARCH_PMDP_INVALIDATE. Suggestion for renaming came during a previous > >> discussion here. > > > > Bikeshed alert: maybe pmd_mkinvalid() would be better, given that this is > > a one-trick pony for pmdp_invalidate()? > > I had thought about making it pmd_mkinvalid() earlier. But as we were replacing > pmd_mknotpresent(), hence went with similar pattern pmd_mknotvalid() which was > originally suggested by Catalin. There is an existing pte_mknotpresent() in arc > platform as well. I dont have a very strong opinion either way, will be happy > to rename. But then still wondering if we really need to.I just think that having pmdp_invalidate() call pmd_mkinvalid() makes a lot of sense and, since this is a pure renaming patch, then that's worth taking into consideration. If you go with pmd_mkinvalid(), then: Acked-by: Will Deacon <will at kernel.org> Will
Apparently Analagous Threads
- [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
- [PATCH 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
- [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()
- [PATCH V2 0/2] mm/thp: Rename pmd_mknotpresent() as pmd_mkinvalid()
- [PATCH 2/2] mm/thp: Rename pmd_mknotpresent() as pmd_mknotvalid()