[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 7/9] mm/memory: factor out common code from vm_normal_page_*()
- To: David Hildenbrand <david@xxxxxxxxxx>
- From: Lorenzo Stoakes <lorenzo.stoakes@xxxxxxxxxx>
- Date: Thu, 17 Jul 2025 20:55:43 +0100
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=k9ZMd5oUliJpkQFbZtKws7WQNqdJvQA5ZTb93CN7ByI=; b=HH210V/DGqzTD65dYMoQRGPV5wKNBRmQGs1sCWoy2zT6SxxXebzQHQ5ZMcd7HgM5hGsw2lAEjswG0CE7QcvT1cNpC3o4grCQdCZ5xkW4xG3p+LSjqUI+Ap0uSD8AfoSGQB7AfvqjgxmXYVkiGsd81Yf9a6z7pfgeZcgI3At9Y9gKmiXx2gGGibJCb5NOpGa1cXz92FhKdThXXFOwKoNnULh/drs3ut2LobyYUii5AgMTG6R/LkWBdZyXK5PAyI6LO/hJgTex1KnrSSBG0Fg/n0awYh72qS+AVqK4ETea3TtpVi0ejnXNWV9rpGA3G8aPWXhUdgmjVbABgyvQ7vE3ig==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P9s08NE3Qwx/3lTbrIsdIzAA41DALP+C7iOAihcKA3WkBkZc+j37/2qJBjsgefDZD20iehV5P/DgMm6rle1Jm6daqEteKepfdFvmr6jjGtxXid9sA1TqoM/oHf2gbfRsKHb/pVO83fjUVUmPPzsBEOWgwEbJRWxee5sJdEJaxYkKY42B3rjHUKlxVY+0SddShI9jflr2fGXIGKL4RJgcLA31fR/LeIn57xU/rYaMz5UlBdEXoRdoaQs5uOr8ZE56HNFw6v/GJ0hLishbY3zOuChKTT0S6+BA0md+QhkPw3dA4QxVC6xlCjy1ZrWv60O5GQ2mfErYFlIP5k79cbp6HA==
- Cc: linux-kernel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, nvdimm@xxxxxxxxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, Jan Kara <jack@xxxxxxx>, Alexander Viro <viro@xxxxxxxxxxxxxxxxxx>, Christian Brauner <brauner@xxxxxxxxxx>, "Liam R. Howlett" <Liam.Howlett@xxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Mike Rapoport <rppt@xxxxxxxxxx>, Suren Baghdasaryan <surenb@xxxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>, Zi Yan <ziy@xxxxxxxxxx>, Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>, Nico Pache <npache@xxxxxxxxxx>, Ryan Roberts <ryan.roberts@xxxxxxx>, Dev Jain <dev.jain@xxxxxxx>, Barry Song <baohua@xxxxxxxxxx>, Jann Horn <jannh@xxxxxxxxxx>, Pedro Falcato <pfalcato@xxxxxxx>, Hugh Dickins <hughd@xxxxxxxxxx>, Oscar Salvador <osalvador@xxxxxxx>, Lance Yang <lance.yang@xxxxxxxxx>
- Delivery-date: Thu, 17 Jul 2025 19:56:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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 (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) {
> > - if (vma->vm_flags & VM_MIXEDMAP) {
> > - if (!pfn_valid(pfn))
> > - return NULL;
> > - goto out;
> > - } else {
> > - unsigned long off;
> > - off = (addr - vma->vm_start) >> PAGE_SHIFT;
> > - if (pfn == vma->vm_pgoff + off)
> > - return NULL;
> > - if (!is_cow_mapping(vma->vm_flags))
> > - return NULL;
> > - }
> > - }
> > -
> > - if (is_huge_zero_pfn(pfn))
> > - return NULL;
> > - if (unlikely(pfn > highest_memmap_pfn)) {
> > - print_bad_page_map(vma, addr, pmd_val(pmd), NULL);
> > - return NULL;
> > - }
> > -
> > - /*
> > - * NOTE! We still have PageReserved() pages in the page tables.
> > - * eg. VDSO mappings can cause them to exist.
> > - */
> > -out:
> > - return pfn_to_page(pfn);
> > + return vm_normal_page_pfn(vma, addr, pfn, pmd_val(pmd));
>
> Hmm this seems broken, because you're now making these special on arches with
> pte_special() right? But then you're invoking the not-special function?
>
> Also for non-pte_special() arches you're kind of implying they _maybe_ could
> be
> special.
OK sorry the diff caught me out here, you explicitly handle the pmd_special()
case here, duplicatively (yuck).
Maybe you fix this up in a later patch :)
Anyway, again it'd be nice to somehow find a way to separate the special
check out from the rest.
|