Blender Git Commit Log

Git Commits -> Revision 033d395

Revision 033d395 by Sergey Sharybin (master)
August 12, 2013, 14:37 (GMT)
Use atomic operations instead of spin lock for threaded update

This replaces code (pseudo-code):

spin_lock();
update_child_dag_nodes();
schedule_new_nodes();
spin_unlock();

with:

update_child_dag_nodes_with_atomic_ops();
schedule_new_nodes();

The reason for this is that scheduling new nodes implies
mutex lock, and having spin around it is a bad idea.

Alternatives could have been to use spinlock around
child nodes update only, but that would either imply having
either per-node spin-lock or using array to put nodes
ready for update to an array.

Didn't like an alternatives, using atomic operations makes
code much easier to follow, keeps data-flow on cpu nice.

Same atomic ops might be used in other performance-critical
areas later.

Using atomic ops implementation from jemalloc project.

Commit Details:

Full Hash: 033d395bede8849198761c190d0d7e93a95e4313
SVN Revision: 59086
Parent Commit: 983cc7c
Lines Changed: +301, -14

1 Added Path:

/intern/atomic/atomic_ops.h (+291, -0) (View)

5 Modified Paths:

/source/blender/blenkernel/CMakeLists.txt (+1, -0) (Diff)
/source/blender/blenkernel/depsgraph_private.h (+5, -5) (Diff)
/source/blender/blenkernel/intern/depsgraph.c (+3, -1) (Diff)
/source/blender/blenkernel/intern/scene.c (+0, -8) (Diff)
/source/blender/blenkernel/SConscript (+1, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021