Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 28: Code-Review+2 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 28 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has submitted this change and it was merged. Change subject: rwlock: Add simpler RWLock .. rwlock: Add simpler RWLock This is a rewrite of storage.misc.RWLock, simplifying it and making it easier to understand. The behavior of the lock should be the same, acquiring the lock in the order of the requests, and supporting recursive locking, required for old storage code locking the same resource from different layers. This implementation does not support lock demotion (replacing a write lock with a read lock). This feature was broken in the previous implementation. This implementation is using a list of waiters instead of a Queue, since we don't need any of the features provided by a Queue. Important property of a list is the possibility to remove a waiter from the middle of the list, in case of a timeout. This is used by future patch supporting timed acquire. This implementation has less overhead, as seen in the stress tests with many writers and readers. The test measure the number of times each thread could take a shared (readers) or exclusive (writers) lock during the test (1 second). Larger numbers mean more throughput. Tested on Lenovo T450s. storage_rwlock_test.RWLockStressTests test_lock_contention(1, 2, ) writers: 1 readers: 2 writes avg=5438.00 med=5438 min=5438 max=5438 reads avg=5449.50 med=5450 min=5449 max=5450 test_lock_contention(1, 2, ) writers: 1 readers: 2 writes avg=6574.00 med=6574 min=6574 max=6574 reads avg=6598.00 med=6625 min=6571 max=6625 test_lock_contention(2, 8, ) writers: 2 readers: 8 writes avg=1334.50 med=1335 min=1334 max=1335 reads avg=1334.50 med=1335 min=1334 max=1335 test_lock_contention(2, 8, ) writers: 2 readers: 8 writes avg=1504.50 med=1505 min=1504 max=1505 reads avg=1504.00 med=1504 min=1503 max=1507 test_lock_contention(3, 32, ) writers: 3 readers: 32 writes avg=386.00 med=386 min=386 max=386 reads avg=386.12 med=386 min=385 max=387 test_lock_contention(3, 32, ) writers: 3 readers: 32 writes avg=403.00 med=403 min=403 max=403 reads avg=403.50 med=403 min=403 max=408 test_lock_contention(4, 128, ) writers: 4 readers: 128 writes avg=101.00 med=101 min=101 max=101 reads avg=101.15 med=101 min=101 max=103 test_lock_contention(4, 128, ) writers: 4 readers: 128 writes avg=101.00 med=101 min=101 max=101 reads avg=101.93 med=102 min=101 max=108 test_readers(1, ) reads avg=47546.00 med=47546 min=47546 max=47546 test_readers(1, ) reads avg=170239.00 med=170239 min=170239 max=170239 test_readers(128, ) reads avg=136.00 med=135 min=134 max=167 test_readers(128, ) reads avg=361.10 med=332 min=330 max=1321 test_readers(16, ) reads avg=1125.75 med=1100 min=1096 max=1391 test_readers(16, ) reads avg=3070.19 med=2945 min=2803 max=3658 test_readers(2, ) reads avg=10040.50 med=10053 min=10028 max=10053 test_readers(2, ) reads avg=30227.50 med=31197 min=29258 max=31197 test_readers(32, ) reads avg=551.56 med=541 min=540 max=832 test_readers(32, ) reads avg=1480.53 med=1404 min=1401 max=2348 test_readers(4, ) reads avg=4708.25 med=4758 min=4583 max=4869 test_readers(4, ) reads avg=12305.25 med=12789 min=11618 max=13065 test_readers(64, ) reads avg=279.27 med=276 min=275 max=403 test_readers(64, ) reads avg=727.44 med=686 min=683 max=1747 test_readers(8, ) reads avg=2264.38 med=2230 min=2226 max=2471 test_readers(8, ) reads avg=6466.88 med=6520 min=5674 max=7277 To run this test, use: ./run_tests_local.sh --enable-stress-tests -s storage_rwlock_test.py:RWLockStressTests Change-Id: I2466c137c89598772fb46347eb02195916883cac Signed-off-by: Nir SofferReviewed-on: https://gerrit.ovirt.org/42908 Continuous-Integration: Jenkins CI Reviewed-by: Adam Litke --- M debian/vdsm-python.install M lib/vdsm/storage/Makefile.am A lib/vdsm/storage/rwlock.py M tests/Makefile.am R tests/storage_rwlock_test.py M vdsm.spec.in 6 files changed, 263 insertions(+), 93 deletions(-) Approvals: Adam Litke: Looks good to me, approved Nir Soffer: Verified Jenkins CI: Passed CI tests -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 29 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer Gerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 29: * Update tracker: IGNORE, no Bug-Url found * Set MODIFIED::IGNORE, no Bug-Url found. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 29 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 28: This version change the tests so we test both old and new implementations, so we can merge this code now before the next patch. The commit message was updated with the tests of both locks on newer machine. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 28 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 28: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 28 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 28: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 28 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 27: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 27 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 26: Code-Review+2 Copied score after rebase. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 26 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 26: Verified+1 Verified by the tests. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 26 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 26: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 26 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 25: This version move the new lock to lib/vdsm/storage, since this is a delicate storage only infrastructure. We will move it to lib/vdsm/common only if this is needed in other areas. The test was renamed to storage_rwlock_test.py to match the new location. There is no change in the code. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 25 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 25: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 25 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 25: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 25 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 24: Code-Review+2 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 24 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: (1 comment) https://gerrit.ovirt.org/#/c/42908/23//COMMIT_MSG Commit Message: Line 60: reads avg=323.72 med=324 min=323 max=325 Line 61: Line 62: writers: 4 readers: 128 Line 63: writes avg=82.00 med=82 min=82 max=82 Line 64: reads avg=83.23 med=83 min=82 max=89 > I agree, but this would complicate the code, and we don't have such perform Ok. I guess we don't want to change the balance of reads and writes with this patch. If we decide to do that in the future, this code will be much easier to modify. Line 65: Line 66: To run this test, use: Line 67: Line 68: ./run_tests_local.sh --enable-stress-tests rwlock_test.py:RWLockStressTests -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 24: Ping -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 24 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 24: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 24 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 24: Verified+1 This version updates the copyright years and improve the commit message, no code change. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 24 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: (4 comments) https://gerrit.ovirt.org/#/c/42908/23//COMMIT_MSG Commit Message: Line 23: supporting timed acquire. Line 24: Line 25: This implementation has less overhead, as seen in the fairness tests Line 26: with many writers and readers (tested on Lenovo T430s). Line 27: You could mention that larger numbers mean more throughput. Line 28: storage.misc.RWLock Line 29: --- Line 30: Line 31: writers: 1 readers: 2 Line 60: reads avg=323.72 med=324 min=323 max=325 Line 61: Line 62: writers: 4 readers: 128 Line 63: writes avg=82.00 med=82 min=82 max=82 Line 64: reads avg=83.23 med=83 min=82 max=89 I think the read throughput could be dramatically increased without degrading the write throughput much if you searched the waiters for multiple readers to grant at the same time. Line 65: Line 66: To run this test, use: Line 67: Line 68: ./run_tests_local.sh --enable-stress-tests rwlock_test.py:RWLockStressTests https://gerrit.ovirt.org/#/c/42908/23/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 1: # Line 2: # Copyright 2015 Red Hat, Inc. 2016 Line 3: # Line 4: # This program is free software; you can redistribute it and/or modify Line 5: # it under the terms of the GNU General Public License as published by Line 6: # the Free Software Foundation; either version 2 of the License, or Line 61: with lock.shared: Line 62: do stuff that require a shared lock.. Line 63: Line 64: When a thread is holding a read lock, other threads requesting a read lock Line 65: can acquire the lock. Other threads requesting a write lock will be blocked When a reader is granted the lock, do we want to search the waiters for other readers in order to grant them similtaneous access? I guess this could cause a fairness issue though. Line 66: until all the readers release their lock. Line 67: Line 68: If a reader try to acquire a read lock while other threads are waiting Line 69: (e.g. a writer), the reader is blocked until the waiting writer will get -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: This patch is safe since it doesn't actually change behavior of current code. It's just adding a new implementation. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: (4 comments) https://gerrit.ovirt.org/#/c/42908/23//COMMIT_MSG Commit Message: Line 23: supporting timed acquire. Line 24: Line 25: This implementation has less overhead, as seen in the fairness tests Line 26: with many writers and readers (tested on Lenovo T430s). Line 27: > You could mention that larger numbers mean more throughput. Will add that. Line 28: storage.misc.RWLock Line 29: --- Line 30: Line 31: writers: 1 readers: 2 Line 60: reads avg=323.72 med=324 min=323 max=325 Line 61: Line 62: writers: 4 readers: 128 Line 63: writes avg=82.00 med=82 min=82 max=82 Line 64: reads avg=83.23 med=83 min=82 max=89 > I think the read throughput could be dramatically increased without degradi I agree, but this would complicate the code, and we don't have such performance issue. Our operations are very slow (running subprocess, or sending request to another process and waiting for response), so the cost of waiting for the lock (couple of milliseconds) is insignificant. My goal is not to make this more efficient, but have simpler code that is easier to understand and maintain. Line 65: Line 66: To run this test, use: Line 67: Line 68: ./run_tests_local.sh --enable-stress-tests rwlock_test.py:RWLockStressTests https://gerrit.ovirt.org/#/c/42908/23/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 1: # Line 2: # Copyright 2015 Red Hat, Inc. > 2016 Will update Line 3: # Line 4: # This program is free software; you can redistribute it and/or modify Line 5: # it under the terms of the GNU General Public License as published by Line 6: # the Free Software Foundation; either version 2 of the License, or Line 61: with lock.shared: Line 62: do stuff that require a shared lock.. Line 63: Line 64: When a thread is holding a read lock, other threads requesting a read lock Line 65: can acquire the lock. Other threads requesting a write lock will be blocked > When a reader is granted the lock, do we want to search the waiters for oth Yes, we can wake all the readers up to the first writer together. They will wake up and take the lock in random order. So this will effect fairness, and will not improve throughput. To improve throughput we want to take the lock, wakeup all all the readers up to the first writer, and release the lock. Do you see a simple way to do this? Line 66: until all the readers release their lock. Line 67: Line 68: If a reader try to acquire a read lock while other threads are waiting Line 69: (e.g. a writer), the reader is blocked until the waiting writer will get -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: This is just a rebase and fix a typo a comment in the tests. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 23: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 23 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Yaniv Bronhaim has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: (4 comments) https://gerrit.ovirt.org/#/c/42908/22//COMMIT_MSG Commit Message: Line 29: --- Line 30: Line 31: writers: 1 readers: 2 Line 32: writes avg=3381.00 med=3381 min=3381 max=3381 Line 33: reads avg=3367.00 med=3376 min=3358 max=3376 > what those numbers mean? average/median/mininum/maximum number of times a lock was taken by readers or by writers during a test. This is the output of the RWLockStressTests results, running with different number of readers and writers. Higher numbers means the lock is more efficient. Line 34: Line 35: writers: 2 readers: 8 Line 36: writes avg=945.00 med=945 min=945 max=945 Line 37: reads avg=937.38 med=938 min=933 max=940 https://gerrit.ovirt.org/#/c/42908/22/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 85: Line 86: def acquire_write(self): Line 87: me = threading.current_thread() Line 88: if me is self._writer: Line 89: self._holders[me] += 1 > this for the recursive lock I guess Yes Line 90: return Line 91: if me in self._holders: Line 92: raise RuntimeError("Lock promotion is forbidden") Line 93: with self._lock: Line 107: if self._writer or self._waiters: Line 108: self._wait(False) Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._grant_next_waiter() > can't it cause a race? set the event while same holder can acquire the lock Can you describe the flow that may be racy? At this point, the current thread is holding self._lock. No other thread can access this object, except another reader that already hold this lock. The waiter list may have other threads waiting to take a read or write lock. grant_next_waiter will wake up the next reader thread, and it will return from self._wait(), take a read lock and wake up the next waiter. Line 112: Line 113: def release(self): Line 114: me = threading.current_thread() Line 115: if me not in self._holders: Line 108: self._wait(False) Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._grant_next_waiter() Line 112: > and after this scope you release _lock as its under context. the lock shoul No, the lock is protecting the rwlock internals. Both readers and writers take this lock for very short time, marking the rwlock as "locked" for reading or writing. The actual waiting on the lock (e.g. acquire_read() when a writer is holding the rwlock) is implemented using a list of Waiter objects. Line 113: def release(self): Line 114: me = threading.current_thread() Line 115: if me not in self._holders: Line 116: raise RuntimeError("Thread %s attempted to release a lock it " -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Yaniv Bronhaim has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: (4 comments) https://gerrit.ovirt.org/#/c/42908/22//COMMIT_MSG Commit Message: Line 29: --- Line 30: Line 31: writers: 1 readers: 2 Line 32: writes avg=3381.00 med=3381 min=3381 max=3381 Line 33: reads avg=3367.00 med=3376 min=3358 max=3376 what those numbers mean? Line 34: Line 35: writers: 2 readers: 8 Line 36: writes avg=945.00 med=945 min=945 max=945 Line 37: reads avg=937.38 med=938 min=933 max=940 https://gerrit.ovirt.org/#/c/42908/22/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 85: Line 86: def acquire_write(self): Line 87: me = threading.current_thread() Line 88: if me is self._writer: Line 89: self._holders[me] += 1 this for the recursive lock I guess Line 90: return Line 91: if me in self._holders: Line 92: raise RuntimeError("Lock promotion is forbidden") Line 93: with self._lock: Line 107: if self._writer or self._waiters: Line 108: self._wait(False) Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._grant_next_waiter() can't it cause a race? set the event while same holder can acquire the lock again Line 112: Line 113: def release(self): Line 114: me = threading.current_thread() Line 115: if me not in self._holders: Line 108: self._wait(False) Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._grant_next_waiter() Line 112: and after this scope you release _lock as its under context. the lock should hold. no? Line 113: def release(self): Line 114: me = threading.current_thread() Line 115: if me not in self._holders: Line 116: raise RuntimeError("Thread %s attempted to release a lock it " -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Ido Barkan has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
gerrit-hooks has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 22: * Update tracker: IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.6', 'ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 22 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: gerrit-hooks Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 21: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 21 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 21: Verified+1 This version refine the internal apis. Instead of wakeup(), we use grant(), since the purpose of this method to grant the lock to the waiter thread. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 21 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir SofferGerrit-Reviewer: Adam Litke Gerrit-Reviewer: Ala Hino Gerrit-Reviewer: Allon Mureinik Gerrit-Reviewer: Dan Kenigsberg Gerrit-Reviewer: Dima Kuznetsov Gerrit-Reviewer: Federico Simoncelli Gerrit-Reviewer: Francesco Romani Gerrit-Reviewer: Freddy Rolland Gerrit-Reviewer: Ido Barkan Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer Gerrit-Reviewer: Yaniv Bronhaim Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 20: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 20 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 19: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 19 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 18: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 18 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: (5 comments) https://gerrit.ovirt.org/#/c/42908/16/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 39: lock.release() Line 40: Line 41: If possible, use the RWLock.exclusive contextmanager: Line 42: Line 43: with lock.exclusive: the syntax is not symmetric. 'acquire_write' vs. 'exclusive'. while it is s This is out of the scope of this effort. I'm intentionally keeping the api as is (except using pep8 style function names). Line 44: do stuff that require an exclusive lock.. Line 45: Line 46: When a thread is holding a write lock, other threads requesting a write or Line 47: read lock will be blocked. When you release the write lock, the waiting Line 91: if me in self._holders: Line 92: raise RuntimeError(Lock promotion is forbidden) Line 93: with self._lock: Line 94: if self._holders or self._waiters: Line 95: self._wait(True) can you name the parameter? it makes it read beeter See bellow. Line 96: self._holders[me] = 1 Line 97: self._writer = me Line 98: Line 99: def acquire_read(self): Line 104: self._holders[me] += 1 Line 105: return Line 106: with self._lock: Line 107: if self._writer or self._waiters: Line 108: self._wait(False) can you name the parameter? it makes it read beeter wants_write is positional parameter. Calling with as kwarg parameter is confusing and fragile. The name of a positional argument does not matter, and can be safely changed without affecting the callers, unless the callers are using kwargs call style. I intentionally not using kwarg parameter since wants_write should not have a default. Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._wakeup_next_waiter() Line 112: Line 135: self._lock.acquire() Line 136: finally: Line 137: self._waiters.remove(waiter) Line 138: Line 139: def _wakeup_next_waiter(self): wake_up wakeup is nicer. Line 140: if self._holders and self._waiters[0].wants_write: Line 141: return Line 142: self._waiters[0].wakeup() Line 143: Line 150: Line 151: def wait(self): Line 152: self._event.wait() Line 153: Line 154: def wakeup(self): wake_up wakeup is nicer. Line 155: self._event.set() Line 156: Line 157: Line 158: class Context(object): -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: (1 comment) https://gerrit.ovirt.org/#/c/42908/16/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 135: self._lock.acquire() Line 136: finally: Line 137: self._waiters.remove(waiter) Line 138: Line 139: def _wakeup_next_waiter(self): but a typo I'll think about different naming that avoid this issue. Line 140: if self._holders and self._waiters[0].wants_write: Line 141: return Line 142: self._waiters[0].wakeup() Line 143: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 17: Code-Review-1 Replace wakeup with other term so we can avoid using wake_up. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 17 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Ido Barkan has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: (3 comments) https://gerrit.ovirt.org/#/c/42908/16/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 39: lock.release() Line 40: Line 41: If possible, use the RWLock.exclusive contextmanager: Line 42: Line 43: with lock.exclusive: This is out of the scope of this effort. I'm intentionally keeping the api ok Line 44: do stuff that require an exclusive lock.. Line 45: Line 46: When a thread is holding a write lock, other threads requesting a write or Line 47: read lock will be blocked. When you release the write lock, the waiting Line 104: self._holders[me] += 1 Line 105: return Line 106: with self._lock: Line 107: if self._writer or self._waiters: Line 108: self._wait(False) wants_write is positional parameter. Calling with as kwarg parameter is con ok Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._wakeup_next_waiter() Line 112: Line 135: self._lock.acquire() Line 136: finally: Line 137: self._waiters.remove(waiter) Line 138: Line 139: def _wakeup_next_waiter(self): wakeup is nicer. but a typo Line 140: if self._holders and self._waiters[0].wants_write: Line 141: return Line 142: self._waiters[0].wakeup() Line 143: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 17: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 17 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Ido Barkan has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: (5 comments) https://gerrit.ovirt.org/#/c/42908/16/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 39: lock.release() Line 40: Line 41: If possible, use the RWLock.exclusive contextmanager: Line 42: Line 43: with lock.exclusive: the syntax is not symmetric. 'acquire_write' vs. 'exclusive'. while it is similar to the old API, I suggest making the verbs similar. Line 44: do stuff that require an exclusive lock.. Line 45: Line 46: When a thread is holding a write lock, other threads requesting a write or Line 47: read lock will be blocked. When you release the write lock, the waiting Line 91: if me in self._holders: Line 92: raise RuntimeError(Lock promotion is forbidden) Line 93: with self._lock: Line 94: if self._holders or self._waiters: Line 95: self._wait(True) can you name the parameter? it makes it read beeter Line 96: self._holders[me] = 1 Line 97: self._writer = me Line 98: Line 99: def acquire_read(self): Line 104: self._holders[me] += 1 Line 105: return Line 106: with self._lock: Line 107: if self._writer or self._waiters: Line 108: self._wait(False) can you name the parameter? it makes it read beeter Line 109: self._holders[me] = 1 Line 110: if self._waiters: Line 111: self._wakeup_next_waiter() Line 112: Line 135: self._lock.acquire() Line 136: finally: Line 137: self._waiters.remove(waiter) Line 138: Line 139: def _wakeup_next_waiter(self): wake_up Line 140: if self._holders and self._waiters[0].wants_write: Line 141: return Line 142: self._waiters[0].wakeup() Line 143: Line 150: Line 151: def wait(self): Line 152: self._event.wait() Line 153: Line 154: def wakeup(self): wake_up Line 155: self._event.set() Line 156: Line 157: Line 158: class Context(object): -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Ido Barkan ibar...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: This version adds recursive locking, since testing vdsm with old lock show that we do use this feature (for example, when creating a template). -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 16: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 16 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 15: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 15 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Francesco Romani has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 13: Code-Review+1 nicer indeed! -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 14: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 14 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 14: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 14 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Francesco Romani has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 10: Code-Review+1 (3 comments) looks ok and looks nice. Comments inside about possible very minor improvements. https://gerrit.ovirt.org/#/c/42908/10/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 28: Line 29: This lock is not prefering writers or readers. Each acquire request is put Line 30: into a queue, and will be served in the order of the request. Line 31: Line 32: To acquire a write lock, use acquire_write(), followed by relase() when you typo: release Line 33: are done. Line 34: Line 35: lock.acquire_write() Line 36: Line 75: Lock promotion or demotion is forbidden and will raise RuntimeError. Line 76: Line 77: Line 78: def __init__(self): Line 79: self.shared = Context(self, False) very minor: perhaps using an (unneeded) named argument makes the code a tiny bit nicer: self.shared = Context(self, exclusive=False) self.exclusive = Context(self, exclusive=True) OTOH, the repetition of exclusive can be ugly? Line 80: self.exclusive = Context(self, True) Line 81: self._lock = threading.Lock() Line 82: self._waiters = [] Line 83: self._readers = set() Line 90: if me is self._writer: Line 91: raise RuntimeError(Recursive lock is forbidden) Line 92: with self._lock: Line 93: if self._writer or self._readers or self._waiters: Line 94: self._wait(True) same (and below on line 105). Maybe self._wait(wants_write=True) or maybe too verbose? Line 95: self._writer = me Line 96: Line 97: def acquire_read(self): Line 98: me = threading.current_thread() -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 11: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 11 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 12: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 12 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 10: (1 comment) https://gerrit.ovirt.org/#/c/42908/10/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 75: Lock promotion or demotion is forbidden and will raise RuntimeError. Line 76: Line 77: Line 78: def __init__(self): Line 79: self.shared = Context(self, False) This is little more clear, but I don't like to call positional arguments in New version make this code much more clear using another way. Line 80: self.exclusive = Context(self, True) Line 81: self._lock = threading.Lock() Line 82: self._waiters = [] Line 83: self._readers = set() -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 10: (3 comments) https://gerrit.ovirt.org/#/c/42908/10/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 28: Line 29: This lock is not prefering writers or readers. Each acquire request is put Line 30: into a queue, and will be served in the order of the request. Line 31: Line 32: To acquire a write lock, use acquire_write(), followed by relase() when you typo: release Done Line 33: are done. Line 34: Line 35: lock.acquire_write() Line 36: Line 75: Lock promotion or demotion is forbidden and will raise RuntimeError. Line 76: Line 77: Line 78: def __init__(self): Line 79: self.shared = Context(self, False) very minor: perhaps using an (unneeded) named argument makes the code a tin This is little more clear, but I don't like to call positional arguments in kwargs calling style, and I don't like to make exclusive a kwarg, since it should not have a default. I'll keep the code as is for now. Line 80: self.exclusive = Context(self, True) Line 81: self._lock = threading.Lock() Line 82: self._waiters = [] Line 83: self._readers = set() Line 90: if me is self._writer: Line 91: raise RuntimeError(Recursive lock is forbidden) Line 92: with self._lock: Line 93: if self._writer or self._readers or self._waiters: Line 94: self._wait(True) same (and below on line 105). Maybe Same issue with calling positional args as kwargs. Line 95: self._writer = me Line 96: Line 97: def acquire_read(self): Line 98: me = threading.current_thread() -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 12: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 12 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 13: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 13: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 13: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 13: -Code-Review -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 13 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Francesco Romani from...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 7: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 7: This version add support for lock promotion demotion and recursive locking. I think that all of the above are not used by current code, so the current implementation is raising RuntimeError. This version also add the missing documentation. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 8 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 9: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 9 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 7: Next step: validate the current code does not use recursive locking or demotion. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 7 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 9: Verified+1 -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 9 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 10: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 10 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Dima Kuznetsov has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 6: Code-Review+1 (1 comment) https://gerrit.ovirt.org/#/c/42908/6/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 43: if self._writer or self._waiters: Line 44: self._wait(False) Line 45: self._readers.add(threading.current_thread()) Line 46: if self._waiters: Line 47: self._wakeup_next_waiter() +1 Line 48: Line 49: def release(self): Line 50: me = threading.current_thread() Line 51: with self._lock: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 5: This version fixes waking up of readers when a reader take a read lock. Now all readers are woke up in the same time. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 5: This version also change methods lowercase - this is not compatible with misc.RWLock, but all code is using the lock.shared and lock.exclusive context managers. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 5: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 5 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 6: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 6 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Dima Kuznetsov has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 4: (2 comments) https://gerrit.ovirt.org/#/c/42908/4/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 31: self._waiters = [] Line 32: self._readers = set() Line 33: self._writer = None Line 34: Line 35: def acquireWrite(self): Can we have pep8 method names? Line 36: with self._lock: Line 37: if self._writer or self._readers or self._waiters: Line 38: self._wait(True) Line 39: self._writer = threading.current_thread() Line 73: self._lock.acquire() Line 74: finally: Line 75: self._waiters.remove(waiter) Line 76: Line 77: def _wakeup_waiter(self): Does this wake up all queued readers after write unlock? Line 78: if self._readers and self._waiters[0].wants_write: Line 79: return Line 80: self._waiters[0].wakeup() Line 81: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 4: (2 comments) https://gerrit.ovirt.org/#/c/42908/4/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 31: self._waiters = [] Line 32: self._readers = set() Line 33: self._writer = None Line 34: Line 35: def acquireWrite(self): Can we have pep8 method names? I'm tried to keep compatibility with misc.RWLock, so this can version can replace the old one. But it seems that nobody is calling the old code acquireRead and acquireWrite - only shared and exclusive context managers are used in the current code. So I will change the api to pep8 style. Line 36: with self._lock: Line 37: if self._writer or self._readers or self._waiters: Line 38: self._wait(True) Line 39: self._writer = threading.current_thread() Line 73: self._lock.acquire() Line 74: finally: Line 75: self._waiters.remove(waiter) Line 76: Line 77: def _wakeup_waiter(self): Does this wake up all queued readers after write unlock? This wakes up exactly one waiter, the one that got first in the queue. If there are multiple readers, each will wake up the next. But it looks like that a reader will wake up the next reader when releasing the read lock, instead of when taking the read lock. I will add another test for this. Line 78: if self._readers and self._waiters[0].wants_write: Line 79: return Line 80: self._waiters[0].wakeup() Line 81: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 4: Code-Review-1 - Fix reader wakeup - Make this compatible with older misc.RWLock -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 4: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 4 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Adam Litke has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 3: (1 comment) https://gerrit.ovirt.org/#/c/42908/3/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 83: class Waiter(object): Line 84: Line 85: def __init__(self, wants_write): Line 86: self.wants_write = wants_write Line 87: self._event = threading.Event() Why not have all threads wait on a single condition variable? Line 88: Line 89: def wait(self): Line 90: self._event.wait() Line 91: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 3: (1 comment) https://gerrit.ovirt.org/#/c/42908/3/lib/vdsm/rwlock.py File lib/vdsm/rwlock.py: Line 83: class Waiter(object): Line 84: Line 85: def __init__(self, wants_write): Line 86: self.wants_write = wants_write Line 87: self._event = threading.Event() Why not have all threads wait on a single condition variable? Because you cannot control which thread will wake up. This implementation wakes the first thread in waiters queue (self._waiters[0]). This seems to the be the behavior in misc.RWLock. I like the fairness and predictability so I kept this behavior. If you think that we don't need this behavior, we can simplify using a single condition. Line 88: Line 89: def wait(self): Line 90: self._event.wait() Line 91: -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: Yes ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 2: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
Nir Soffer has uploaded a new change for review. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. rwlock: Add simpler RWLock supporting acquire timeout We have RWLock implementation in storage.misc, used for by the resource manager. We want to simplify the resource manager, which is way too complex to understand or maintain. Patch https://gerrit.ovirt.org/42773 suggests to add a non-blocking acquire to the current RWLock, needed for the new simple lock manager. However, adding more code to the current RWLock is not a good idea. Instead, this patch replace the current implementation with a simpler one. This implementation does not support recursive locking; I'm not sure we need this, and usually having a recursive lock is a design smell. We will add it later only if required. Change-Id: I2466c137c89598772fb46347eb02195916883cac Signed-off-by: Nir Soffer nsof...@redhat.com --- M debian/vdsm-python.install M lib/vdsm/Makefile.am A lib/vdsm/rwlock.py M tests/rwlock_test.py M vdsm.spec.in 5 files changed, 95 insertions(+), 1 deletion(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/08/42908/1 diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install index 57d5033..3047d9f 100644 --- a/debian/vdsm-python.install +++ b/debian/vdsm-python.install @@ -28,6 +28,7 @@ ./usr/lib/python2.7/dist-packages/vdsm/pthread.py ./usr/lib/python2.7/dist-packages/vdsm/qemuimg.py ./usr/lib/python2.7/dist-packages/vdsm/response.py +./usr/lib/python2.7/dist-packages/vdsm/rwlock.py ./usr/lib/python2.7/dist-packages/vdsm/schedule.py ./usr/lib/python2.7/dist-packages/vdsm/sslutils.py ./usr/lib/python2.7/dist-packages/vdsm/tool/__init__.py diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am index 95e236f..45cef02 100644 --- a/lib/vdsm/Makefile.am +++ b/lib/vdsm/Makefile.am @@ -38,6 +38,7 @@ pthread.py \ qemuimg.py \ response.py \ + rwlock.py \ schedule.py \ sslutils.py \ sysctl.py \ diff --git a/lib/vdsm/rwlock.py b/lib/vdsm/rwlock.py new file mode 100644 index 000..900d91d --- /dev/null +++ b/lib/vdsm/rwlock.py @@ -0,0 +1,91 @@ +# +# Copyright 2015 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +# +# Refer to the README and COPYING files for full details of the license +# + +from __future__ import absolute_import +import threading + + +class RWLock(object): + +def __init__(self): +self._lock = threading.Lock() +self._waiters = [] +self._readers = set() +self._writer = None + +def acquireWrite(self): +with self._lock: +if self._writer or self._readers or self._waiters: +self._wait(True) +self._writer = threading.current_thread() + +def acquireRead(self): +with self._lock: +if self._writer or self._waiters: +self._wait(False) +self._readers.add(threading.current_thread()) + +def release(self): +me = threading.current_thread() +with self._lock: +if self._writer: +if self._writer is not me: +raise RuntimeError(Thread %s attempted to release a + write lock held by thread %s + % (me, self._writer)) +self._writer = None +else: +if me not in self._readers: +raise RuntimeError(Thread %s attempted to release a + read lock it does not hold + % (me,)) +self._readers.remove(me) +if self._waiters: +self._wakeup_waiter() + +def _wait(self, wants_write): +waiter = Waiter(wants_write) +self._waiters.append(waiter) +try: +self._lock.release() +try: +waiter.wait() +finally: +self._lock.acquire() +finally: +self._waiters.remove(waiter) + +def _wakeup_waiter(self): +if self._readers and self._waiters[0].wants_write: +return +self._waiters[0].wakeup() + + +class Waiter(object): + +def
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Patch Set 1: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Patch Set 2: * Update tracker::IGNORE, no Bug-Url found -- To view, visit https://gerrit.ovirt.org/42849 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
Nir Soffer has abandoned this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Abandoned Replaced by the rwlock topic -- To view, visit https://gerrit.ovirt.org/42849 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: abandon Gerrit-Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 2: To replace RWLock, we need to implement shared and exclusive context managers used for all locking operations in resourceManager.py. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 3: This version implements the shared and exclusive context managers. These are the only interface used by resourceManager. Verified by the tests. -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock .. Patch Set 3: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42908 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2466c137c89598772fb46347eb02195916883cac Gerrit-PatchSet: 3 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Ala Hino ah...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Dima Kuznetsov dkuzn...@redhat.com Gerrit-Reviewer: Federico Simoncelli fsimo...@redhat.com Gerrit-Reviewer: Freddy Rolland froll...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
Nir Soffer has uploaded a new change for review. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. rwlock: Add simpler RWLock supporting acquire timeout We have RWLock implementation in storage.misc, used for by the resource manager. We want to simplify the resource manager, which is way too complex to understand or maintain. Patch https://gerrit.ovirt.org/42773 suggests to add a non-blocking acquire to the current RWLock, needed for the new simple lock manager. However, adding more code to the current RWLock is not a good idea. Instead, this patch replace the current implementation with a simpler one. Differences from the current RWLock: - Support acquire timeout - with timeout=0, can be used to implement non-blocking acquire. With bigger timeout, make it easy to fail a request after some timeout, instead of leaving a blocked thread forever. - Recursive lock not supported - I'm not sure we need this support, and usually having a recursive lock is a design smell. We will add it later only if required. - 100% test coverage (previously 0%) Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Signed-off-by: Nir Soffer nsof...@redhat.com --- M debian/vdsm-python.install M lib/vdsm/Makefile.am A lib/vdsm/rwlock.py M tests/Makefile.am A tests/rwlock_test.py M vdsm.spec.in 6 files changed, 316 insertions(+), 0 deletions(-) git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/49/42849/1 diff --git a/debian/vdsm-python.install b/debian/vdsm-python.install index 57d5033..3047d9f 100644 --- a/debian/vdsm-python.install +++ b/debian/vdsm-python.install @@ -28,6 +28,7 @@ ./usr/lib/python2.7/dist-packages/vdsm/pthread.py ./usr/lib/python2.7/dist-packages/vdsm/qemuimg.py ./usr/lib/python2.7/dist-packages/vdsm/response.py +./usr/lib/python2.7/dist-packages/vdsm/rwlock.py ./usr/lib/python2.7/dist-packages/vdsm/schedule.py ./usr/lib/python2.7/dist-packages/vdsm/sslutils.py ./usr/lib/python2.7/dist-packages/vdsm/tool/__init__.py diff --git a/lib/vdsm/Makefile.am b/lib/vdsm/Makefile.am index 95e236f..45cef02 100644 --- a/lib/vdsm/Makefile.am +++ b/lib/vdsm/Makefile.am @@ -38,6 +38,7 @@ pthread.py \ qemuimg.py \ response.py \ + rwlock.py \ schedule.py \ sslutils.py \ sysctl.py \ diff --git a/lib/vdsm/rwlock.py b/lib/vdsm/rwlock.py new file mode 100644 index 000..0e9b9ec --- /dev/null +++ b/lib/vdsm/rwlock.py @@ -0,0 +1,75 @@ +import threading + + +class Timeout(Exception): +pass + + +class RWLock(object): + +def __init__(self): +self._lock = threading.Lock() +self._waiters = [] +self._readers = set() +self._writer = None + +def acquire_read(self, timeout=None): +with self._lock: +if self._writer or self._waiters: +self._wait(timeout, False) +self._readers.add(threading.current_thread()) + +def acquire_write(self, timeout=None): +with self._lock: +if self._writer or self._readers or self._waiters: +self._wait(timeout, True) +self._writer = threading.current_thread() + +def release(self): +me = threading.current_thread() +with self._lock: +if self._writer: +if self._writer is not me: +raise AssertionError(Thread %s attempted to release a + write lock held by thread %s + % (me, self._writer)) +self._writer = None +else: +if me not in self._readers: +raise AssertionError(Thread %s attempted to release a + read lock it does not hold + % (me,)) +self._readers.remove(me) +if self._waiters: +self._wakeup_waiter() + +def _wait(self, timeout, wants_write): +waiter = Waiter(wants_write) +self._waiters.append(waiter) +try: +self._lock.release() +try: +waiter.wait(timeout) +finally: +self._lock.acquire() +finally: +self._waiters.remove(waiter) + +def _wakeup_waiter(self): +if self._readers and self._waiters[0].wants_write: +return +self._waiters[0].wakeup() + + +class Waiter(object): + +def __init__(self, wants_write): +self.wants_write = wants_write +self._event = threading.Event() + +def wait(self, timeout): +if not self._event.wait(timeout): +raise Timeout() + +def wakeup(self): +self._event.set() diff --git a/tests/Makefile.am b/tests/Makefile.am index 39154c8..5128e87 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,6 +87,7 @@ remoteFileHandlerTests.py \
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Patch Set 1: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42849 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Gerrit-PatchSet: 1 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
automat...@ovirt.org has posted comments on this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Patch Set 2: * Update tracker::IGNORE, no Bug-Url found * Check Bug-Url::WARN, no bug url found, make sure header matches 'Bug-Url: ' and is a valid url. * Check merged to previous::IGNORE, Not in stable branch (['ovirt-3.5', 'ovirt-3.4', 'ovirt-3.3']) -- To view, visit https://gerrit.ovirt.org/42849 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches
Change in vdsm[master]: rwlock: Add simpler RWLock supporting acquire timeout
Nir Soffer has posted comments on this change. Change subject: rwlock: Add simpler RWLock supporting acquire timeout .. Patch Set 2: This version adds missing license and absolute_import import. -- To view, visit https://gerrit.ovirt.org/42849 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I87d0ad33c9d8bf8b93a1ce9a9fed86a4affef089 Gerrit-PatchSet: 2 Gerrit-Project: vdsm Gerrit-Branch: master Gerrit-Owner: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Adam Litke ali...@redhat.com Gerrit-Reviewer: Allon Mureinik amure...@redhat.com Gerrit-Reviewer: Dan Kenigsberg dan...@redhat.com Gerrit-Reviewer: Jenkins CI Gerrit-Reviewer: Nir Soffer nsof...@redhat.com Gerrit-Reviewer: Yaniv Bronhaim ybron...@redhat.com Gerrit-Reviewer: automat...@ovirt.org Gerrit-HasComments: No ___ vdsm-patches mailing list vdsm-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches