From f54613da7e70e59f86d5eb73a9a7ca65884461db Mon Sep 17 00:00:00 2001 From: pravin Date: Fri, 2 Jul 2010 19:01:53 +0530 Subject: [PATCH] b=20978 Fix llog_process_lock scalability issues. i=andrew.perepechko i=rahul.deshmukh fix llog_process_lock scalability issues during normal start up due to slow stale export processing. --- libcfs/include/libcfs/libcfs_private.h | 5 ++--- lustre/include/obd_class.h | 1 + lustre/mgc/mgc_request.c | 15 ++++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index b1dad03..02cd0f8 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -158,7 +158,7 @@ do { \ # define libcfs_kmem_dec(ptr, size) do {} while (0) #endif /* LIBCFS_DEBUG */ -#define LIBCFS_VMALLOC_SIZE 16384 +#define LIBCFS_VMALLOC_SIZE (2 << CFS_PAGE_SHIFT) /* 2 pages */ #define LIBCFS_ALLOC_GFP(ptr, size, mask) \ do { \ @@ -176,8 +176,7 @@ do { \ break; \ } \ libcfs_kmem_inc((ptr), (size)); \ - if (!((mask) & CFS_ALLOC_ZERO)) \ - memset((ptr), 0, (size)); \ + memset((ptr), 0, (size)); \ CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p (tot %d).\n", \ (int)(size), (ptr), cfs_atomic_read (&libcfs_kmemory)); \ } while (0) diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 611c6e4..dbf25cc 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -156,6 +156,7 @@ struct config_llog_data { cfs_atomic_t cld_refcount; struct config_llog_data *cld_sptlrpc;/* depended sptlrpc log */ struct obd_export *cld_mgcexp; + cfs_mutex_t cld_lock; unsigned int cld_stopping:1, /* we were told to stop * watching */ cld_lostlock:1, /* lock not requeued */ diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index df6122c..47eb2bf 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -221,6 +221,7 @@ struct config_llog_data *do_config_log_add(struct obd_device *obd, strcpy(cld->cld_logname, logname); if (cfg) cld->cld_cfg = *cfg; + cfs_mutex_init(&cld->cld_lock); cld->cld_cfg.cfg_last_idx = 0; cld->cld_cfg.cfg_flags = 0; cld->cld_cfg.cfg_sb = sb; @@ -325,7 +326,7 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) if (IS_ERR(cld)) RETURN(PTR_ERR(cld)); - cfs_down(&llog_process_lock); + cfs_mutex_lock(&cld->cld_lock); /* * if cld_stopping is set, it means we didn't start the log thus * not owning the start ref. this can happen after previous umount: @@ -334,14 +335,14 @@ static int config_log_end(char *logname, struct config_llog_instance *cfg) * calling start_log. */ if (unlikely(cld->cld_stopping)) { - cfs_up(&llog_process_lock); + cfs_mutex_unlock(&cld->cld_lock); /* drop the ref from the find */ config_log_put(cld); RETURN(rc); } cld->cld_stopping = 1; - cfs_up(&llog_process_lock); + cfs_mutex_unlock(&cld->cld_lock); cfs_spin_lock(&config_list_lock); cld_sptlrpc = cld->cld_sptlrpc; @@ -1264,10 +1265,10 @@ int mgc_process_log(struct obd_device *mgc, sounds like badness. It actually might be fine, as long as we're not trying to update from the same log simultaneously (in which case we should use a per-log sem.) */ - cfs_down(&llog_process_lock); + cfs_mutex_lock(&cld->cld_lock); if (cld->cld_stopping) { - cfs_up(&llog_process_lock); + cfs_mutex_unlock(&cld->cld_lock); RETURN(0); } @@ -1282,7 +1283,7 @@ int mgc_process_log(struct obd_device *mgc, ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT); if (!ctxt) { CERROR("missing llog context\n"); - cfs_up(&llog_process_lock); + cfs_mutex_unlock(&cld->cld_lock); RETURN(-EINVAL); } @@ -1369,7 +1370,7 @@ out_pop: CDEBUG(D_MGC, "%s: configuration from log '%s' %sed (%d).\n", mgc->obd_name, cld->cld_logname, rc ? "fail" : "succeed", rc); - cfs_up(&llog_process_lock); + cfs_mutex_unlock(&cld->cld_lock); RETURN(rc); } -- 1.8.3.1