summaryrefslogtreecommitdiffstats
path: root/mm/swap.c
diff options
context:
space:
mode:
authorRalph Campbell <rcampbell@nvidia.com>2020-12-14 19:05:55 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 12:13:39 -0800
commit43fbdeb349640e3d763f0eb52b6aef92d4e2ec17 (patch)
tree03a2fbf5c8dbf5a36fd9964d6f932c121ab61c25 /mm/swap.c
parent4509b42c38963f495b49aa50209c34337286ecbe (diff)
downloadlinux-stable-43fbdeb349640e3d763f0eb52b6aef92d4e2ec17.tar.gz
linux-stable-43fbdeb349640e3d763f0eb52b6aef92d4e2ec17.tar.bz2
linux-stable-43fbdeb349640e3d763f0eb52b6aef92d4e2ec17.zip
mm: handle zone device pages in release_pages()
release_pages() is an optimized, inlined version of __put_pages() except that zone device struct pages that are not page_is_devmap_managed() (i.e., memory_type MEMORY_DEVICE_GENERIC and MEMORY_DEVICE_PCI_P2PDMA), fall through to the code that could return the zone device page to the page allocator instead of adjusting the pgmap reference count. Clearly these type of pages are not having the reference count decremented to zero via release_pages() or page allocation problems would be seen. Just to be safe, handle the 1 to zero case in release_pages() like __put_page() does. Link: https://lkml.kernel.org/r/20201021194733.11530-1-rcampbell@nvidia.com Signed-off-by: Ralph Campbell <rcampbell@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Jerome Glisse <jglisse@redhat.com> Cc: John Hubbard <jhubbard@nvidia.com> Cc: Alistair Popple <apopple@nvidia.com> Cc: Jason Gunthorpe <jgg@nvidia.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Matthew Wilcox <willy@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/swap.c')
-rw-r--r--mm/swap.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/swap.c b/mm/swap.c
index 47a47681c86b..29220174433b 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -909,6 +909,9 @@ void release_pages(struct page **pages, int nr)
put_devmap_managed_page(page);
continue;
}
+ if (put_page_testzero(page))
+ put_dev_pagemap(page->pgmap);
+ continue;
}
if (!put_page_testzero(page))