dlm: replace lkb hash table with idr
David Teigland
maintainerRequest for testing
I'm looking at possible improvements to the dlm hash tables. This patch keeps lkbs in an idr instead of a hash table. Before pushing this patch further, I'd like to know if it makes any difference in environments using millions of locks on each node.
From: David Teigland <[email protected]>
Date: Tue, 5 Jul 2011 17:58:26 -0500
Subject: [PATCH] dlm: keep lkbs in idr
Instead of strange hash table.
Signed-off-by David Teigland <[email protected]>
--- fs/dlm/config.c | 7 --- fs/dlm/config.h | 1 - fs/dlm/dlm_internal.h | 14 ++---- fs/dlm/lock.c | 69 ++++++++++------------------- fs/dlm/lockspace.c | 114 +++++++++++++++++++++++-------------------------- 5 files changed, 81 insertions(+), 124 deletions(-)
fs/dlm/config.c +0 -7
@@ -92,7 +92,6 @@ struct dlm_cluster {unsigned int cl_tcp_port;unsigned int cl_buffer_size;unsigned int cl_rsbtbl_size; -unsigned int cl_lkbtbl_size;unsigned int cl_dirtbl_size;unsigned int cl_recover_timer;unsigned int cl_toss_secs;
@@ -107,7 +106,6 @@ enum {CLUSTER_ATTR_TCP_PORT =0 ,CLUSTER_ATTR_BUFFER_SIZE ,CLUSTER_ATTR_RSBTBL_SIZE , -CLUSTER_ATTR_LKBTBL_SIZE ,CLUSTER_ATTR_DIRTBL_SIZE ,CLUSTER_ATTR_RECOVER_TIMER , CLUSTER_ATTR_TOSS_SECS,
@@ -160,7 +158,6 @@ __CONFIGFS_ATTR(name, 0644, name##_read, name##_write)CLUSTER_ATTR (tcp_port,1 );CLUSTER_ATTR (buffer_size,1 );CLUSTER_ATTR (rsbtbl_size,1 ); -CLUSTER_ATTR (lkbtbl_size,1 );CLUSTER_ATTR (dirtbl_size,1 );CLUSTER_ATTR (recover_timer,1 );CLUSTER_ATTR (toss_secs,1 );
@@ -174,7 +171,6 @@ static struct configfs_attribute *cluster_attrs[] = { [CLUSTER_ATTR_TCP_PORT] = &cluster_attr_tcp_port.attr, [CLUSTER_ATTR_BUFFER_SIZE] = &cluster_attr_buffer_size.attr, [CLUSTER_ATTR_RSBTBL_SIZE] = &cluster_attr_rsbtbl_size.attr, - [CLUSTER_ATTR_LKBTBL_SIZE] = &cluster_attr_lkbtbl_size.attr, [CLUSTER_ATTR_DIRTBL_SIZE] = &cluster_attr_dirtbl_size.attr, [CLUSTER_ATTR_RECOVER_TIMER] = &cluster_attr_recover_timer.attr, [CLUSTER_ATTR_TOSS_SECS] = &cluster_attr_toss_secs.attr,
@@ -435,7 +431,6 @@ static struct config_group *make_cluster(struct config_group *g, cl->cl_tcp_port = dlm_config.ci_tcp_port; cl->cl_buffer_size = dlm_config.ci_buffer_size; cl->cl_rsbtbl_size = dlm_config.ci_rsbtbl_size; - cl->cl_lkbtbl_size = dlm_config.ci_lkbtbl_size; cl->cl_dirtbl_size = dlm_config.ci_dirtbl_size; cl->cl_recover_timer = dlm_config.ci_recover_timer; cl->cl_toss_secs = dlm_config.ci_toss_secs;
@@ -983,7 +978,6 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num)#define DEFAULT_TCP_PORT 21064#define DEFAULT_BUFFER_SIZE 4096#define DEFAULT_RSBTBL_SIZE 1024 -#define DEFAULT_LKBTBL_SIZE 1024#define DEFAULT_DIRTBL_SIZE 1024#define DEFAULT_RECOVER_TIMER 5#define DEFAULT_TOSS_SECS 10
@@ -997,7 +991,6 @@ struct dlm_config_info dlm_config = { .ci_tcp_port = DEFAULT_TCP_PORT, .ci_buffer_size = DEFAULT_BUFFER_SIZE, .ci_rsbtbl_size = DEFAULT_RSBTBL_SIZE, - .ci_lkbtbl_size = DEFAULT_LKBTBL_SIZE, .ci_dirtbl_size = DEFAULT_DIRTBL_SIZE, .ci_recover_timer = DEFAULT_RECOVER_TIMER, .ci_toss_secs = DEFAULT_TOSS_SECS,
fs/dlm/config.h +0 -1
@@ -20,7 +20,6 @@ struct dlm_config_info {int ci_tcp_port;int ci_buffer_size;int ci_rsbtbl_size; -int ci_lkbtbl_size;int ci_dirtbl_size;int ci_recover_timer;int ci_toss_secs;
fs/dlm/dlm_internal.h +4 -10
@@ -37,6 +37,7 @@#include <linux/jhash.h> #include <linux/miscdevice.h> #include <linux/mutex.h> +#include <linux/idr.h> #include <asm/uaccess.h> #include <linux/dlm.h>
@@ -52,7 +53,6 @@ struct dlm_ls;struct dlm_lkb ;struct dlm_rsb ;struct dlm_member ; -struct dlm_lkbtable ;struct dlm_rsbtable ;struct dlm_dirtable ;struct dlm_direntry ;
@@ -108,11 +108,6 @@ struct dlm_rsbtable {spinlock_t lock; }; -struct dlm_lkbtable { -struct list_head list; -rwlock_t lock; -uint16_t counter; -};/* * Lockspace member (per node in a ls)
@@ -248,7 +243,6 @@ struct dlm_lkb {int8_t lkb_wait_count;int lkb_wait_nodeid;/* for debugging */ -struct list_head lkb_idtbl_list;/* lockspace lkbtbl */ struct list_head lkb_statequeue;/* rsb g/c/w list */ struct list_head lkb_rsb_lookup;/* waiting for rsb lookup */ struct list_head lkb_wait_reply;/* waiting for remote reply */
@@ -465,12 +459,12 @@ struct dlm_ls {unsigned long ls_scan_time;struct kobject ls_kobj; +struct idr ls_lkbidr; +spinlock_t ls_lkbidr_spin; +struct dlm_rsbtable *ls_rsbtbl;uint32_t ls_rsbtbl_size; -struct dlm_lkbtable *ls_lkbtbl; -uint32_t ls_lkbtbl_size; -struct dlm_dirtable *ls_dirtbl;uint32_t ls_dirtbl_size;
fs/dlm/lock.c +24 -45
110 lines not on this page · raw message
fs/dlm/lockspace.c +54 -62
158 lines not on this page · raw message
Signature · 1 line
1.7.5.4
David Teigland
maintainerQuoted 3 lines · David Teigland
Request for testing
I'm looking at possible improvements to the dlm hash tables.
I've pushed this and another patch related to hash table performance to the tmp-testing branch,git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm.git
Dave