George Joseph
64045f0b57
This patch adds support for spinlocks in Asterisk.
...
There are cases in Asterisk where it might be desirable to lock
a short critical code section but not incur the context switch
and yield penalty of a mutex or rwlock. The primary spinlock
implementations execute exclusively in userspace and therefore
don't incur those penalties. Spinlocks are NOT meant to be a
general replacement for mutexes. They should be used only for
protecting short blocks of critical code such as simple compares
and assignments. Operations that may block, hold a lock, or
cause the thread to give up it's timeslice should NEVER be
attempted in a spinlock.
The first use case for spinlocks is in astobj2 - internal_ao2_ref.
Currently the manipulation of the reference counter is done with
an ast_atomic_fetchadd_int which works fine. When weak reference
containers are introduced however, there's an additional comparison
and assignment that'll need to be done while the lock is held.
A mutex would be way too expensive here, hence the spinlock.
Given that lock contention in this situation would be infrequent,
the overhead of the spinlock is only a few more machine instructions
than the current ast_atomic_fetchadd_int call.
ASTERISK-23553 #close
Review: https://reviewboard.asterisk.org/r/3405/
........
Merged revisions 412976 from http://svn.asterisk.org/svn/asterisk/branches/12
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@412977 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-04-23 20:13:30 +00:00
..
2013-08-16 18:34:31 +00:00
2013-10-04 16:01:48 +00:00
2013-05-21 18:00:22 +00:00
2014-03-14 16:42:54 +00:00
2012-06-25 15:55:25 +00:00
2010-07-14 20:48:59 +00:00
2013-12-18 20:33:37 +00:00
2014-04-17 21:57:36 +00:00
2014-01-12 22:24:27 +00:00
2013-11-27 17:32:29 +00:00
2013-08-23 18:07:40 +00:00
2014-04-11 02:59:19 +00:00
2013-07-19 23:30:10 +00:00
2013-12-19 17:45:21 +00:00
2014-04-23 20:13:30 +00:00
2013-08-23 18:07:40 +00:00
2014-04-15 23:21:19 +00:00
2013-07-25 04:06:32 +00:00
2013-08-22 18:52:41 +00:00
2013-10-22 17:06:21 +00:00
2014-03-17 17:22:12 +00:00
2013-08-21 15:51:19 +00:00
2014-03-07 15:47:55 +00:00
2013-08-05 16:59:13 +00:00
2013-10-03 20:22:17 +00:00
2014-03-07 19:19:04 +00:00
2013-12-03 17:35:54 +00:00
2012-02-22 21:22:43 +00:00
2012-09-25 19:29:14 +00:00
2013-01-09 20:21:33 +00:00
2013-05-21 18:00:22 +00:00
2014-01-12 22:13:12 +00:00
2013-09-27 14:08:23 +00:00
2011-07-07 22:39:54 +00:00
2014-03-07 15:47:55 +00:00
2014-04-04 19:19:55 +00:00
2013-12-18 20:33:37 +00:00
2013-04-15 16:22:03 +00:00
2014-01-28 20:47:15 +00:00
2013-08-30 13:40:27 +00:00
2013-08-25 18:00:46 +00:00
2014-03-06 22:39:54 +00:00
2013-07-08 14:26:40 +00:00
2014-03-07 15:47:55 +00:00
2012-08-30 14:23:28 +00:00
2011-02-03 16:22:10 +00:00
2012-08-30 14:23:28 +00:00
2014-03-07 20:41:13 +00:00
2014-03-07 15:47:55 +00:00
2011-12-06 19:09:56 +00:00
2014-03-17 22:54:32 +00:00
2012-01-30 23:58:51 +00:00
2013-12-11 19:19:24 +00:00
2011-12-28 18:59:16 +00:00
2013-10-04 16:01:48 +00:00
2013-08-17 14:46:44 +00:00
2013-08-17 14:46:44 +00:00
2011-07-15 00:23:14 +00:00
2013-09-17 17:55:21 +00:00
2013-09-13 22:19:23 +00:00
2013-07-03 17:58:45 +00:00
2013-10-03 14:58:16 +00:00
2014-01-17 21:33:26 +00:00
2013-08-23 15:42:27 +00:00
2011-02-03 16:22:10 +00:00
2014-03-17 17:22:12 +00:00
2014-03-15 15:24:23 +00:00
2010-06-08 05:29:08 +00:00
2012-11-16 00:19:48 +00:00
2012-08-30 14:23:28 +00:00
2013-08-30 13:40:27 +00:00
2013-11-27 15:48:39 +00:00
2011-02-03 16:22:10 +00:00
2012-01-27 18:47:16 +00:00
2013-05-08 21:01:33 +00:00
2012-09-21 17:14:59 +00:00
2011-07-11 19:49:35 +00:00
2014-02-21 18:04:54 +00:00
2012-11-27 18:20:18 +00:00
2013-04-08 13:27:45 +00:00
2013-11-02 04:12:36 +00:00
2014-01-14 18:14:02 +00:00
2014-03-28 17:41:23 +00:00
2012-08-29 22:48:08 +00:00
2013-06-24 13:49:20 +00:00
2012-08-30 14:23:28 +00:00
2013-07-01 16:01:24 +00:00
2011-02-03 16:22:10 +00:00
2013-05-14 21:45:08 +00:00
2014-04-15 23:21:19 +00:00
2013-08-22 21:29:16 +00:00
2013-11-05 21:06:25 +00:00
2012-02-27 16:31:24 +00:00
2013-08-30 20:58:59 +00:00
2014-04-04 19:19:55 +00:00
2013-08-23 15:42:27 +00:00
2013-08-17 15:01:54 +00:00
2013-07-03 17:58:45 +00:00
2014-04-18 16:44:48 +00:00
2013-08-02 13:54:31 +00:00
2010-09-02 05:02:54 +00:00
2013-08-01 13:49:34 +00:00
2010-06-18 21:32:09 +00:00
2011-12-28 18:59:16 +00:00
2014-03-28 18:32:50 +00:00
2014-01-06 17:45:25 +00:00
2012-09-21 17:14:59 +00:00
2014-02-25 17:51:51 +00:00
2014-03-08 16:50:36 +00:00
2014-01-31 22:39:12 +00:00
2014-01-31 22:27:07 +00:00
2014-02-26 13:47:49 +00:00
2014-03-25 17:40:51 +00:00
2012-02-24 15:10:35 +00:00
2014-04-15 17:07:20 +00:00
2013-08-22 22:33:48 +00:00
2012-02-20 23:43:27 +00:00
2013-06-22 14:03:22 +00:00
2013-08-17 14:39:27 +00:00
2013-05-30 17:05:53 +00:00
2011-04-26 19:38:41 +00:00
2013-09-30 18:55:27 +00:00
2011-10-11 19:06:29 +00:00
2011-02-22 23:04:49 +00:00
2012-10-11 15:49:02 +00:00
2011-02-03 16:22:10 +00:00
2011-02-22 23:04:49 +00:00
2012-10-18 14:17:40 +00:00
2014-04-02 18:57:29 +00:00
2013-06-24 13:49:20 +00:00
2012-10-01 12:29:04 +00:00
2014-04-23 20:13:30 +00:00
2013-04-22 16:22:00 +00:00
2013-11-23 17:48:28 +00:00
2013-12-13 16:38:57 +00:00
2014-01-14 23:44:57 +00:00
2014-03-07 15:47:55 +00:00
2014-03-06 18:20:37 +00:00
2014-03-07 15:47:55 +00:00
2014-04-18 20:09:24 +00:00
2014-04-11 12:43:34 +00:00
2013-08-01 13:49:34 +00:00
2013-12-18 20:33:37 +00:00
2013-11-22 20:10:46 +00:00
2014-03-05 01:05:02 +00:00
2014-01-12 22:07:01 +00:00
2013-07-19 18:00:35 +00:00
2013-05-08 13:39:08 +00:00
2014-03-07 20:41:13 +00:00
2013-04-26 20:05:15 +00:00
2013-02-07 15:16:44 +00:00
2013-11-23 17:26:57 +00:00
2011-12-01 21:19:41 +00:00
2009-12-21 18:51:17 +00:00
2013-09-30 18:55:27 +00:00
2012-10-12 16:31:01 +00:00
2013-02-14 18:47:56 +00:00
2013-12-17 23:38:02 +00:00
2013-04-25 18:25:31 +00:00
2013-08-28 16:07:30 +00:00
2013-06-17 03:00:38 +00:00
2014-02-07 20:01:45 +00:00
2012-08-30 14:23:28 +00:00
2013-12-19 17:13:53 +00:00
2010-08-17 19:34:52 +00:00
2013-11-23 17:26:57 +00:00
2013-03-28 23:59:20 +00:00
2013-11-02 04:30:49 +00:00
2012-01-25 21:31:28 +00:00
2013-02-15 13:38:12 +00:00
2013-02-15 13:38:12 +00:00
2013-04-16 15:33:59 +00:00