1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2 * vim:expandtab:shiftwidth=8:tabstop=8:
6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 only,
10 * as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License version 2 for more details (a copy is included
16 * in the LICENSE file that accompanied this code).
18 * You should have received a copy of the GNU General Public License
19 * version 2 along with this program; If not, see
20 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
22 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23 * CA 95054 USA or visit www.sun.com if you need additional information or
29 * Copyright 2008 Sun Microsystems, Inc. All rights reserved
30 * Use is subject to license terms.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 * lustre/ldlm/ldlm_pool.c
38 * Author: Yury Umanets <umka@clusterfs.com>
42 * Idea of this code is rather simple. Each second, for each server namespace
43 * we have SLV - server lock volume which is calculated on current number of
44 * granted locks, grant speed for past period, etc - that is, locking load.
45 * This SLV number may be thought as a flow definition for simplicity. It is
46 * sent to clients with each occasion to let them know what is current load
47 * situation on the server. By default, at the beginning, SLV on server is
48 * set max value which is calculated as the following: allow to one client
49 * have all locks of limit ->pl_limit for 10h.
51 * Next, on clients, number of cached locks is not limited artificially in any
52 * way as it was before. Instead, client calculates CLV, that is, client lock
53 * volume for each lock and compares it with last SLV from the server. CLV is
54 * calculated as the number of locks in LRU * lock live time in seconds. If
55 * CLV > SLV - lock is canceled.
57 * Client has LVF, that is, lock volume factor which regulates how much sensitive
58 * client should be about last SLV from server. The higher LVF is the more locks
59 * will be canceled on client. Default value for it is 1. Setting LVF to 2 means
60 * that client will cancel locks 2 times faster.
62 * Locks on a client will be canceled more intensively in these cases:
63 * (1) if SLV is smaller, that is, load is higher on the server;
64 * (2) client has a lot of locks (the more locks are held by client, the bigger
65 * chances that some of them should be canceled);
66 * (3) client has old locks (taken some time ago);
68 * Thus, according to flow paradigm that we use for better understanding SLV,
69 * CLV is the volume of particle in flow described by SLV. According to this,
70 * if flow is getting thinner, more and more particles become outside of it and
71 * as particles are locks, they should be canceled.
73 * General idea of this belongs to Vitaly Fertman (vitaly@clusterfs.com). Andreas
74 * Dilger (adilger@clusterfs.com) proposed few nice ideas like using LVF and many
75 * cleanups. Flow definition to allow more easy understanding of the logic belongs
76 * to Nikita Danilov (nikita@clusterfs.com) as well as many cleanups and fixes.
77 * And design and implementation are done by Yury Umanets (umka@clusterfs.com).
79 * Glossary for terms used:
81 * pl_limit - Number of allowed locks in pool. Applies to server and client
84 * pl_granted - Number of granted locks (calculated);
85 * pl_grant_rate - Number of granted locks for last T (calculated);
86 * pl_cancel_rate - Number of canceled locks for last T (calculated);
87 * pl_grant_speed - Grant speed (GR - CR) for last T (calculated);
88 * pl_grant_plan - Planned number of granted locks for next T (calculated);
89 * pl_server_lock_volume - Current server lock volume (calculated);
91 * As it may be seen from list above, we have few possible tunables which may
92 * affect behavior much. They all may be modified via proc. However, they also
93 * give a possibility for constructing few pre-defined behavior policies. If
94 * none of predefines is suitable for a working pattern being used, new one may
95 * be "constructed" via proc tunables.
98 #define DEBUG_SUBSYSTEM S_LDLM
101 # include <lustre_dlm.h>
103 # include <liblustre.h>
106 #include <obd_class.h>
107 #include <obd_support.h>
108 #include "ldlm_internal.h"
110 #ifdef HAVE_LRU_RESIZE_SUPPORT
113 * 50 ldlm locks for 1MB of RAM.
115 #define LDLM_POOL_HOST_L ((num_physpages >> (20 - CFS_PAGE_SHIFT)) * 50)
118 * Maximal possible grant step plan in %.
120 #define LDLM_POOL_MAX_GSP (30)
123 * Minimal possible grant step plan in %.
125 #define LDLM_POOL_MIN_GSP (1)
128 * This controls the speed of reaching LDLM_POOL_MAX_GSP
129 * with increasing thread period.
131 #define LDLM_POOL_GSP_STEP (4)
134 * LDLM_POOL_GSP% of all locks is default GP.
136 #define LDLM_POOL_GP(L) (((L) * LDLM_POOL_MAX_GSP) / 100)
139 * Max age for locks on clients.
141 #define LDLM_POOL_MAX_AGE (36000)
144 extern cfs_proc_dir_entry_t *ldlm_ns_proc_dir;
147 #define avg(src, add) \
148 ((src) = ((src) + (add)) / 2)
150 static inline __u64 dru(__u64 val, __u32 div)
152 __u64 ret = val + (div - 1);
157 static inline __u64 ldlm_pool_slv_max(__u32 L)
160 * Allow to have all locks for 1 client for 10 hrs.
161 * Formula is the following: limit * 10h / 1 client.
163 __u64 lim = L * LDLM_POOL_MAX_AGE / 1;
167 static inline __u64 ldlm_pool_slv_min(__u32 L)
173 LDLM_POOL_FIRST_STAT = 0,
174 LDLM_POOL_GRANTED_STAT = LDLM_POOL_FIRST_STAT,
175 LDLM_POOL_GRANT_STAT,
176 LDLM_POOL_CANCEL_STAT,
177 LDLM_POOL_GRANT_RATE_STAT,
178 LDLM_POOL_CANCEL_RATE_STAT,
179 LDLM_POOL_GRANT_PLAN_STAT,
181 LDLM_POOL_SHRINK_REQTD_STAT,
182 LDLM_POOL_SHRINK_FREED_STAT,
183 LDLM_POOL_RECALC_STAT,
184 LDLM_POOL_TIMING_STAT,
188 static inline struct ldlm_namespace *ldlm_pl2ns(struct ldlm_pool *pl)
190 return container_of(pl, struct ldlm_namespace, ns_pool);
194 * Calculates suggested grant_step in % of available locks for passed
195 * \a period. This is later used in grant_plan calculations.
197 static inline int ldlm_pool_t2gsp(int t)
200 * This yeilds 1% grant step for anything below LDLM_POOL_GSP_STEP
201 * and up to 30% for anything higher than LDLM_POOL_GSP_STEP.
203 * How this will affect execution is the following:
205 * - for thread peroid 1s we will have grant_step 1% which good from
206 * pov of taking some load off from server and push it out to clients.
207 * This is like that because 1% for grant_step means that server will
208 * not allow clients to get lots of locks inshort period of time and
209 * keep all old locks in their caches. Clients will always have to
210 * get some locks back if they want to take some new;
212 * - for thread period 10s (which is default) we will have 23% which
213 * means that clients will have enough of room to take some new locks
214 * without getting some back. All locks from this 23% which were not
215 * taken by clients in current period will contribute in SLV growing.
216 * SLV growing means more locks cached on clients until limit or grant
219 return LDLM_POOL_MAX_GSP -
220 (LDLM_POOL_MAX_GSP - LDLM_POOL_MIN_GSP) /
221 (1 << (t / LDLM_POOL_GSP_STEP));
225 * Recalculates next grant limit on passed \a pl.
227 * \pre ->pl_lock is locked.
229 static inline void ldlm_pool_recalc_grant_plan(struct ldlm_pool *pl)
231 int granted, grant_step, limit;
233 limit = ldlm_pool_get_limit(pl);
234 granted = atomic_read(&pl->pl_granted);
236 grant_step = ldlm_pool_t2gsp(pl->pl_recalc_period);
237 grant_step = ((limit - granted) * grant_step) / 100;
238 pl->pl_grant_plan = granted + grant_step;
242 * Recalculates next SLV on passed \a pl.
244 * \pre ->pl_lock is locked.
246 static inline void ldlm_pool_recalc_slv(struct ldlm_pool *pl)
248 int grant_usage, granted, grant_plan;
249 __u64 slv, slv_factor;
252 slv = pl->pl_server_lock_volume;
253 grant_plan = pl->pl_grant_plan;
254 limit = ldlm_pool_get_limit(pl);
255 granted = atomic_read(&pl->pl_granted);
257 grant_usage = limit - (granted - grant_plan);
258 if (grant_usage <= 0)
262 * Find out SLV change factor which is the ratio of grant usage
263 * from limit. SLV changes as fast as the ratio of grant plan
264 * consumtion. The more locks from grant plan are not consumed
265 * by clients in last interval (idle time), the faster grows
266 * SLV. And the opposite, the more grant plan is over-consumed
267 * (load time) the faster drops SLV.
269 slv_factor = (grant_usage * 100) / limit;
270 if (2 * abs(granted - limit) > limit) {
271 slv_factor *= slv_factor;
272 slv_factor = dru(slv_factor, 100);
274 slv = slv * slv_factor;
277 if (slv > ldlm_pool_slv_max(limit)) {
278 slv = ldlm_pool_slv_max(limit);
279 } else if (slv < ldlm_pool_slv_min(limit)) {
280 slv = ldlm_pool_slv_min(limit);
283 pl->pl_server_lock_volume = slv;
287 * Recalculates next stats on passed \a pl.
289 * \pre ->pl_lock is locked.
291 static inline void ldlm_pool_recalc_stats(struct ldlm_pool *pl)
293 int grant_plan = pl->pl_grant_plan;
294 __u64 slv = pl->pl_server_lock_volume;
295 int granted = atomic_read(&pl->pl_granted);
296 int grant_rate = atomic_read(&pl->pl_grant_rate);
297 int cancel_rate = atomic_read(&pl->pl_cancel_rate);
299 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_SLV_STAT,
301 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_GRANTED_STAT,
303 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_GRANT_RATE_STAT,
305 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_GRANT_PLAN_STAT,
307 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_CANCEL_RATE_STAT,
312 * Sets current SLV into obd accessible via ldlm_pl2ns(pl)->ns_obd.
314 static void ldlm_srv_pool_push_slv(struct ldlm_pool *pl)
316 struct obd_device *obd;
319 * Set new SLV in obd field for using it later without accessing the
320 * pool. This is required to avoid race between sending reply to client
321 * with new SLV and cleanup server stack in which we can't guarantee
322 * that namespace is still alive. We know only that obd is alive as
323 * long as valid export is alive.
325 obd = ldlm_pl2ns(pl)->ns_obd;
326 LASSERT(obd != NULL);
327 write_lock(&obd->obd_pool_lock);
328 obd->obd_pool_slv = pl->pl_server_lock_volume;
329 write_unlock(&obd->obd_pool_lock);
333 * Recalculates all pool fields on passed \a pl.
335 * \pre ->pl_lock is not locked.
337 static int ldlm_srv_pool_recalc(struct ldlm_pool *pl)
339 time_t recalc_interval_sec;
342 spin_lock(&pl->pl_lock);
343 recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
344 if (recalc_interval_sec >= pl->pl_recalc_period) {
346 * Recalc SLV after last period. This should be done
347 * _before_ recalculating new grant plan.
349 ldlm_pool_recalc_slv(pl);
352 * Make sure that pool informed obd of last SLV changes.
354 ldlm_srv_pool_push_slv(pl);
357 * Update grant_plan for new period.
359 ldlm_pool_recalc_grant_plan(pl);
361 pl->pl_recalc_time = cfs_time_current_sec();
362 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT,
363 recalc_interval_sec);
366 spin_unlock(&pl->pl_lock);
371 * This function is used on server side as main entry point for memory
372 * preasure handling. It decreases SLV on \a pl according to passed
373 * \a nr and \a gfp_mask.
375 * Our goal here is to decrease SLV such a way that clients hold \a nr
376 * locks smaller in next 10h.
378 static int ldlm_srv_pool_shrink(struct ldlm_pool *pl,
379 int nr, unsigned int gfp_mask)
385 * VM is asking how many entries may be potentially freed.
388 RETURN(atomic_read(&pl->pl_granted));
391 * Client already canceled locks but server is already in shrinker
392 * and can't cancel anything. Let's catch this race.
394 if (atomic_read(&pl->pl_granted) == 0)
397 spin_lock(&pl->pl_lock);
400 * We want shrinker to possibly cause cancelation of @nr locks from
401 * clients or grant approximately @nr locks smaller next intervals.
403 * This is why we decresed SLV by @nr. This effect will only be as
404 * long as one re-calc interval (1s these days) and this should be
405 * enough to pass this decreased SLV to all clients. On next recalc
406 * interval pool will either increase SLV if locks load is not high
407 * or will keep on same level or even decrease again, thus, shrinker
408 * decreased SLV will affect next recalc intervals and this way will
409 * make locking load lower.
411 if (nr < pl->pl_server_lock_volume) {
412 pl->pl_server_lock_volume = pl->pl_server_lock_volume - nr;
414 limit = ldlm_pool_get_limit(pl);
415 pl->pl_server_lock_volume = ldlm_pool_slv_min(limit);
419 * Make sure that pool informed obd of last SLV changes.
421 ldlm_srv_pool_push_slv(pl);
422 spin_unlock(&pl->pl_lock);
425 * We did not really free any memory here so far, it only will be
426 * freed later may be, so that we return 0 to not confuse VM.
432 * Setup server side pool \a pl with passed \a limit.
434 static int ldlm_srv_pool_setup(struct ldlm_pool *pl, int limit)
436 struct obd_device *obd;
439 obd = ldlm_pl2ns(pl)->ns_obd;
440 LASSERT(obd != NULL && obd != LP_POISON);
441 LASSERT(obd->obd_type != LP_POISON);
442 write_lock(&obd->obd_pool_lock);
443 obd->obd_pool_limit = limit;
444 write_unlock(&obd->obd_pool_lock);
446 ldlm_pool_set_limit(pl, limit);
451 * Sets SLV and Limit from ldlm_pl2ns(pl)->ns_obd tp passed \a pl.
453 static void ldlm_cli_pool_pop_slv(struct ldlm_pool *pl)
455 struct obd_device *obd;
458 * Get new SLV and Limit from obd which is updated with comming
461 obd = ldlm_pl2ns(pl)->ns_obd;
462 LASSERT(obd != NULL);
463 read_lock(&obd->obd_pool_lock);
464 pl->pl_server_lock_volume = obd->obd_pool_slv;
465 ldlm_pool_set_limit(pl, obd->obd_pool_limit);
466 read_unlock(&obd->obd_pool_lock);
470 * Recalculates client sise pool \a pl according to current SLV and Limit.
472 static int ldlm_cli_pool_recalc(struct ldlm_pool *pl)
474 time_t recalc_interval_sec;
477 spin_lock(&pl->pl_lock);
479 * Check if we need to recalc lists now.
481 recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
482 if (recalc_interval_sec < pl->pl_recalc_period) {
483 spin_unlock(&pl->pl_lock);
488 * Make sure that pool knows last SLV and Limit from obd.
490 ldlm_cli_pool_pop_slv(pl);
492 pl->pl_recalc_time = cfs_time_current_sec();
493 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT,
494 recalc_interval_sec);
495 spin_unlock(&pl->pl_lock);
498 * Do not cancel locks in case lru resize is disabled for this ns.
500 if (!ns_connect_lru_resize(ldlm_pl2ns(pl)))
504 * In the time of canceling locks on client we do not need to maintain
505 * sharp timing, we only want to cancel locks asap according to new SLV.
506 * It may be called when SLV has changed much, this is why we do not
507 * take into account pl->pl_recalc_time here.
509 RETURN(ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LDLM_ASYNC,
514 * This function is main entry point for memory preasure handling on client side.
515 * Main goal of this function is to cancel some number of locks on passed \a pl
516 * according to \a nr and \a gfp_mask.
518 static int ldlm_cli_pool_shrink(struct ldlm_pool *pl,
519 int nr, unsigned int gfp_mask)
524 * Do not cancel locks in case lru resize is disabled for this ns.
526 if (!ns_connect_lru_resize(ldlm_pl2ns(pl)))
530 * Make sure that pool knows last SLV and Limit from obd.
532 ldlm_cli_pool_pop_slv(pl);
535 * Find out how many locks may be released according to shrink
539 RETURN(ldlm_cancel_lru_estimate(ldlm_pl2ns(pl), 0, 0,
540 LDLM_CANCEL_SHRINK));
543 * Cancel @nr locks accoding to shrink policy.
545 RETURN(ldlm_cancel_lru(ldlm_pl2ns(pl), nr, LDLM_SYNC,
546 LDLM_CANCEL_SHRINK));
549 struct ldlm_pool_ops ldlm_srv_pool_ops = {
550 .po_recalc = ldlm_srv_pool_recalc,
551 .po_shrink = ldlm_srv_pool_shrink,
552 .po_setup = ldlm_srv_pool_setup
555 struct ldlm_pool_ops ldlm_cli_pool_ops = {
556 .po_recalc = ldlm_cli_pool_recalc,
557 .po_shrink = ldlm_cli_pool_shrink
561 * Pool recalc wrapper. Will call either client or server pool recalc callback
562 * depending what pool \a pl is used.
564 int ldlm_pool_recalc(struct ldlm_pool *pl)
566 time_t recalc_interval_sec;
569 spin_lock(&pl->pl_lock);
570 recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
571 if (recalc_interval_sec > 0) {
573 * Update pool statistics every 1s.
575 ldlm_pool_recalc_stats(pl);
578 * Zero out all rates and speed for the last period.
580 atomic_set(&pl->pl_grant_rate, 0);
581 atomic_set(&pl->pl_cancel_rate, 0);
582 atomic_set(&pl->pl_grant_speed, 0);
584 spin_unlock(&pl->pl_lock);
586 if (pl->pl_ops->po_recalc != NULL) {
587 count = pl->pl_ops->po_recalc(pl);
588 lprocfs_counter_add(pl->pl_stats, LDLM_POOL_RECALC_STAT,
595 EXPORT_SYMBOL(ldlm_pool_recalc);
598 * Pool shrink wrapper. Will call either client or server pool recalc callback
599 * depending what pool \a pl is used.
601 int ldlm_pool_shrink(struct ldlm_pool *pl, int nr,
602 unsigned int gfp_mask)
606 if (pl->pl_ops->po_shrink != NULL) {
607 cancel = pl->pl_ops->po_shrink(pl, nr, gfp_mask);
609 lprocfs_counter_add(pl->pl_stats,
610 LDLM_POOL_SHRINK_REQTD_STAT,
612 lprocfs_counter_add(pl->pl_stats,
613 LDLM_POOL_SHRINK_FREED_STAT,
615 CDEBUG(D_DLMTRACE, "%s: request to shrink %d locks, "
616 "shrunk %d\n", pl->pl_name, nr, cancel);
621 EXPORT_SYMBOL(ldlm_pool_shrink);
624 * Pool setup wrapper. Will call either client or server pool recalc callback
625 * depending what pool \a pl is used.
627 * Sets passed \a limit into pool \a pl.
629 int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
632 if (pl->pl_ops->po_setup != NULL)
633 RETURN(pl->pl_ops->po_setup(pl, limit));
636 EXPORT_SYMBOL(ldlm_pool_setup);
639 static int lprocfs_rd_pool_state(char *page, char **start, off_t off,
640 int count, int *eof, void *data)
642 int granted, grant_rate, cancel_rate, grant_step;
643 int nr = 0, grant_speed, grant_plan, lvf;
644 struct ldlm_pool *pl = data;
648 spin_lock(&pl->pl_lock);
649 slv = pl->pl_server_lock_volume;
650 clv = pl->pl_client_lock_volume;
651 limit = ldlm_pool_get_limit(pl);
652 grant_plan = pl->pl_grant_plan;
653 granted = atomic_read(&pl->pl_granted);
654 grant_rate = atomic_read(&pl->pl_grant_rate);
655 lvf = atomic_read(&pl->pl_lock_volume_factor);
656 grant_speed = atomic_read(&pl->pl_grant_speed);
657 cancel_rate = atomic_read(&pl->pl_cancel_rate);
658 grant_step = ldlm_pool_t2gsp(pl->pl_recalc_period);
659 spin_unlock(&pl->pl_lock);
661 nr += snprintf(page + nr, count - nr, "LDLM pool state (%s):\n",
663 nr += snprintf(page + nr, count - nr, " SLV: "LPU64"\n", slv);
664 nr += snprintf(page + nr, count - nr, " CLV: "LPU64"\n", clv);
665 nr += snprintf(page + nr, count - nr, " LVF: %d\n", lvf);
667 if (ns_is_server(ldlm_pl2ns(pl))) {
668 nr += snprintf(page + nr, count - nr, " GSP: %d%%\n",
670 nr += snprintf(page + nr, count - nr, " GP: %d\n",
673 nr += snprintf(page + nr, count - nr, " GR: %d\n",
675 nr += snprintf(page + nr, count - nr, " CR: %d\n",
677 nr += snprintf(page + nr, count - nr, " GS: %d\n",
679 nr += snprintf(page + nr, count - nr, " G: %d\n",
681 nr += snprintf(page + nr, count - nr, " L: %d\n",
686 LDLM_POOL_PROC_READER(grant_plan, int);
687 LDLM_POOL_PROC_READER(recalc_period, int);
688 LDLM_POOL_PROC_WRITER(recalc_period, int);
690 static int ldlm_pool_proc_init(struct ldlm_pool *pl)
692 struct ldlm_namespace *ns = ldlm_pl2ns(pl);
693 struct proc_dir_entry *parent_ns_proc;
694 struct lprocfs_vars pool_vars[2];
695 char *var_name = NULL;
699 OBD_ALLOC(var_name, MAX_STRING_SIZE + 1);
703 parent_ns_proc = lprocfs_srch(ldlm_ns_proc_dir, ns->ns_name);
704 if (parent_ns_proc == NULL) {
705 CERROR("%s: proc entry is not initialized\n",
707 GOTO(out_free_name, rc = -EINVAL);
709 pl->pl_proc_dir = lprocfs_register("pool", parent_ns_proc,
711 if (IS_ERR(pl->pl_proc_dir)) {
712 CERROR("LProcFS failed in ldlm-pool-init\n");
713 rc = PTR_ERR(pl->pl_proc_dir);
714 GOTO(out_free_name, rc);
717 var_name[MAX_STRING_SIZE] = '\0';
718 memset(pool_vars, 0, sizeof(pool_vars));
719 pool_vars[0].name = var_name;
721 snprintf(var_name, MAX_STRING_SIZE, "server_lock_volume");
722 pool_vars[0].data = &pl->pl_server_lock_volume;
723 pool_vars[0].read_fptr = lprocfs_rd_u64;
724 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
726 snprintf(var_name, MAX_STRING_SIZE, "limit");
727 pool_vars[0].data = &pl->pl_limit;
728 pool_vars[0].read_fptr = lprocfs_rd_atomic;
729 pool_vars[0].write_fptr = lprocfs_wr_atomic;
730 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
732 snprintf(var_name, MAX_STRING_SIZE, "granted");
733 pool_vars[0].data = &pl->pl_granted;
734 pool_vars[0].read_fptr = lprocfs_rd_atomic;
735 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
737 snprintf(var_name, MAX_STRING_SIZE, "grant_speed");
738 pool_vars[0].data = &pl->pl_grant_speed;
739 pool_vars[0].read_fptr = lprocfs_rd_atomic;
740 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
742 snprintf(var_name, MAX_STRING_SIZE, "cancel_rate");
743 pool_vars[0].data = &pl->pl_cancel_rate;
744 pool_vars[0].read_fptr = lprocfs_rd_atomic;
745 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
747 snprintf(var_name, MAX_STRING_SIZE, "grant_rate");
748 pool_vars[0].data = &pl->pl_grant_rate;
749 pool_vars[0].read_fptr = lprocfs_rd_atomic;
750 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
752 snprintf(var_name, MAX_STRING_SIZE, "grant_plan");
753 pool_vars[0].data = pl;
754 pool_vars[0].read_fptr = lprocfs_rd_grant_plan;
755 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
757 snprintf(var_name, MAX_STRING_SIZE, "recalc_period");
758 pool_vars[0].data = pl;
759 pool_vars[0].read_fptr = lprocfs_rd_recalc_period;
760 pool_vars[0].write_fptr = lprocfs_wr_recalc_period;
761 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
763 snprintf(var_name, MAX_STRING_SIZE, "lock_volume_factor");
764 pool_vars[0].data = &pl->pl_lock_volume_factor;
765 pool_vars[0].read_fptr = lprocfs_rd_atomic;
766 pool_vars[0].write_fptr = lprocfs_wr_atomic;
767 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
769 snprintf(var_name, MAX_STRING_SIZE, "state");
770 pool_vars[0].data = pl;
771 pool_vars[0].read_fptr = lprocfs_rd_pool_state;
772 lprocfs_add_vars(pl->pl_proc_dir, pool_vars, 0);
774 pl->pl_stats = lprocfs_alloc_stats(LDLM_POOL_LAST_STAT -
775 LDLM_POOL_FIRST_STAT, 0);
777 GOTO(out_free_name, rc = -ENOMEM);
779 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_GRANTED_STAT,
780 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
782 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_GRANT_STAT,
783 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
785 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_CANCEL_STAT,
786 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
788 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_GRANT_RATE_STAT,
789 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
790 "grant_rate", "locks/s");
791 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_CANCEL_RATE_STAT,
792 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
793 "cancel_rate", "locks/s");
794 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_GRANT_PLAN_STAT,
795 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
796 "grant_plan", "locks/s");
797 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_SLV_STAT,
798 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
800 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_SHRINK_REQTD_STAT,
801 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
802 "shrink_request", "locks");
803 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_SHRINK_FREED_STAT,
804 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
805 "shrink_freed", "locks");
806 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_RECALC_STAT,
807 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
808 "recalc_freed", "locks");
809 lprocfs_counter_init(pl->pl_stats, LDLM_POOL_TIMING_STAT,
810 LPROCFS_CNTR_AVGMINMAX | LPROCFS_CNTR_STDDEV,
811 "recalc_timing", "sec");
812 lprocfs_register_stats(pl->pl_proc_dir, "stats", pl->pl_stats);
816 OBD_FREE(var_name, MAX_STRING_SIZE + 1);
820 static void ldlm_pool_proc_fini(struct ldlm_pool *pl)
822 if (pl->pl_stats != NULL) {
823 lprocfs_free_stats(&pl->pl_stats);
826 if (pl->pl_proc_dir != NULL) {
827 lprocfs_remove(&pl->pl_proc_dir);
828 pl->pl_proc_dir = NULL;
831 #else /* !__KERNEL__*/
832 #define ldlm_pool_proc_init(pl) (0)
833 #define ldlm_pool_proc_fini(pl) while (0) {}
836 int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
837 int idx, ldlm_side_t client)
842 spin_lock_init(&pl->pl_lock);
843 atomic_set(&pl->pl_granted, 0);
844 pl->pl_recalc_time = cfs_time_current_sec();
845 atomic_set(&pl->pl_lock_volume_factor, 1);
847 atomic_set(&pl->pl_grant_rate, 0);
848 atomic_set(&pl->pl_cancel_rate, 0);
849 atomic_set(&pl->pl_grant_speed, 0);
850 pl->pl_grant_plan = LDLM_POOL_GP(LDLM_POOL_HOST_L);
852 snprintf(pl->pl_name, sizeof(pl->pl_name), "ldlm-pool-%s-%d",
855 if (client == LDLM_NAMESPACE_SERVER) {
856 pl->pl_ops = &ldlm_srv_pool_ops;
857 ldlm_pool_set_limit(pl, LDLM_POOL_HOST_L);
858 pl->pl_recalc_period = LDLM_POOL_SRV_DEF_RECALC_PERIOD;
859 pl->pl_server_lock_volume = ldlm_pool_slv_max(LDLM_POOL_HOST_L);
861 ldlm_pool_set_limit(pl, 1);
862 pl->pl_server_lock_volume = 1;
863 pl->pl_ops = &ldlm_cli_pool_ops;
864 pl->pl_recalc_period = LDLM_POOL_CLI_DEF_RECALC_PERIOD;
866 pl->pl_client_lock_volume = 0;
867 rc = ldlm_pool_proc_init(pl);
871 CDEBUG(D_DLMTRACE, "Lock pool %s is initialized\n", pl->pl_name);
875 EXPORT_SYMBOL(ldlm_pool_init);
877 void ldlm_pool_fini(struct ldlm_pool *pl)
880 ldlm_pool_proc_fini(pl);
883 * Pool should not be used after this point. We can't free it here as
884 * it lives in struct ldlm_namespace, but still interested in catching
885 * any abnormal using cases.
887 POISON(pl, 0x5a, sizeof(*pl));
890 EXPORT_SYMBOL(ldlm_pool_fini);
893 * Add new taken ldlm lock \a lock into pool \a pl accounting.
895 void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock)
898 * FLOCK locks are special in a sense that they are almost never
899 * cancelled, instead special kind of lock is used to drop them.
900 * also there is no LRU for flock locks, so no point in tracking
903 if (lock->l_resource->lr_type == LDLM_FLOCK)
907 atomic_inc(&pl->pl_granted);
908 atomic_inc(&pl->pl_grant_rate);
909 atomic_inc(&pl->pl_grant_speed);
911 lprocfs_counter_incr(pl->pl_stats, LDLM_POOL_GRANT_STAT);
914 * Do not do pool recalc for client side as all locks which
915 * potentially may be canceled has already been packed into
916 * enqueue/cancel rpc. Also we do not want to run out of stack
917 * with too long call paths.
919 if (ns_is_server(ldlm_pl2ns(pl)))
920 ldlm_pool_recalc(pl);
923 EXPORT_SYMBOL(ldlm_pool_add);
926 * Remove ldlm lock \a lock from pool \a pl accounting.
928 void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock)
931 * Filter out FLOCK locks. Read above comment in ldlm_pool_add().
933 if (lock->l_resource->lr_type == LDLM_FLOCK)
937 LASSERT(atomic_read(&pl->pl_granted) > 0);
938 atomic_dec(&pl->pl_granted);
939 atomic_inc(&pl->pl_cancel_rate);
940 atomic_dec(&pl->pl_grant_speed);
942 lprocfs_counter_incr(pl->pl_stats, LDLM_POOL_CANCEL_STAT);
944 if (ns_is_server(ldlm_pl2ns(pl)))
945 ldlm_pool_recalc(pl);
948 EXPORT_SYMBOL(ldlm_pool_del);
951 * Returns current \a pl SLV.
953 * \pre ->pl_lock is not locked.
955 __u64 ldlm_pool_get_slv(struct ldlm_pool *pl)
958 spin_lock(&pl->pl_lock);
959 slv = pl->pl_server_lock_volume;
960 spin_unlock(&pl->pl_lock);
963 EXPORT_SYMBOL(ldlm_pool_get_slv);
966 * Sets passed \a slv to \a pl.
968 * \pre ->pl_lock is not locked.
970 void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv)
972 spin_lock(&pl->pl_lock);
973 pl->pl_server_lock_volume = slv;
974 spin_unlock(&pl->pl_lock);
976 EXPORT_SYMBOL(ldlm_pool_set_slv);
979 * Returns current \a pl CLV.
981 * \pre ->pl_lock is not locked.
983 __u64 ldlm_pool_get_clv(struct ldlm_pool *pl)
986 spin_lock(&pl->pl_lock);
987 slv = pl->pl_client_lock_volume;
988 spin_unlock(&pl->pl_lock);
991 EXPORT_SYMBOL(ldlm_pool_get_clv);
994 * Sets passed \a clv to \a pl.
996 * \pre ->pl_lock is not locked.
998 void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv)
1000 spin_lock(&pl->pl_lock);
1001 pl->pl_client_lock_volume = clv;
1002 spin_unlock(&pl->pl_lock);
1004 EXPORT_SYMBOL(ldlm_pool_set_clv);
1007 * Returns current \a pl limit.
1009 __u32 ldlm_pool_get_limit(struct ldlm_pool *pl)
1011 return atomic_read(&pl->pl_limit);
1013 EXPORT_SYMBOL(ldlm_pool_get_limit);
1016 * Sets passed \a limit to \a pl.
1018 void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit)
1020 atomic_set(&pl->pl_limit, limit);
1022 EXPORT_SYMBOL(ldlm_pool_set_limit);
1025 * Returns current LVF from \a pl.
1027 __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl)
1029 return atomic_read(&pl->pl_lock_volume_factor);
1031 EXPORT_SYMBOL(ldlm_pool_get_lvf);
1034 static int ldlm_pool_granted(struct ldlm_pool *pl)
1036 return atomic_read(&pl->pl_granted);
1039 static struct ptlrpc_thread *ldlm_pools_thread;
1040 static struct shrinker *ldlm_pools_srv_shrinker;
1041 static struct shrinker *ldlm_pools_cli_shrinker;
1042 static struct completion ldlm_pools_comp;
1045 * Cancel \a nr locks from all namespaces (if possible). Returns number of
1046 * cached locks after shrink is finished. All namespaces are asked to
1047 * cancel approximately equal amount of locks to keep balancing.
1049 static int ldlm_pools_shrink(ldlm_side_t client, int nr,
1050 unsigned int gfp_mask)
1052 int total = 0, cached = 0, nr_ns;
1053 struct ldlm_namespace *ns;
1055 if (nr != 0 && !(gfp_mask & __GFP_FS))
1058 CDEBUG(D_DLMTRACE, "Request to shrink %d %s locks from all pools\n",
1059 nr, client == LDLM_NAMESPACE_CLIENT ? "client" : "server");
1062 * Find out how many resources we may release.
1064 for (nr_ns = atomic_read(ldlm_namespace_nr(client));
1067 mutex_down(ldlm_namespace_lock(client));
1068 if (list_empty(ldlm_namespace_list(client))) {
1069 mutex_up(ldlm_namespace_lock(client));
1072 ns = ldlm_namespace_first_locked(client);
1073 ldlm_namespace_get(ns);
1074 ldlm_namespace_move_locked(ns, client);
1075 mutex_up(ldlm_namespace_lock(client));
1076 total += ldlm_pool_shrink(&ns->ns_pool, 0, gfp_mask);
1077 ldlm_namespace_put(ns, 1);
1080 if (nr == 0 || total == 0)
1084 * Shrink at least ldlm_namespace_nr(client) namespaces.
1086 for (nr_ns = atomic_read(ldlm_namespace_nr(client));
1089 int cancel, nr_locks;
1092 * Do not call shrink under ldlm_namespace_lock(client)
1094 mutex_down(ldlm_namespace_lock(client));
1095 if (list_empty(ldlm_namespace_list(client))) {
1096 mutex_up(ldlm_namespace_lock(client));
1098 * If list is empty, we can't return any @cached > 0,
1099 * that probably would cause needless shrinker
1105 ns = ldlm_namespace_first_locked(client);
1106 ldlm_namespace_get(ns);
1107 ldlm_namespace_move_locked(ns, client);
1108 mutex_up(ldlm_namespace_lock(client));
1110 nr_locks = ldlm_pool_granted(&ns->ns_pool);
1111 cancel = 1 + nr_locks * nr / total;
1112 ldlm_pool_shrink(&ns->ns_pool, cancel, gfp_mask);
1113 cached += ldlm_pool_granted(&ns->ns_pool);
1114 ldlm_namespace_put(ns, 1);
1119 static int ldlm_pools_srv_shrink(int nr, unsigned int gfp_mask)
1121 return ldlm_pools_shrink(LDLM_NAMESPACE_SERVER, nr, gfp_mask);
1124 static int ldlm_pools_cli_shrink(int nr, unsigned int gfp_mask)
1126 return ldlm_pools_shrink(LDLM_NAMESPACE_CLIENT, nr, gfp_mask);
1129 void ldlm_pools_recalc(ldlm_side_t client)
1131 __u32 nr_l = 0, nr_p = 0, l;
1132 struct ldlm_namespace *ns;
1136 * No need to setup pool limit for client pools.
1138 if (client == LDLM_NAMESPACE_SERVER) {
1140 * Check all modest namespaces first.
1142 mutex_down(ldlm_namespace_lock(client));
1143 list_for_each_entry(ns, ldlm_namespace_list(client),
1146 if (ns->ns_appetite != LDLM_NAMESPACE_MODEST)
1149 l = ldlm_pool_granted(&ns->ns_pool);
1154 * Set the modest pools limit equal to their avg granted
1157 l += dru(l * LDLM_POOLS_MODEST_MARGIN, 100);
1158 ldlm_pool_setup(&ns->ns_pool, l);
1164 * Make sure that modest namespaces did not eat more that 2/3
1167 if (nr_l >= 2 * (LDLM_POOL_HOST_L / 3)) {
1168 CWARN("\"Modest\" pools eat out 2/3 of server locks "
1169 "limit (%d of %lu). This means that you have too "
1170 "many clients for this amount of server RAM. "
1171 "Upgrade server!\n", nr_l, LDLM_POOL_HOST_L);
1176 * The rest is given to greedy namespaces.
1178 list_for_each_entry(ns, ldlm_namespace_list(client),
1181 if (!equal && ns->ns_appetite != LDLM_NAMESPACE_GREEDY)
1186 * In the case 2/3 locks are eaten out by
1187 * modest pools, we re-setup equal limit
1190 l = LDLM_POOL_HOST_L /
1191 atomic_read(ldlm_namespace_nr(client));
1194 * All the rest of greedy pools will have
1195 * all locks in equal parts.
1197 l = (LDLM_POOL_HOST_L - nr_l) /
1198 (atomic_read(ldlm_namespace_nr(client)) -
1201 ldlm_pool_setup(&ns->ns_pool, l);
1203 mutex_up(ldlm_namespace_lock(client));
1207 * Recalc at least ldlm_namespace_nr(client) namespaces.
1209 for (nr = atomic_read(ldlm_namespace_nr(client)); nr > 0; nr--) {
1211 * Lock the list, get first @ns in the list, getref, move it
1212 * to the tail, unlock and call pool recalc. This way we avoid
1213 * calling recalc under @ns lock what is really good as we get
1214 * rid of potential deadlock on client nodes when canceling
1215 * locks synchronously.
1217 mutex_down(ldlm_namespace_lock(client));
1218 if (list_empty(ldlm_namespace_list(client))) {
1219 mutex_up(ldlm_namespace_lock(client));
1222 ns = ldlm_namespace_first_locked(client);
1223 ldlm_namespace_get(ns);
1224 ldlm_namespace_move_locked(ns, client);
1225 mutex_up(ldlm_namespace_lock(client));
1228 * After setup is done - recalc the pool.
1230 ldlm_pool_recalc(&ns->ns_pool);
1231 ldlm_namespace_put(ns, 1);
1234 EXPORT_SYMBOL(ldlm_pools_recalc);
1236 static int ldlm_pools_thread_main(void *arg)
1238 struct ptlrpc_thread *thread = (struct ptlrpc_thread *)arg;
1239 char *t_name = "ldlm_poold";
1242 cfs_daemonize(t_name);
1243 thread->t_flags = SVC_RUNNING;
1244 cfs_waitq_signal(&thread->t_ctl_waitq);
1246 CDEBUG(D_DLMTRACE, "%s: pool thread starting, process %d\n",
1247 t_name, cfs_curproc_pid());
1250 struct l_wait_info lwi;
1253 * Recal all pools on this tick.
1255 ldlm_pools_recalc(LDLM_NAMESPACE_SERVER);
1256 ldlm_pools_recalc(LDLM_NAMESPACE_CLIENT);
1259 * Wait until the next check time, or until we're
1262 lwi = LWI_TIMEOUT(cfs_time_seconds(LDLM_POOLS_THREAD_PERIOD),
1264 l_wait_event(thread->t_ctl_waitq, (thread->t_flags &
1265 (SVC_STOPPING|SVC_EVENT)),
1268 if (thread->t_flags & SVC_STOPPING) {
1269 thread->t_flags &= ~SVC_STOPPING;
1271 } else if (thread->t_flags & SVC_EVENT) {
1272 thread->t_flags &= ~SVC_EVENT;
1276 thread->t_flags = SVC_STOPPED;
1277 cfs_waitq_signal(&thread->t_ctl_waitq);
1279 CDEBUG(D_DLMTRACE, "%s: pool thread exiting, process %d\n",
1280 t_name, cfs_curproc_pid());
1282 complete_and_exit(&ldlm_pools_comp, 0);
1285 static int ldlm_pools_thread_start(void)
1287 struct l_wait_info lwi = { 0 };
1291 if (ldlm_pools_thread != NULL)
1294 OBD_ALLOC_PTR(ldlm_pools_thread);
1295 if (ldlm_pools_thread == NULL)
1298 init_completion(&ldlm_pools_comp);
1299 cfs_waitq_init(&ldlm_pools_thread->t_ctl_waitq);
1302 * CLONE_VM and CLONE_FILES just avoid a needless copy, because we
1303 * just drop the VM and FILES in ptlrpc_daemonize() right away.
1305 rc = cfs_kernel_thread(ldlm_pools_thread_main, ldlm_pools_thread,
1306 CLONE_VM | CLONE_FILES);
1308 CERROR("Can't start pool thread, error %d\n",
1310 OBD_FREE(ldlm_pools_thread, sizeof(*ldlm_pools_thread));
1311 ldlm_pools_thread = NULL;
1314 l_wait_event(ldlm_pools_thread->t_ctl_waitq,
1315 (ldlm_pools_thread->t_flags & SVC_RUNNING), &lwi);
1319 static void ldlm_pools_thread_stop(void)
1323 if (ldlm_pools_thread == NULL) {
1328 ldlm_pools_thread->t_flags = SVC_STOPPING;
1329 cfs_waitq_signal(&ldlm_pools_thread->t_ctl_waitq);
1332 * Make sure that pools thread is finished before freeing @thread.
1333 * This fixes possible race and oops due to accessing freed memory
1336 wait_for_completion(&ldlm_pools_comp);
1337 OBD_FREE_PTR(ldlm_pools_thread);
1338 ldlm_pools_thread = NULL;
1342 int ldlm_pools_init(void)
1347 rc = ldlm_pools_thread_start();
1349 ldlm_pools_srv_shrinker = set_shrinker(DEFAULT_SEEKS,
1350 ldlm_pools_srv_shrink);
1351 ldlm_pools_cli_shrinker = set_shrinker(DEFAULT_SEEKS,
1352 ldlm_pools_cli_shrink);
1356 EXPORT_SYMBOL(ldlm_pools_init);
1358 void ldlm_pools_fini(void)
1360 if (ldlm_pools_srv_shrinker != NULL) {
1361 remove_shrinker(ldlm_pools_srv_shrinker);
1362 ldlm_pools_srv_shrinker = NULL;
1364 if (ldlm_pools_cli_shrinker != NULL) {
1365 remove_shrinker(ldlm_pools_cli_shrinker);
1366 ldlm_pools_cli_shrinker = NULL;
1368 ldlm_pools_thread_stop();
1370 EXPORT_SYMBOL(ldlm_pools_fini);
1371 #endif /* __KERNEL__ */
1373 #else /* !HAVE_LRU_RESIZE_SUPPORT */
1374 int ldlm_pool_setup(struct ldlm_pool *pl, int limit)
1378 EXPORT_SYMBOL(ldlm_pool_setup);
1380 int ldlm_pool_recalc(struct ldlm_pool *pl)
1384 EXPORT_SYMBOL(ldlm_pool_recalc);
1386 int ldlm_pool_shrink(struct ldlm_pool *pl,
1387 int nr, unsigned int gfp_mask)
1391 EXPORT_SYMBOL(ldlm_pool_shrink);
1393 int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns,
1394 int idx, ldlm_side_t client)
1398 EXPORT_SYMBOL(ldlm_pool_init);
1400 void ldlm_pool_fini(struct ldlm_pool *pl)
1404 EXPORT_SYMBOL(ldlm_pool_fini);
1406 void ldlm_pool_add(struct ldlm_pool *pl, struct ldlm_lock *lock)
1410 EXPORT_SYMBOL(ldlm_pool_add);
1412 void ldlm_pool_del(struct ldlm_pool *pl, struct ldlm_lock *lock)
1416 EXPORT_SYMBOL(ldlm_pool_del);
1418 __u64 ldlm_pool_get_slv(struct ldlm_pool *pl)
1422 EXPORT_SYMBOL(ldlm_pool_get_slv);
1424 void ldlm_pool_set_slv(struct ldlm_pool *pl, __u64 slv)
1428 EXPORT_SYMBOL(ldlm_pool_set_slv);
1430 __u64 ldlm_pool_get_clv(struct ldlm_pool *pl)
1434 EXPORT_SYMBOL(ldlm_pool_get_clv);
1436 void ldlm_pool_set_clv(struct ldlm_pool *pl, __u64 clv)
1440 EXPORT_SYMBOL(ldlm_pool_set_clv);
1442 __u32 ldlm_pool_get_limit(struct ldlm_pool *pl)
1446 EXPORT_SYMBOL(ldlm_pool_get_limit);
1448 void ldlm_pool_set_limit(struct ldlm_pool *pl, __u32 limit)
1452 EXPORT_SYMBOL(ldlm_pool_set_limit);
1454 __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl)
1458 EXPORT_SYMBOL(ldlm_pool_get_lvf);
1460 int ldlm_pools_init(void)
1464 EXPORT_SYMBOL(ldlm_pools_init);
1466 void ldlm_pools_fini(void)
1470 EXPORT_SYMBOL(ldlm_pools_fini);
1472 void ldlm_pools_recalc(ldlm_side_t client)
1476 EXPORT_SYMBOL(ldlm_pools_recalc);
1477 #endif /* HAVE_LRU_RESIZE_SUPPORT */