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

From: Bjorn Helgaas
Date: Wed Sep 11 2024 - 09:53:27 EST


On Wed, Sep 11, 2024 at 11:07:51AM +1000, Alistair Popple wrote:
>
> >> 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.