Andrey Kuzmin
2010-Apr-16 09:55 UTC
[zfs-code] Excess db_mtx unlock/lock in dbuf_read_done
Since dbuf_rele acquires db_mtx just to call dbuf_rele_and_unlock, unlock in dbuf_read_done seems to be excessive. Suggested fix is trivial: - 481 mutex_exit(&db->db_mtx); - 482 dbuf_rele(db, NULL); + 482 dbuf_rele_and_unlock(db, NULL); 483 } 450 static void 451 dbuf_read_done(zio_t *zio, arc_buf_t *buf, void *vdb) 452 { 453 dmu_buf_impl_t *db = vdb; 454 455 mutex_enter(&db->db_mtx); ... 480 cv_broadcast(&db->db_changed); 481 mutex_exit(&db->db_mtx); 482 dbuf_rele(db, NULL); 483 } 1883 dbuf_rele(dmu_buf_impl_t *db, void *tag) 1884 { 1885 mutex_enter(&db->db_mtx); 1886 dbuf_rele_and_unlock(db, tag); 1887 } Regards, Andrey
Andrey, Thanks for noticing this. I''ve just filed the following bug to get it fixed: 6944623 dbuf_read_done() locking performance improvement Neil. On 04/16/10 03:55, Andrey Kuzmin wrote:> Since dbuf_rele acquires db_mtx just to call dbuf_rele_and_unlock, > unlock in dbuf_read_done seems to be excessive. Suggested fix is > trivial: > > - 481 mutex_exit(&db->db_mtx); > - 482 dbuf_rele(db, NULL); > + 482 dbuf_rele_and_unlock(db, NULL); > 483 } > > > 450 static void > 451 dbuf_read_done(zio_t *zio, arc_buf_t *buf, void *vdb) > 452 { > 453 dmu_buf_impl_t *db = vdb; > 454 > 455 mutex_enter(&db->db_mtx); > ... > 480 cv_broadcast(&db->db_changed); > 481 mutex_exit(&db->db_mtx); > 482 dbuf_rele(db, NULL); > 483 } > > 1883 dbuf_rele(dmu_buf_impl_t *db, void *tag) > 1884 { > 1885 mutex_enter(&db->db_mtx); > 1886 dbuf_rele_and_unlock(db, tag); > 1887 } > > Regards, > Andrey > _______________________________________________ > zfs-code mailing list > zfs-code at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-code >