mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 04:44:45 +01:00
Merge branch 'pci/p2pdma'
- Release per-CPU pgmap ref when vm_insert_page() fails so we don't hang when removing the PCI device (Hou Tao) - Remove incorrect p2pmem_alloc_mmap() warning about page refcount (Hou Tao) - Reset page reference count when page mapping fails (Alistair Popple) * pci/p2pdma: PCI/P2PDMA: Reset page reference count when page mapping fails PCI/P2PDMA: Fix p2pmem_alloc_mmap() warning condition PCI/P2PDMA: Release per-CPU pgmap ref when vm_insert_page() fails
This commit is contained in:
commit
26cc2bd5aa
1 changed files with 9 additions and 1 deletions
|
|
@ -147,11 +147,19 @@ static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj,
|
|||
* we have just allocated the page no one else should be
|
||||
* using it.
|
||||
*/
|
||||
VM_WARN_ON_ONCE_PAGE(!page_ref_count(page), page);
|
||||
VM_WARN_ON_ONCE_PAGE(page_ref_count(page), page);
|
||||
set_page_count(page, 1);
|
||||
ret = vm_insert_page(vma, vaddr, page);
|
||||
if (ret) {
|
||||
gen_pool_free(p2pdma->pool, (uintptr_t)kaddr, len);
|
||||
|
||||
/*
|
||||
* Reset the page count. We don't use put_page()
|
||||
* because we don't want to trigger the
|
||||
* p2pdma_folio_free() path.
|
||||
*/
|
||||
set_page_count(page, 0);
|
||||
percpu_ref_put(ref);
|
||||
return ret;
|
||||
}
|
||||
percpu_ref_get(ref);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue