On Wed, Oct 10, 2012 at 04:08:55PM +0200, Manuel Bouyer wrote: > [...] > I suspect UVM wants to do batch of read or writes in power of 2 size, > aligned on power of 2 boundaries. Or this is my feeling after playing > with the readahead code, and I wouldn't be surprised if the write > code had the same requirement.
I tried replacing the code in ufs_readwrite(): if (!async && oldoff >> 17 != uio->uio_offset >> 17) { mutex_enter(vp->v_interlock); error = VOP_PUTPAGES(vp, (oldoff >> 17) << 17, (uio->uio_offset >> 17) << 17, PGO_CLEANIT | PGO_JOURNALLOCKED | PGO_LAZY); if (error) break; } with: int maxphys; if (vp->v_mount && vp->v_mount->mnt_maxphys) maxphys = vp->v_mount->mnt_maxphys; else maxphys = MAXPHYS; if (!async && uio->uio_offset - oldoff >= maxphys) { mutex_enter(vp->v_interlock); error = VOP_PUTPAGES(vp, trunc_page(oldoff), trunc_page(uio->uio_offset), PGO_CLEANIT | PGO_JOURNALLOCKED | PGO_LAZY); if (error) break; } but I only get 16k writes. So I suspect the power of 2 alignement is important here. Also, I did hit: panic: kernel diagnostic assertion "npages <= (MAXPHYS >> PAGE_SHIFT)" failed: file "/dsk/l1/misc/bouyer/tls-maxphys/src/sys/uvm/uvm_pager.c", line 212 fatal breakpoint trap in supervisor mode trap type 1 code 0 rip ffffffff8025695d cs 8 rflags 246 cr2 ffff80006c7c9ab4 ilevel 0 rsp fffffe810b929f90 curlwp 0xfffffe810b94a780 pid 0 lid 93 lowest kstack 0xfffffe810b927000 Stopped in pid 0.93 (system) at netbsd:breakpoint+0x5: leave db{6}> tr breakpoint() at netbsd:breakpoint+0x5 vpanic() at netbsd:vpanic+0x1f2 kern_assert() at netbsd:kern_assert+0x48 uvm_pagermapin() at netbsd:uvm_pagermapin+0x207 genfs_gop_write() at netbsd:genfs_gop_write+0x2f genfs_do_putpages() at netbsd:genfs_do_putpages+0xda6 VOP_PUTPAGES() at netbsd:VOP_PUTPAGES+0x3a uvm_pageout() at netbsd:uvm_pageout+0x22a I guess emergva-related code (allocation and use) should use MACHINE_MAXPHYS instead of MAXPHYS -- Manuel Bouyer <bou...@antioche.eu.org> NetBSD: 26 ans d'experience feront toujours la difference --