Thread (53 messages) 53 messages, 9 authors, 2024-10-30

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

From: Bjorn Helgaas <helgaas@kernel.org>
Date: 2024-09-11 13:51:43
Also in: linux-arm-kernel, linux-cxl, linux-doc, linux-ext4, linux-fsdevel, linux-mm, linux-xfs, lkml, nvdimm

On Wed, Sep 11, 2024 at 11:07:51AM +1000, Alistair Popple wrote:
quoted
quoted
diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c
index 4f47a13..210b9f4 100644
--- a/drivers/pci/p2pdma.c
+++ b/drivers/pci/p2pdma.c
@@ -129,6 +129,12 @@ static int p2pmem_alloc_mmap(struct file *filp, struct kobject *kobj,
 	}
 
 	/*
+	 * Initialise the refcount for the freshly allocated page. As we have
+	 * just allocated the page no one else should be using it.
+	 */
+	set_page_count(virt_to_page(kaddr), 1);
No doubt the subject line is true in some overall context, but it does
seem to say the opposite of what happens here.
Fair. It made sense to me from the mm context I was coming from (it was
being initialised to 1 there) but not overall. Something like "move page
refcount initialisation to p2pdma driver" would make more sense?
Definitely would, thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help