Re: [PATCH v6 08/19] iommufd: PFN handling for iopt_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 06, 2022 at 08:36:20PM +0800, Binbin Wu wrote:
> > +static void pfn_reader_user_destroy(struct pfn_reader_user *user,
> > +				    struct iopt_pages *pages)
> > +{
> > +	if (user->locked != -1) {
> > +		if (user->locked)
> > +			mmap_read_unlock(pages->source_mm);
> > +		if (pages->source_mm != current->mm)
> > +			mmput(pages->source_mm);
> > +		user->locked = 0;
> 
> Set back to -1 is more aligned with the definition of the locked?

Ok

> Although the value doesn't matter due to the end of lifecyle of
> pfn_reader_user.

Yep

> > +/* This is the "modern" and faster accounting method used by io_uring */
> > +static int incr_user_locked_vm(struct iopt_pages *pages, unsigned long npages)
> > +{
> > +	unsigned long lock_limit;
> > +	unsigned long cur_pages;
> > +	unsigned long new_pages;
> > +
> > +	lock_limit = task_rlimit(pages->source_task, RLIMIT_MEMLOCK) >>
> > +		     PAGE_SHIFT;
> > +	npages = pages->npinned - pages->last_npinned;
> 
> The passed in value of npages is not used?

Ooh, that is a mistake this line should not be present

However in all cases the npages is equal to the calculation so it is
harmless.

Thanks,
Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux