Author: kib
Date: Sun Nov 29 10:30:56 2020
New Revision: 368142
URL: https://svnweb.freebsd.org/changeset/base/368142

Log:
  bio aio: Destroy ephemeral mapping before unwiring page.
  
  Apparently some architectures, like ppc in its hashed page tables
  variants, account mappings by pmap_qenter() in the response from
  pmap_is_page_mapped().
  
  While there, eliminate useless userp variable.
  
  Noted and reviewed by:        alc (previous version)
  Sponsored by: The FreeBSD Foundation
  Differential revision:        https://reviews.freebsd.org/D27409

Modified:
  head/sys/kern/vfs_aio.c

Modified: head/sys/kern/vfs_aio.c
==============================================================================
--- head/sys/kern/vfs_aio.c     Sun Nov 29 08:40:12 2020        (r368141)
+++ head/sys/kern/vfs_aio.c     Sun Nov 29 10:30:56 2020        (r368142)
@@ -2339,24 +2339,23 @@ static void
 aio_biowakeup(struct bio *bp)
 {
        struct kaiocb *job = (struct kaiocb *)bp->bio_caller1;
-       struct proc *userp;
        struct kaioinfo *ki;
        size_t nbytes;
        int error, nblks;
 
        /* Release mapping into kernel space. */
-       userp = job->userproc;
-       ki = userp->p_aioinfo;
-       vm_page_unhold_pages(job->pages, job->npages);
        if (job->pbuf != NULL) {
                pmap_qremove((vm_offset_t)job->pbuf->b_data, job->npages);
+               vm_page_unhold_pages(job->pages, job->npages);
                uma_zfree(pbuf_zone, job->pbuf);
                job->pbuf = NULL;
                atomic_subtract_int(&num_buf_aio, 1);
+               ki = job->userproc->p_aioinfo;
                AIO_LOCK(ki);
                ki->kaio_buffer_count--;
                AIO_UNLOCK(ki);
        } else {
+               vm_page_unhold_pages(job->pages, job->npages);
                free(job->pages, M_TEMP);
                atomic_subtract_int(&num_unmapped_aio, 1);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to