summaryrefslogtreecommitdiffstats
path: root/lib/tdb/common/tdb_private.h
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2014-03-18 08:04:42 +0100
committerMichael Adam <obnox@samba.org>2014-03-18 13:42:10 +0100
commit3034a5a62b8eaac7bdc52bfb7af1beb29e888b34 (patch)
treea45c3019d6e2d34f898332bc623b4a5d38602266 /lib/tdb/common/tdb_private.h
parent1461362e936e5beebeaae1555cf96f6731287c35 (diff)
downloadsamba-3034a5a62b8eaac7bdc52bfb7af1beb29e888b34.tar.gz
samba-3034a5a62b8eaac7bdc52bfb7af1beb29e888b34.tar.xz
samba-3034a5a62b8eaac7bdc52bfb7af1beb29e888b34.zip
tdb: Reduce freelist contention
In a metadata-intensive benchmark we have seen the locking.tdb freelist to be one of the central contention points. This patch removes most of the contention on the freelist. Ages ago we already reduced freelist contention by using the even much older DEAD records: If TDB_VOLATILE is set, don't directly put deleted records on the freelist, but just mark a few of them just as DEAD. The next new record can them re-use that space without consulting the freelist. This patch builds upon the DEAD records: If we need space and the freelist is busy, instead of doing a blocking wait on the freelist, start looking into other chains for DEAD records and steal them from there. This way every hash chain becomes a small freelist. Just wander around the hash chains as long as the freelist is still busy. With this patch and the tdb mutex patch (following hopefully some time soon) you can see a heavily busy clustered smbd run without locking.tdb futex syscalls. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/tdb/common/tdb_private.h')
-rw-r--r--lib/tdb/common/tdb_private.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tdb/common/tdb_private.h b/lib/tdb/common/tdb_private.h
index f62c0a3a6f..a672159578 100644
--- a/lib/tdb/common/tdb_private.h
+++ b/lib/tdb/common/tdb_private.h
@@ -255,7 +255,8 @@ int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
void *tdb_convert(void *buf, uint32_t size);
int tdb_free(struct tdb_context *tdb, tdb_off_t offset, struct tdb_record *rec);
-tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct tdb_record *rec);
+tdb_off_t tdb_allocate(struct tdb_context *tdb, int hash, tdb_len_t length,
+ struct tdb_record *rec);
int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d);
int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off);