[OpenSIPS-Devel] [ opensips-Patches-3564846 ] Linux futex support for locks
Patches item #3564846, was opened at 2012-09-04 16:33 Message generated for change (Comment added) made by vladut-paiu You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=1086412aid=3564846group_id=232389 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: core Group: trunk Status: Closed Resolution: Accepted Priority: 5 Private: No Submitted By: Ryan Bullock (rrb3942) Assigned to: Vladut-Stefan Paiu (vladut-paiu) Summary: Linux futex support for locks Initial Comment: This patch adds the option for using futexs under Linux with FAST_LOCK. Implementation was taken from http://people.redhat.com/drepper/futex.pdf, and modified to add support for an Adaptive Wait loop in the case of a single waiter. Uses a modified version of the tsl() fuction from fastlock.h as an atomic xchg operation. It uses gcc builtins for atomic cmpxchg. To use futexes FAST_LOCK and USE_FUTEX must both be defined. Since the logic for using the futex is notably different than FAST_LOCK it is implemented separately in futex_lock.h, however we still require FAST_LOCK be defined to ensure support for the atomic_xchg. In my testing, using opensips in a virtual machine allocated 2 processors and using 16 children in a fairly pathological locking scenario this shows a large performance boost over just FAST_LOCK. Some Benchmark numbers after 5 minutes of runtime with sipp attempting 1000 CPS with 6 second durations: USE_FUTEX Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17196]: benchmark (timer lock_test [0]): 309 [ msgs/total/min/max/avg - LR: 100/14797/21/2049/147.97 | GB: 599600/98709250/0/20102/987092.50] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17202]: benchmark (timer lock_test [0]): 120 [ msgs/total/min/max/avg - LR: 100/15584/85/317/155.84 | GB: 599700/98724834/0/20102/987248.34] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17192]: benchmark (timer lock_test [0]): 150 [ msgs/total/min/max/avg - LR: 100/19241/86/4076/192.41 | GB: 599800/98744075/0/20102/987440.75] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 124 [ msgs/total/min/max/avg - LR: 100/22005/74/6166/220.05 | GB: 599900/98766080/0/20102/987660.80] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17206]: benchmark (timer lock_test [0]): 105 [ msgs/total/min/max/avg - LR: 100/19022/21/848/190.22 | GB: 60/98785102/0/20102/987851.02] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 155 [ msgs/total/min/max/avg - LR: 100/18633/85/1386/186.33 | GB: 600100/98803735/0/20102/988037.35] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 107 [ msgs/total/min/max/avg - LR: 100/18284/81/2873/182.84 | GB: 600200/98822019/0/20102/988220.19] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17207]: benchmark (timer lock_test [0]): 106 [ msgs/total/min/max/avg - LR: 100/16327/83/747/163.27 | GB: 600300/98838346/0/20102/988383.46] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17204]: benchmark (timer lock_test [0]): 40 [ msgs/total/min/max/avg - LR: 100/16664/27/5093/166.64 | GB: 600400/98855010/0/20102/988550.10] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 43 [ msgs/total/min/max/avg - LR: 100/4938/26/222/49.38 | GB: 600500/98859948/0/20102/988599.48] FAST_LOCK Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2360]: benchmark (timer lock_test [0]): 159 [ msgs/total/min/max/avg - LR: 100/16685/78/380/166.85 | GB: 600600/347519878/0/137058/3475198.78] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 153 [ msgs/total/min/max/avg - LR: 100/24353/0/2216/243.53 | GB: 600700/347544231/0/137058/3475442.31] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2355]: benchmark (timer lock_test [0]): 95 [ msgs/total/min/max/avg - LR: 100/16816/75/465/168.16 | GB: 600800/347561047/0/137058/3475610.47] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2359]: benchmark (timer lock_test [0]): 131 [ msgs/total/min/max/avg - LR: 100/20270/81/3535/202.70 | GB: 600900/347581317/0/137058/3475813.17] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2346]: benchmark (timer lock_test [0]): 87 [ msgs/total/min/max/avg - LR: 100/17892/87/872/178.92 | GB: 601000/347599209/0/137058/3475992.09] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 178 [ msgs/total/min/max/avg - LR: 100/16425/81/354/164.25 | GB: 601100/347615634/0/137058/3476156.34] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2351]: benchmark (timer lock_test [0]): 45 [ msgs/total/min/max/avg - LR: 100/14298/0/1367/142.98 | GB:
[OpenSIPS-Devel] [ opensips-Patches-3564846 ] Linux futex support for locks
Patches item #3564846, was opened at 2012-09-04 16:33 Message generated for change (Settings changed) made by bogdan_iancu You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=1086412aid=3564846group_id=232389 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: core Group: trunk Status: Open Resolution: Accepted Priority: 5 Private: No Submitted By: Ryan Bullock (rrb3942) Assigned to: Vladut-Stefan Paiu (vladut-paiu) Summary: Linux futex support for locks Initial Comment: This patch adds the option for using futexs under Linux with FAST_LOCK. Implementation was taken from http://people.redhat.com/drepper/futex.pdf, and modified to add support for an Adaptive Wait loop in the case of a single waiter. Uses a modified version of the tsl() fuction from fastlock.h as an atomic xchg operation. It uses gcc builtins for atomic cmpxchg. To use futexes FAST_LOCK and USE_FUTEX must both be defined. Since the logic for using the futex is notably different than FAST_LOCK it is implemented separately in futex_lock.h, however we still require FAST_LOCK be defined to ensure support for the atomic_xchg. In my testing, using opensips in a virtual machine allocated 2 processors and using 16 children in a fairly pathological locking scenario this shows a large performance boost over just FAST_LOCK. Some Benchmark numbers after 5 minutes of runtime with sipp attempting 1000 CPS with 6 second durations: USE_FUTEX Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17196]: benchmark (timer lock_test [0]): 309 [ msgs/total/min/max/avg - LR: 100/14797/21/2049/147.97 | GB: 599600/98709250/0/20102/987092.50] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17202]: benchmark (timer lock_test [0]): 120 [ msgs/total/min/max/avg - LR: 100/15584/85/317/155.84 | GB: 599700/98724834/0/20102/987248.34] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17192]: benchmark (timer lock_test [0]): 150 [ msgs/total/min/max/avg - LR: 100/19241/86/4076/192.41 | GB: 599800/98744075/0/20102/987440.75] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 124 [ msgs/total/min/max/avg - LR: 100/22005/74/6166/220.05 | GB: 599900/98766080/0/20102/987660.80] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17206]: benchmark (timer lock_test [0]): 105 [ msgs/total/min/max/avg - LR: 100/19022/21/848/190.22 | GB: 60/98785102/0/20102/987851.02] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 155 [ msgs/total/min/max/avg - LR: 100/18633/85/1386/186.33 | GB: 600100/98803735/0/20102/988037.35] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 107 [ msgs/total/min/max/avg - LR: 100/18284/81/2873/182.84 | GB: 600200/98822019/0/20102/988220.19] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17207]: benchmark (timer lock_test [0]): 106 [ msgs/total/min/max/avg - LR: 100/16327/83/747/163.27 | GB: 600300/98838346/0/20102/988383.46] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17204]: benchmark (timer lock_test [0]): 40 [ msgs/total/min/max/avg - LR: 100/16664/27/5093/166.64 | GB: 600400/98855010/0/20102/988550.10] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 43 [ msgs/total/min/max/avg - LR: 100/4938/26/222/49.38 | GB: 600500/98859948/0/20102/988599.48] FAST_LOCK Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2360]: benchmark (timer lock_test [0]): 159 [ msgs/total/min/max/avg - LR: 100/16685/78/380/166.85 | GB: 600600/347519878/0/137058/3475198.78] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 153 [ msgs/total/min/max/avg - LR: 100/24353/0/2216/243.53 | GB: 600700/347544231/0/137058/3475442.31] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2355]: benchmark (timer lock_test [0]): 95 [ msgs/total/min/max/avg - LR: 100/16816/75/465/168.16 | GB: 600800/347561047/0/137058/3475610.47] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2359]: benchmark (timer lock_test [0]): 131 [ msgs/total/min/max/avg - LR: 100/20270/81/3535/202.70 | GB: 600900/347581317/0/137058/3475813.17] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2346]: benchmark (timer lock_test [0]): 87 [ msgs/total/min/max/avg - LR: 100/17892/87/872/178.92 | GB: 601000/347599209/0/137058/3475992.09] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 178 [ msgs/total/min/max/avg - LR: 100/16425/81/354/164.25 | GB: 601100/347615634/0/137058/3476156.34] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2351]: benchmark (timer lock_test [0]): 45 [ msgs/total/min/max/avg - LR: 100/14298/0/1367/142.98 | GB:
[OpenSIPS-Devel] [ opensips-Patches-3564846 ] Linux futex support for locks
Patches item #3564846, was opened at 2012-09-04 16:33 Message generated for change (Comment added) made by rrb3942 You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=1086412aid=3564846group_id=232389 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: core Group: trunk Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ryan Bullock (rrb3942) Assigned to: Nobody/Anonymous (nobody) Summary: Linux futex support for locks Initial Comment: This patch adds the option for using futexs under Linux with FAST_LOCK. Implementation was taken from http://people.redhat.com/drepper/futex.pdf, and modified to add support for an Adaptive Wait loop in the case of a single waiter. Uses a modified version of the tsl() fuction from fastlock.h as an atomic xchg operation. It uses gcc builtins for atomic cmpxchg. To use futexes FAST_LOCK and USE_FUTEX must both be defined. Since the logic for using the futex is notably different than FAST_LOCK it is implemented separately in futex_lock.h, however we still require FAST_LOCK be defined to ensure support for the atomic_xchg. In my testing, using opensips in a virtual machine allocated 2 processors and using 16 children in a fairly pathological locking scenario this shows a large performance boost over just FAST_LOCK. Some Benchmark numbers after 5 minutes of runtime with sipp attempting 1000 CPS with 6 second durations: USE_FUTEX Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17196]: benchmark (timer lock_test [0]): 309 [ msgs/total/min/max/avg - LR: 100/14797/21/2049/147.97 | GB: 599600/98709250/0/20102/987092.50] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17202]: benchmark (timer lock_test [0]): 120 [ msgs/total/min/max/avg - LR: 100/15584/85/317/155.84 | GB: 599700/98724834/0/20102/987248.34] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17192]: benchmark (timer lock_test [0]): 150 [ msgs/total/min/max/avg - LR: 100/19241/86/4076/192.41 | GB: 599800/98744075/0/20102/987440.75] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 124 [ msgs/total/min/max/avg - LR: 100/22005/74/6166/220.05 | GB: 599900/98766080/0/20102/987660.80] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17206]: benchmark (timer lock_test [0]): 105 [ msgs/total/min/max/avg - LR: 100/19022/21/848/190.22 | GB: 60/98785102/0/20102/987851.02] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 155 [ msgs/total/min/max/avg - LR: 100/18633/85/1386/186.33 | GB: 600100/98803735/0/20102/988037.35] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 107 [ msgs/total/min/max/avg - LR: 100/18284/81/2873/182.84 | GB: 600200/98822019/0/20102/988220.19] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17207]: benchmark (timer lock_test [0]): 106 [ msgs/total/min/max/avg - LR: 100/16327/83/747/163.27 | GB: 600300/98838346/0/20102/988383.46] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17204]: benchmark (timer lock_test [0]): 40 [ msgs/total/min/max/avg - LR: 100/16664/27/5093/166.64 | GB: 600400/98855010/0/20102/988550.10] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 43 [ msgs/total/min/max/avg - LR: 100/4938/26/222/49.38 | GB: 600500/98859948/0/20102/988599.48] FAST_LOCK Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2360]: benchmark (timer lock_test [0]): 159 [ msgs/total/min/max/avg - LR: 100/16685/78/380/166.85 | GB: 600600/347519878/0/137058/3475198.78] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 153 [ msgs/total/min/max/avg - LR: 100/24353/0/2216/243.53 | GB: 600700/347544231/0/137058/3475442.31] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2355]: benchmark (timer lock_test [0]): 95 [ msgs/total/min/max/avg - LR: 100/16816/75/465/168.16 | GB: 600800/347561047/0/137058/3475610.47] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2359]: benchmark (timer lock_test [0]): 131 [ msgs/total/min/max/avg - LR: 100/20270/81/3535/202.70 | GB: 600900/347581317/0/137058/3475813.17] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2346]: benchmark (timer lock_test [0]): 87 [ msgs/total/min/max/avg - LR: 100/17892/87/872/178.92 | GB: 601000/347599209/0/137058/3475992.09] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 178 [ msgs/total/min/max/avg - LR: 100/16425/81/354/164.25 | GB: 601100/347615634/0/137058/3476156.34] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2351]: benchmark (timer lock_test [0]): 45 [ msgs/total/min/max/avg - LR: 100/14298/0/1367/142.98 | GB:
[OpenSIPS-Devel] [ opensips-Patches-3564846 ] Linux futex support for locks
Patches item #3564846, was opened at 2012-09-04 16:33 Message generated for change (Tracker Item Submitted) made by rrb3942 You can respond by visiting: https://sourceforge.net/tracker/?func=detailatid=1086412aid=3564846group_id=232389 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: core Group: trunk Status: Open Resolution: None Priority: 5 Private: No Submitted By: Ryan Bullock (rrb3942) Assigned to: Nobody/Anonymous (nobody) Summary: Linux futex support for locks Initial Comment: This patch adds the option for using futexs under Linux with FAST_LOCK. Implementation was taken from http://people.redhat.com/drepper/futex.pdf, and modified to add support for an Adaptive Wait loop in the case of a single waiter. Uses a modified version of the tsl() fuction from fastlock.h as an atomic xchg operation. It uses gcc builtins for atomic cmpxchg. To use futexes FAST_LOCK and USE_FUTEX must both be defined. Since the logic for using the futex is notably different than FAST_LOCK it is implemented separately in futex_lock.h, however we still require FAST_LOCK be defined to ensure support for the atomic_xchg. In my testing, using opensips in a virtual machine allocated 2 processors and using 16 children in a fairly pathological locking scenario this shows a large performance boost over just FAST_LOCK. Some Benchmark numbers after 5 minutes of runtime with sipp attempting 1000 CPS with 6 second durations: USE_FUTEX Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17196]: benchmark (timer lock_test [0]): 309 [ msgs/total/min/max/avg - LR: 100/14797/21/2049/147.97 | GB: 599600/98709250/0/20102/987092.50] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17202]: benchmark (timer lock_test [0]): 120 [ msgs/total/min/max/avg - LR: 100/15584/85/317/155.84 | GB: 599700/98724834/0/20102/987248.34] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17192]: benchmark (timer lock_test [0]): 150 [ msgs/total/min/max/avg - LR: 100/19241/86/4076/192.41 | GB: 599800/98744075/0/20102/987440.75] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 124 [ msgs/total/min/max/avg - LR: 100/22005/74/6166/220.05 | GB: 599900/98766080/0/20102/987660.80] Sep 4 15:06:00 labproxy /usr/local/sbin/opensips[17206]: benchmark (timer lock_test [0]): 105 [ msgs/total/min/max/avg - LR: 100/19022/21/848/190.22 | GB: 60/98785102/0/20102/987851.02] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 155 [ msgs/total/min/max/avg - LR: 100/18633/85/1386/186.33 | GB: 600100/98803735/0/20102/988037.35] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17203]: benchmark (timer lock_test [0]): 107 [ msgs/total/min/max/avg - LR: 100/18284/81/2873/182.84 | GB: 600200/98822019/0/20102/988220.19] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17207]: benchmark (timer lock_test [0]): 106 [ msgs/total/min/max/avg - LR: 100/16327/83/747/163.27 | GB: 600300/98838346/0/20102/988383.46] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17204]: benchmark (timer lock_test [0]): 40 [ msgs/total/min/max/avg - LR: 100/16664/27/5093/166.64 | GB: 600400/98855010/0/20102/988550.10] Sep 4 15:06:01 labproxy /usr/local/sbin/opensips[17205]: benchmark (timer lock_test [0]): 43 [ msgs/total/min/max/avg - LR: 100/4938/26/222/49.38 | GB: 600500/98859948/0/20102/988599.48] FAST_LOCK Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2360]: benchmark (timer lock_test [0]): 159 [ msgs/total/min/max/avg - LR: 100/16685/78/380/166.85 | GB: 600600/347519878/0/137058/3475198.78] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 153 [ msgs/total/min/max/avg - LR: 100/24353/0/2216/243.53 | GB: 600700/347544231/0/137058/3475442.31] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2355]: benchmark (timer lock_test [0]): 95 [ msgs/total/min/max/avg - LR: 100/16816/75/465/168.16 | GB: 600800/347561047/0/137058/3475610.47] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2359]: benchmark (timer lock_test [0]): 131 [ msgs/total/min/max/avg - LR: 100/20270/81/3535/202.70 | GB: 600900/347581317/0/137058/3475813.17] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2346]: benchmark (timer lock_test [0]): 87 [ msgs/total/min/max/avg - LR: 100/17892/87/872/178.92 | GB: 601000/347599209/0/137058/3475992.09] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2361]: benchmark (timer lock_test [0]): 178 [ msgs/total/min/max/avg - LR: 100/16425/81/354/164.25 | GB: 601100/347615634/0/137058/3476156.34] Sep 4 15:15:44 labproxy /usr/local/sbin/opensips[2351]: benchmark (timer lock_test [0]): 45 [ msgs/total/min/max/avg - LR: 100/14298/0/1367/142.98 | GB: