]>
Commit | Line | Data |
---|---|---|
00e5a55c BS |
1 | From: Sunil Mushran <sunil.mushran@oracle.com> |
2 | Date: Thu, 26 Feb 2009 15:00:43 -0800 | |
3 | Subject: ocfs2/dlm: Track number of mles | |
4 | Patch-mainline: 2.6.30 | |
5 | References: bnc#408304 | |
6 | ||
7 | The lifetime of a mle is limited to the duration of the lockres mastery | |
8 | process. While typically this lifetime is fairly short, we have noticed | |
9 | the number of mles explode under certain circumstances. This patch tracks | |
10 | the number of each different types of mles and should help us determine | |
11 | how best to speed up the mastery process. | |
12 | ||
13 | Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> | |
14 | Signed-off-by: Mark Fasheh <mfasheh@suse.com> | |
15 | --- | |
16 | fs/ocfs2/dlm/dlmcommon.h | 5 ++++- | |
17 | fs/ocfs2/dlm/dlmdomain.c | 5 +++++ | |
18 | fs/ocfs2/dlm/dlmmaster.c | 5 +++++ | |
19 | 3 files changed, 14 insertions(+), 1 deletions(-) | |
20 | ||
21 | Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h | |
22 | =================================================================== | |
23 | --- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmcommon.h | |
24 | +++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmcommon.h | |
25 | @@ -52,7 +52,8 @@ | |
26 | enum dlm_mle_type { | |
27 | DLM_MLE_BLOCK, | |
28 | DLM_MLE_MASTER, | |
29 | - DLM_MLE_MIGRATION | |
30 | + DLM_MLE_MIGRATION, | |
31 | + DLM_MLE_NUM_TYPES | |
32 | }; | |
33 | ||
34 | struct dlm_lock_name { | |
35 | @@ -156,6 +157,8 @@ struct dlm_ctxt | |
36 | struct list_head mle_hb_events; | |
37 | ||
38 | /* these give a really vague idea of the system load */ | |
39 | + atomic_t mle_tot_count[DLM_MLE_NUM_TYPES]; | |
40 | + atomic_t mle_cur_count[DLM_MLE_NUM_TYPES]; | |
41 | atomic_t local_resources; | |
42 | atomic_t remote_resources; | |
43 | atomic_t unknown_resources; | |
44 | Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdomain.c | |
45 | =================================================================== | |
46 | --- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmdomain.c | |
47 | +++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmdomain.c | |
48 | @@ -1608,6 +1608,11 @@ static struct dlm_ctxt *dlm_alloc_ctxt(c | |
49 | atomic_set(&dlm->remote_resources, 0); | |
50 | atomic_set(&dlm->unknown_resources, 0); | |
51 | ||
52 | + for (i = 0; i < DLM_MLE_NUM_TYPES; ++i) { | |
53 | + atomic_set(&dlm->mle_tot_count[i], 0); | |
54 | + atomic_set(&dlm->mle_cur_count[i], 0); | |
55 | + } | |
56 | + | |
57 | spin_lock_init(&dlm->work_lock); | |
58 | INIT_LIST_HEAD(&dlm->work_list); | |
59 | INIT_WORK(&dlm->dispatched_work, dlm_dispatch_work); | |
60 | Index: linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmmaster.c | |
61 | =================================================================== | |
62 | --- linux-2.6.27-sle11_ocfs2_update.orig/fs/ocfs2/dlm/dlmmaster.c | |
63 | +++ linux-2.6.27-sle11_ocfs2_update/fs/ocfs2/dlm/dlmmaster.c | |
64 | @@ -325,6 +325,9 @@ static void dlm_init_mle(struct dlm_mast | |
65 | mle->u.mlename.hash = dlm_lockid_hash(name, namelen); | |
66 | } | |
67 | ||
68 | + atomic_inc(&dlm->mle_tot_count[mle->type]); | |
69 | + atomic_inc(&dlm->mle_cur_count[mle->type]); | |
70 | + | |
71 | /* copy off the node_map and register hb callbacks on our copy */ | |
72 | memcpy(mle->node_map, dlm->domain_map, sizeof(mle->node_map)); | |
73 | memcpy(mle->vote_map, dlm->domain_map, sizeof(mle->vote_map)); | |
74 | @@ -467,6 +470,8 @@ static void dlm_mle_release(struct kref | |
75 | /* detach the mle from the domain node up/down events */ | |
76 | __dlm_mle_detach_hb_events(dlm, mle); | |
77 | ||
78 | + atomic_dec(&dlm->mle_cur_count[mle->type]); | |
79 | + | |
80 | /* NOTE: kfree under spinlock here. | |
81 | * if this is bad, we can move this to a freelist. */ | |
82 | kmem_cache_free(dlm_mle_cache, mle); |