<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/lib/libthr, branch stable/8</title>
<subtitle>FreeBSD source tree</subtitle>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/'/>
<entry>
<title>MFC 250691:</title>
<updated>2014-02-19T15:00:55+00:00</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2014-02-19T15:00:55+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=1912efe06723453167cdb44d23e486ddafdbc8fe'/>
<id>1912efe06723453167cdb44d23e486ddafdbc8fe</id>
<content type='text'>
Return one-based key so that user can check if the key is ever allocated
in the first place.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Return one-based key so that user can check if the key is ever allocated
in the first place.
</pre>
</div>
</content>
</entry>
<entry>
<title>Use target thread's scheduling policy not current's.</title>
<updated>2012-07-25T02:09:06+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-07-25T02:09:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=6013788bb7fbf278ab499f3e6a2d9d75e1595b28'/>
<id>6013788bb7fbf278ab499f3e6a2d9d75e1595b28</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Release a reference count in case priority needn't</title>
<updated>2012-07-25T02:05:59+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-07-25T02:05:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=229c33c3d8b3258ef96512d3db24a2e1f9ac43d0'/>
<id>229c33c3d8b3258ef96512d3db24a2e1f9ac43d0</id>
<content type='text'>
to be changed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
to be changed.
</pre>
</div>
</content>
</entry>
<entry>
<title>Revert r238715, the revision breaks firefox.</title>
<updated>2012-07-25T01:57:53+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-07-25T01:57:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=45c01d255927c617837fde296a3762aac3989779'/>
<id>45c01d255927c617837fde296a3762aac3989779</id>
<content type='text'>
Reported by: dougb
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reported by: dougb
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge r238637,r238640,r238641,r238642:</title>
<updated>2012-07-23T09:34:19+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-07-23T09:34:19+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=e419de0e0e7b4f5e8b8e108e5650c519e4624f2e'/>
<id>e419de0e0e7b4f5e8b8e108e5650c519e4624f2e</id>
<content type='text'>
------------------------------------------------------------------------
r238637 | davidxu | 2012-07-20 09:56:14 +0800 (Fri, 20 Jul 2012) | 6 lines

Don't forget to release a thread reference count,
replace _thr_ref_add() with _thr_find_thread(),
so reference count is no longer needed.

------------------------------------------------------------------------
r238640 | davidxu | 2012-07-20 11:00:41 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238641 | davidxu | 2012-07-20 11:16:52 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238642 | davidxu | 2012-07-20 11:22:17 +0800 (Fri, 20 Jul 2012) | 2 lines

Don't assign same value.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
------------------------------------------------------------------------
r238637 | davidxu | 2012-07-20 09:56:14 +0800 (Fri, 20 Jul 2012) | 6 lines

Don't forget to release a thread reference count,
replace _thr_ref_add() with _thr_find_thread(),
so reference count is no longer needed.

------------------------------------------------------------------------
r238640 | davidxu | 2012-07-20 11:00:41 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238641 | davidxu | 2012-07-20 11:16:52 +0800 (Fri, 20 Jul 2012) | 2 lines

Eliminate duplicated code.

------------------------------------------------------------------------
r238642 | davidxu | 2012-07-20 11:22:17 +0800 (Fri, 20 Jul 2012) | 2 lines

Don't assign same value.
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC: 234424</title>
<updated>2012-06-22T19:19:53+00:00</updated>
<author>
<name>George V. Neville-Neil</name>
<email>gnn@FreeBSD.org</email>
</author>
<published>2012-06-22T19:19:53+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9e881b36a0455d13c554dd6fac0bf8fded8bfbb0'/>
<id>9e881b36a0455d13c554dd6fac0bf8fded8bfbb0</id>
<content type='text'>
Set SIGCANCEL to SIGTHR as part of some cleanup of DTrace code.

Reviewed by:    davidxu@
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Set SIGCANCEL to SIGTHR as part of some cleanup of DTrace code.

Reviewed by:    davidxu@
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r236135:</title>
<updated>2012-05-30T01:54:14+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-05-30T01:54:14+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=b3fc172be96ae6a6ed5933098593d91db769ba8e'/>
<id>b3fc172be96ae6a6ed5933098593d91db769ba8e</id>
<content type='text'>
Return EBUSY for PTHREAD_MUTEX_ADAPTIVE_NP too when the mutex could not
be acquired.

PR:	168317
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Return EBUSY for PTHREAD_MUTEX_ADAPTIVE_NP too when the mutex could not
be acquired.

PR:	168317
</pre>
</div>
</content>
</entry>
<entry>
<title>MFC r211706:</title>
<updated>2012-05-09T15:57:59+00:00</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2012-05-09T15:57:59+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=9e57e94da3730b1557432fb0919fa64939f800d9'/>
<id>9e57e94da3730b1557432fb0919fa64939f800d9</id>
<content type='text'>
On shared object unload, in __cxa_finalize, call and clear all installed
atexit and __cxa_atexit handlers that are either installed by unloaded
dso, or points to the functions provided by the dso.

Use _rtld_addr_phdr to locate segment information from the address of
private variable belonging to the dso, supplied by crtstuff.c. Provide
utility function __elf_phdr_match_addr to do the match of address against
dso executable segment.

Call back into libthr from __cxa_finalize using weak
__pthread_cxa_finalize symbol to remove any atfork handler which
function points into unloaded object.

The rtld needs private __pthread_cxa_finalize symbol to not require
resolution of the weak undefined symbol at initialization time. This
cannot work, since rtld is relocated before sym_zero is set up.

MFC r211894:
Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info.

Requested and tested by:	Peter Jeremy &lt;peter rulingia com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On shared object unload, in __cxa_finalize, call and clear all installed
atexit and __cxa_atexit handlers that are either installed by unloaded
dso, or points to the functions provided by the dso.

Use _rtld_addr_phdr to locate segment information from the address of
private variable belonging to the dso, supplied by crtstuff.c. Provide
utility function __elf_phdr_match_addr to do the match of address against
dso executable segment.

Call back into libthr from __cxa_finalize using weak
__pthread_cxa_finalize symbol to remove any atfork handler which
function points into unloaded object.

The rtld needs private __pthread_cxa_finalize symbol to not require
resolution of the weak undefined symbol at initialization time. This
cannot work, since rtld is relocated before sym_zero is set up.

MFC r211894:
Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info.

Requested and tested by:	Peter Jeremy &lt;peter rulingia com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 233103, 233912 from head:</title>
<updated>2012-05-03T03:05:18+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-05-03T03:05:18+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=3f0e2e0074c6f5f238e5d0da66a0712be7356b66'/>
<id>3f0e2e0074c6f5f238e5d0da66a0712be7356b66</id>
<content type='text'>
233103:
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
	pthread_mutex_lock(&amp;mutex);
	pthread_mutex_unlock(&amp;mutex);
	pthread_mutex_destroy(&amp;muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.

233912:
umtx operation UMTX_OP_MUTEX_WAKE has a side-effect that it accesses
a mutex after a thread has unlocked it, it event writes data to the mutex
memory to clear contention bit, there is a race that other threads
can lock it and unlock it, then destroy it, so it should not write
data to the mutex memory if there isn't any waiter.
The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It
requires thread library to clear the lock word entirely, then
call the WAKE2 operation to check if there is any waiter in kernel,
and try to wake up a thread, if necessary, the contention bit is set again
by the operation. This also mitgates the chance that other threads find
the contention bit and try to enter kernel to compete with each other
to wake up sleeping thread, this is unnecessary. With this change, the
mutex owner is no longer holding the mutex until it reaches a point
where kernel umtx queue is locked, it releases the mutex as soon as
possible.
Performance is improved when the mutex is contensted heavily.  On Intel
i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds
to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is
deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c

Special code for stable/8:
And add code to detect if the UMTX_OP_MUTEX_WAKE2 is available.

PR:	threads/167308
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
233103:
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
	pthread_mutex_lock(&amp;mutex);
	pthread_mutex_unlock(&amp;mutex);
	pthread_mutex_destroy(&amp;muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.

233912:
umtx operation UMTX_OP_MUTEX_WAKE has a side-effect that it accesses
a mutex after a thread has unlocked it, it event writes data to the mutex
memory to clear contention bit, there is a race that other threads
can lock it and unlock it, then destroy it, so it should not write
data to the mutex memory if there isn't any waiter.
The new operation UMTX_OP_MUTEX_WAKE2 try to fix the problem. It
requires thread library to clear the lock word entirely, then
call the WAKE2 operation to check if there is any waiter in kernel,
and try to wake up a thread, if necessary, the contention bit is set again
by the operation. This also mitgates the chance that other threads find
the contention bit and try to enter kernel to compete with each other
to wake up sleeping thread, this is unnecessary. With this change, the
mutex owner is no longer holding the mutex until it reaches a point
where kernel umtx queue is locked, it releases the mutex as soon as
possible.
Performance is improved when the mutex is contensted heavily.  On Intel
i3-2310M, the runtime of a benchmark program is reduced from 26.87 seconds
to 2.39 seconds, it even is better than UMTX_OP_MUTEX_WAKE which is
deprecated now. http://people.freebsd.org/~davidxu/bench/mutex_perf.c

Special code for stable/8:
And add code to detect if the UMTX_OP_MUTEX_WAKE2 is available.

PR:	threads/167308
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge 233103 from head:</title>
<updated>2012-04-17T09:18:06+00:00</updated>
<author>
<name>David Xu</name>
<email>davidxu@FreeBSD.org</email>
</author>
<published>2012-04-17T09:18:06+00:00</published>
<link rel='alternate' type='text/html' href='http://cgit.freebsd.org/src/commit/?id=cc31b6af30d6d611071b23b4c58634c45e7d0fa6'/>
<id>cc31b6af30d6d611071b23b4c58634c45e7d0fa6</id>
<content type='text'>
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
	pthread_mutex_lock(&amp;mutex);
	pthread_mutex_unlock(&amp;mutex);
	pthread_mutex_destroy(&amp;muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some software think a mutex can be destroyed after it owned it, for
example, it uses a serialization point like following:
	pthread_mutex_lock(&amp;mutex);
	pthread_mutex_unlock(&amp;mutex);
	pthread_mutex_destroy(&amp;muetx);
They think a previous lock holder should have already left the mutex and
is no longer referencing it, so they destroy it. To be maximum compatible
with such code, we use IA64 version to unlock the mutex in kernel, remove
the two steps unlocking code.
</pre>
</div>
</content>
</entry>
</feed>
