Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-30 Thread Lorenzo Stoakes
On Wed, Jul 30, 2025 at 02:54:46PM +0200, David Hildenbrand wrote: > On 18.07.25 14:43, Lorenzo Stoakes wrote: > > On Thu, Jul 17, 2025 at 10:03:44PM +0200, David Hildenbrand wrote: > > > On 17.07.25 21:55, Lorenzo Stoakes wrote: > > > > On Thu, Jul 17, 2025 at 08:51:51PM +0100, Lorenzo Stoakes wro

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-30 Thread David Hildenbrand
On 18.07.25 14:43, Lorenzo Stoakes wrote: On Thu, Jul 17, 2025 at 10:03:44PM +0200, David Hildenbrand wrote: On 17.07.25 21:55, Lorenzo Stoakes wrote: On Thu, Jul 17, 2025 at 08:51:51PM +0100, Lorenzo Stoakes wrote: @@ -721,37 +772,21 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-18 Thread Lorenzo Stoakes
On Thu, Jul 17, 2025 at 10:03:44PM +0200, David Hildenbrand wrote: > On 17.07.25 21:55, Lorenzo Stoakes wrote: > > On Thu, Jul 17, 2025 at 08:51:51PM +0100, Lorenzo Stoakes wrote: > > > > @@ -721,37 +772,21 @@ struct page *vm_normal_page_pmd(struct > > > > vm_area_struct *vma, unsigned long addr,

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-18 Thread Lorenzo Stoakes
On Thu, Jul 17, 2025 at 10:12:37PM +0200, David Hildenbrand wrote: > > > > > > -/* > > > - * vm_normal_page -- This function gets the "struct page" associated > > > with a pte. > > > +/** > > > + * vm_normal_page_pfn() - Get the "struct page" associated with a PFN in > > > a > > > + *

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-17 Thread David Hildenbrand
-/* - * vm_normal_page -- This function gets the "struct page" associated with a pte. +/** + * vm_normal_page_pfn() - Get the "struct page" associated with a PFN in a + * non-special page table entry. This is a bit nebulous/confusing, I mean you'll get PTE entries with PT

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-17 Thread David Hildenbrand
On 17.07.25 21:55, Lorenzo Stoakes wrote: On Thu, Jul 17, 2025 at 08:51:51PM +0100, Lorenzo Stoakes wrote: @@ -721,37 +772,21 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, print_bad_page_map(vma, addr, pmd_val(pmd), NULL); ret

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-17 Thread Lorenzo Stoakes
On Thu, Jul 17, 2025 at 08:51:51PM +0100, Lorenzo Stoakes wrote: > > @@ -721,37 +772,21 @@ struct page *vm_normal_page_pmd(struct vm_area_struct > > *vma, unsigned long addr, > > print_bad_page_map(vma, addr, pmd_val(pmd), NULL); > > return NULL; > > } > > - > > - if

Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-17 Thread Lorenzo Stoakes
On Thu, Jul 17, 2025 at 01:52:10PM +0200, David Hildenbrand wrote: > Let's reduce the code duplication and factor out the non-pte/pmd related > magic into vm_normal_page_pfn(). > > To keep it simpler, check the pfn against both zero folios. We could > optimize this, but as it's only for the !CONFIG

[PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()

2025-07-17 Thread David Hildenbrand
Let's reduce the code duplication and factor out the non-pte/pmd related magic into vm_normal_page_pfn(). To keep it simpler, check the pfn against both zero folios. We could optimize this, but as it's only for the !CONFIG_ARCH_HAS_PTE_SPECIAL case, it's not a compelling micro-optimization. With