diff options
author | Alexander Aring <aahringo@redhat.com> | 2021-11-30 14:47:20 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2021-12-07 12:42:26 -0600 |
commit | e4dc81ed5a8069b8ae56116058ebbad77ff559ec (patch) | |
tree | ad2ceb088783ae41b0d8977222c76fc6413354e1 /fs/dlm/memory.c | |
parent | 3af2326ca0a13cf84aeb75e001e757ff3cefeae9 (diff) | |
download | linux-e4dc81ed5a8069b8ae56116058ebbad77ff559ec.tar.bz2 |
fs: dlm: memory cache for lowcomms hotpath
This patch introduces a kmem cache for dlm_msg handles which are used
always if dlm sends a message out. Even if their are covered by midcomms
layer or not.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/memory.c')
-rw-r--r-- | fs/dlm/memory.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c index 94af986e83c6..ce35c3c19aeb 100644 --- a/fs/dlm/memory.c +++ b/fs/dlm/memory.c @@ -17,6 +17,7 @@ static struct kmem_cache *writequeue_cache; static struct kmem_cache *mhandle_cache; +static struct kmem_cache *msg_cache; static struct kmem_cache *lkb_cache; static struct kmem_cache *rsb_cache; @@ -36,6 +37,10 @@ int __init dlm_memory_init(void) if (!lkb_cache) goto lkb; + msg_cache = dlm_lowcomms_msg_cache_create(); + if (!msg_cache) + goto msg; + rsb_cache = kmem_cache_create("dlm_rsb", sizeof(struct dlm_rsb), __alignof__(struct dlm_rsb), 0, NULL); if (!rsb_cache) @@ -44,6 +49,8 @@ int __init dlm_memory_init(void) return 0; rsb: + kmem_cache_destroy(msg_cache); +msg: kmem_cache_destroy(lkb_cache); lkb: kmem_cache_destroy(mhandle_cache); @@ -57,6 +64,7 @@ void dlm_memory_exit(void) { kmem_cache_destroy(writequeue_cache); kmem_cache_destroy(mhandle_cache); + kmem_cache_destroy(msg_cache); kmem_cache_destroy(lkb_cache); kmem_cache_destroy(rsb_cache); } @@ -129,3 +137,13 @@ void dlm_free_writequeue(struct writequeue_entry *writequeue) { kmem_cache_free(writequeue_cache, writequeue); } + +struct dlm_msg *dlm_allocate_msg(gfp_t allocation) +{ + return kmem_cache_alloc(msg_cache, allocation); +} + +void dlm_free_msg(struct dlm_msg *msg) +{ + kmem_cache_free(msg_cache, msg); +} |