HomeFreeBSD

Create threads in detached state in userspace.

Description

Create threads in detached state in userspace.

Currently, thread_create(), when called in userspace, creates a
joinable (i.e. not detached thread). This is the pthread default.

Unfortunately, this does not reproduce kthreads behavior (kthreads
are always detached). In addition, this contradicts the original
Solaris code which creates userspace threads in detached mode.

These joinable threads are never joined, which leads to a leakage of
pthread thread objects ("zombie threads"). This in turn results in
excessive ressource consumption, and possible ressource exhaustion in
extreme cases (e.g. long ztest runs).

This patch fixes the issue by creating userspace threads in detached
mode. The only exception is ztest worker threads which are meant to be
joinable.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #989

Details

Provenance
Etienne Dechamps <etienne.dechamps@ovh.net>Authored on Sep 27 2012, 11:31 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Oct 3 2012, 8:32 PM
Parents
rG6d1d976b2c2c: Modify vdev_elevator_switch() to use elevator_change()
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rG0aebd4f9e322: Create threads in detached state in userspace. (authored by Etienne Dechamps <etienne.dechamps@ovh.net>).Oct 3 2012, 8:32 PM