From: Rodriguez Betancourt, Esteban Date: Fri, 10 Jun 2016 16:35:09 +0000 (+0000) Subject: ovsdb: Strong references cascade performance fix. X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=4f94601a9aba0377dc5ec989f197227ac0c9863c;p=cascardo%2Fovs.git ovsdb: Strong references cascade performance fix. Improves the performance of OVSDB avoiding the chain reaction produced when modifing rows with a strong reference and the pointed rows have more strong references. The approach taken was using the change bitmap to avoid triggering a change count when the column hasn't changed. One way to trigger the issue is emulating a simple linked list with strong references within a table, where each new row points to the previous. Without the fix OVSDB creates a ovsdb_txn_row (and a copy of the row) for each row in the table. With the fix it only creates two ovsdb_txn_row: the new row and the directly pointed row. Signed-off-by: Esteban Rodriguez Betancourt Signed-off-by: Ben Pfaff --- diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c index 84ccfa3e7..9e12a6225 100644 --- a/ovsdb/transaction.c +++ b/ovsdb/transaction.c @@ -271,16 +271,18 @@ update_row_ref_count(struct ovsdb_txn *txn, struct ovsdb_txn_row *r) const struct ovsdb_column *column = node->data; struct ovsdb_error *error; - if (r->old) { - error = ovsdb_txn_adjust_row_refs(txn, r->old, column, -1); - if (error) { - return OVSDB_WRAP_BUG("error decreasing refcount", error); + if (bitmap_is_set(r->changed, column->index)) { + if (r->old) { + error = ovsdb_txn_adjust_row_refs(txn, r->old, column, -1); + if (error) { + return OVSDB_WRAP_BUG("error decreasing refcount", error); + } } - } - if (r->new) { - error = ovsdb_txn_adjust_row_refs(txn, r->new, column, 1); - if (error) { - return error; + if (r->new) { + error = ovsdb_txn_adjust_row_refs(txn, r->new, column, 1); + if (error) { + return error; + } } } }