View | Details | Raw Unified | Return to bug 16122
Collapse All | Expand All

(-)/sys/kern/vfs_aio.c (+5 lines)
Lines 618-661 Link Here
618
	 * We manage to create only one VM space for all AIOD processes.
618
	 * We manage to create only one VM space for all AIOD processes.
619
	 * The VM space for the first AIOD created becomes the shared VM
619
	 * The VM space for the first AIOD created becomes the shared VM
620
	 * space for all of them.  We add an additional reference count,
620
	 * space for all of them.  We add an additional reference count,
621
	 * even for the first AIOD, so the address space does not go away,
621
	 * even for the first AIOD, so the address space does not go away,
622
	 * and we continue to use that original VM space even if the first
622
	 * and we continue to use that original VM space even if the first
623
	 * AIOD exits.
623
	 * AIOD exits.
624
	 */
624
	 */
625
	if ((aiovm = aiovmspace) == NULL) {
625
	if ((aiovm = aiovmspace) == NULL) {
626
		aiovmspace = myvm;
626
		aiovmspace = myvm;
627
		myvm->vm_refcnt++;
627
		myvm->vm_refcnt++;
628
		/*
628
		/*
629
		 * Remove userland cruft from address space.
629
		 * Remove userland cruft from address space.
630
		 */
630
		 */
631
		if (myvm->vm_shm)
631
		if (myvm->vm_shm)
632
			shmexit(mycp);
632
			shmexit(mycp);
633
		pmap_remove_pages(&myvm->vm_pmap, 0, USRSTACK);
633
		pmap_remove_pages(&myvm->vm_pmap, 0, USRSTACK);
634
		vm_map_remove(&myvm->vm_map, 0, USRSTACK);
634
		vm_map_remove(&myvm->vm_map, 0, USRSTACK);
635
		myvm->vm_tsize = 0;
635
		myvm->vm_tsize = 0;
636
		myvm->vm_dsize = 0;
636
		myvm->vm_dsize = 0;
637
		myvm->vm_ssize = 0;
637
		myvm->vm_ssize = 0;
638
	} else {
638
	} else {
639
		aiovm->vm_refcnt++;
639
		aiovm->vm_refcnt++;
640
		/*
641
		 * Remove userland cruft from address space.
642
		 */
643
		if (myvm->vm_shm)
644
			shmexit(mycp);
640
		mycp->p_vmspace = aiovm;
645
		mycp->p_vmspace = aiovm;
641
		pmap_activate(mycp);
646
		pmap_activate(mycp);
642
		vmspace_free(myvm);
647
		vmspace_free(myvm);
643
		myvm = aiovm;
648
		myvm = aiovm;
644
	}
649
	}
645
650
646
	if (mycp->p_textvp) {
651
	if (mycp->p_textvp) {
647
		vrele(mycp->p_textvp);
652
		vrele(mycp->p_textvp);
648
		mycp->p_textvp = NULL;
653
		mycp->p_textvp = NULL;
649
	}
654
	}
650
655
651
	/*
656
	/*
652
	 * Allocate and ready the aio control info.  There is one
657
	 * Allocate and ready the aio control info.  There is one
653
	 * aiop structure per daemon.
658
	 * aiop structure per daemon.
654
	 */
659
	 */
655
	aiop = zalloc(aiop_zone);
660
	aiop = zalloc(aiop_zone);
656
	aiop->aioproc = mycp;
661
	aiop->aioproc = mycp;
657
	aiop->aioprocflags |= AIOP_FREE;
662
	aiop->aioprocflags |= AIOP_FREE;
658
	TAILQ_INIT(&aiop->jobtorun);
663
	TAILQ_INIT(&aiop->jobtorun);
659
664
660
	/*
665
	/*
661
	 * Place thread (lightweight process) onto the AIO free thread list
666
	 * Place thread (lightweight process) onto the AIO free thread list

Return to bug 16122