aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLi Xi <lixi@ddn.com>2015-02-01 21:52:02 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-02-07 04:27:16 -0500
commit4d2c7b309d17a5609a5d4ede628d16828262ca00 (patch)
tree81cfa5759ce630b393f3805f539f2998f2b48a0a /drivers
parentc00266e369b945945316dad3869342d07f4be868 (diff)
staging/lustre/ldlm: high load because of negative timeout
When the time of LRU resizing exceeds waiting period of recalculation, the ldlm daemon will keep on resizing without any interval of rest. That will cause high CPU load. This patch fixes the problem by setting the recalculation timestamp after LRU resizing finishes rather than before it. What is more, an interval of one second is enforced between each recalculation. Signed-off-by: Li Xi <lixi@ddn.com> Reviewed-on: http://review.whamcloud.com/11227 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5415 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Bobi Jam <bobijam@gmail.com> Reviewed-by: Lai Siyao <lai.siyao@intel.com> Signed-off-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_pool.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
index 142b3dd598cb..d20d277dc2f7 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c
@@ -470,6 +470,7 @@ static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl)
470static int ldlm_cli_pool_recalc(struct ldlm_pool *pl) 470static int ldlm_cli_pool_recalc(struct ldlm_pool *pl)
471{ 471{
472 time_t recalc_interval_sec; 472 time_t recalc_interval_sec;
473 int ret;
473 474
474 recalc_interval_sec = get_seconds() - pl->pl_recalc_time; 475 recalc_interval_sec = get_seconds() - pl->pl_recalc_time;
475 if (recalc_interval_sec < pl->pl_recalc_period) 476 if (recalc_interval_sec < pl->pl_recalc_period)
@@ -490,16 +491,15 @@ static int ldlm_cli_pool_recalc(struct ldlm_pool *pl)
490 */ 491 */
491 ldlm_cli_pool_pop_slv(pl); 492 ldlm_cli_pool_pop_slv(pl);
492 493
493 pl->pl_recalc_time = get_seconds();
494 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT,
495 recalc_interval_sec);
496 spin_unlock(&pl->pl_lock); 494 spin_unlock(&pl->pl_lock);
497 495
498 /* 496 /*
499 * Do not cancel locks in case lru resize is disabled for this ns. 497 * Do not cancel locks in case lru resize is disabled for this ns.
500 */ 498 */
501 if (!ns_connect_lru_resize(ldlm_pl2ns(pl))) 499 if (!ns_connect_lru_resize(ldlm_pl2ns(pl))) {
502 return 0; 500 ret = 0;
501 goto out;
502 }
503 503
504 /* 504 /*
505 * In the time of canceling locks on client we do not need to maintain 505 * In the time of canceling locks on client we do not need to maintain
@@ -507,7 +507,19 @@ static int ldlm_cli_pool_recalc(struct ldlm_pool *pl)
507 * It may be called when SLV has changed much, this is why we do not 507 * It may be called when SLV has changed much, this is why we do not
508 * take into account pl->pl_recalc_time here. 508 * take into account pl->pl_recalc_time here.
509 */ 509 */
510 return ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LCF_ASYNC, LDLM_CANCEL_LRUR); 510 ret = ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LCF_ASYNC, LDLM_CANCEL_LRUR);
511
512out:
513 spin_lock(&pl->pl_lock);
514 /*
515 * Time of LRU resizing might be longer than period,
516 * so update after LRU resizing rather than before it.
517 */
518 pl->pl_recalc_time = get_seconds();
519 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT,
520 recalc_interval_sec);
521 spin_unlock(&pl->pl_lock);
522 return ret;
511} 523}
512 524
513/** 525/**
@@ -591,6 +603,14 @@ int ldlm_pool_recalc(struct ldlm_pool *pl)
591 } 603 }
592 recalc_interval_sec = pl->pl_recalc_time - get_seconds() + 604 recalc_interval_sec = pl->pl_recalc_time - get_seconds() +
593 pl->pl_recalc_period; 605 pl->pl_recalc_period;
606 if (recalc_interval_sec <= 0) {
607 /* Prevent too frequent recalculation. */
608 CDEBUG(D_DLMTRACE, "Negative interval(%ld), "
609 "too short period(%ld)",
610 recalc_interval_sec,
611 pl->pl_recalc_period);
612 recalc_interval_sec = 1;
613 }
594 614
595 return recalc_interval_sec; 615 return recalc_interval_sec;
596} 616}