Project

General

Profile

Bug #5938

tmpfs locks processes in paging loop when there's no swap partition

Added by Dan McDonald almost 4 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
kernel
Start date:
2015-05-19
Due date:
% Done:

0%

Estimated time:
Difficulty:
Expert
Tags:
needs-triage

Description

I'm attaching three files: mapfile_reorder, mapfile-vers-jvm_dtrace, and vm.def. I took this from the openjdk7 build.

While bulding the OmniOS world on a machine without a swap partition, I noticed the openjdk7 build would stop, and have one process spin a CPU core indefinitely. I've reduced the reproduction to:

1.) Making sure all three files are in /tmp.

2.) PWD=/tmp

3.) Running this:

cat mapfile_reorder mapfile-vers-jvm_dtrace | nawk 'system ("cat vm.def")' > ./outfile

I think the size of the files (and the very large >500M outfile) influence whether or not this bug is tickled. This pipeline and (ab)use of nawk set up a situation where the "sh -c cat vm.def", which uses ksh93, mmaps "vm.def" with certain madvise flags, and then write()s the mmapped buffer out to another file on tmpfs. This causes page faults, which in turn trap, which in turn call tmp_putpage() and tmp_putapage(). tmp_putapage() fails, but tmp_putpage() understands a certain type of failure to NOT be one.

If you run that pipeline, you'll see constant calls to tmp_putapage(). The stack looks something like this:


             unix`page_sub_common+0x25
             unix`page_sub+0x52
             genunix`pvn_write_done+0x135
             tmpfs`tmp_putapage+0x4da
             tmpfs`tmp_putpage+0x302
             genunix`fop_putpage+0x4c
             genunix`segvn_fault+0x75d
             genunix`as_fault+0x342
             unix`pagefault+0x96
             unix`trap+0x1331
             unix`0xfffffffffb8002ba
             unix`0xfffffffffb85fbca
             genunix`uiomove+0x12e
             genunix`vpm_data_copy+0x13a
             tmpfs`wrtmp+0x2c5
             tmpfs`tmp_write+0xc6
             genunix`fop_write+0x5b
             genunix`write+0x248
             genunix`write32+0x1e
             unix`_sys_sysenter_post_swapgs+0x237

The workaround is simple: Add a swap partition. The above pipeline STOPS SPINNING the instant one adds a swap partition into the system. Because of this readily available workaround (and that almost all systems install with one), this bug is not a crashing priority.


Files

mapfile-vers-jvm_dtrace (1.25 KB) mapfile-vers-jvm_dtrace Dan McDonald, 2015-05-19 01:29 PM
vm.def (80 KB) vm.def Dan McDonald, 2015-05-19 01:29 PM
mapfile_reorder (352 KB) mapfile_reorder Dan McDonald, 2015-05-19 01:29 PM

Also available in: Atom PDF