lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220629163128.7002f81b6346b2ed34d4d02a@linux-foundation.org>
Date:   Wed, 29 Jun 2022 16:31:28 -0700
From:   Andrew Morton <akpm@...ux-foundation.org>
To:     David Hildenbrand <david@...hat.com>
Cc:     Alex Sierra <alex.sierra@....com>, jgg@...dia.com,
        Felix.Kuehling@....com, linux-mm@...ck.org, rcampbell@...dia.com,
        linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
        amd-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org,
        hch@....de, jglisse@...hat.com, apopple@...dia.com,
        willy@...radead.org
Subject: Re: [PATCH v7 03/14] mm: handling Non-LRU pages returned by
 vm_normal_pages

On Wed, 29 Jun 2022 11:59:26 +0200 David Hildenbrand <david@...hat.com> wrote:

> On 29.06.22 05:54, Alex Sierra wrote:
> > With DEVICE_COHERENT, we'll soon have vm_normal_pages() return
> > device-managed anonymous pages that are not LRU pages. Although they
> > behave like normal pages for purposes of mapping in CPU page, and for
> > COW. They do not support LRU lists, NUMA migration or THP.
> > 
> > Callers to follow_page that expect LRU pages, are also checked for
> > device zone pages due to DEVICE_COHERENT type.
> 
> Can we rephrase that to (because zeropage)
> 
> "Callers to follow_page() currently don't expect ZONE_DEVICE pages,
> however, with DEVICE_COHERENT we might now return ZONE_DEVICE. Check for
> ZONE_DEVICE pages in applicable users of follow_page() as well."

I made that change to my copy.

> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -624,6 +624,13 @@ struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr,
> >  		if (is_zero_pfn(pfn))
> >  			return NULL;
> >  		if (pte_devmap(pte))
> > +/*
> > + * NOTE: New uers of ZONE_DEVICE will not set pte_devmap() and will have
> 
> s/uers/users/
> 
> > + * refcounts incremented on their struct pages when they are inserted into
> > + * PTEs, thus they are safe to return here. Legacy ZONE_DEVICE pages that set
> > + * pte_devmap() do not have refcounts. Example of legacy ZONE_DEVICE is
> > + * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers.
> > + */

And let's regularize that comment placement?

--- a/mm/memory.c~mm-handling-non-lru-pages-returned-by-vm_normal_pages-fix
+++ a/mm/memory.c
@@ -632,16 +632,16 @@ struct page *vm_normal_page(struct vm_ar
 			return NULL;
 		if (is_zero_pfn(pfn))
 			return NULL;
+		/*
+		 * NOTE: New users of ZONE_DEVICE will not set pte_devmap()
+		 * and will have refcounts incremented on their struct pages
+		 * when they are inserted into PTEs, thus they are safe to
+		 * return here. Legacy ZONE_DEVICE pages that set pte_devmap()
+		 * do not have refcounts. Example of legacy ZONE_DEVICE is
+		 * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers.
+		 */
 		if (pte_devmap(pte))
-/*
- * NOTE: New uers of ZONE_DEVICE will not set pte_devmap() and will have
- * refcounts incremented on their struct pages when they are inserted into
- * PTEs, thus they are safe to return here. Legacy ZONE_DEVICE pages that set
- * pte_devmap() do not have refcounts. Example of legacy ZONE_DEVICE is
- * MEMORY_DEVICE_FS_DAX type in pmem or virtio_fs drivers.
- */
 			return NULL;
-
 		print_bad_pte(vma, addr, pte, NULL);
 		return NULL;
 	}
_

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ