aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/memory.c
diff options
context:
space:
mode:
authorAlexander Aring <aahringo@redhat.com>2021-11-30 14:47:19 -0500
committerDavid Teigland <teigland@redhat.com>2021-12-07 12:42:26 -0600
commit3af2326ca0a13cf84aeb75e001e757ff3cefeae9 (patch)
treedaae6f31a675c8d8296ff4dc319fb2d1fd7bd66d /fs/dlm/memory.c
parent6c547f264077ffeb56390f42ed2a07749dd619b2 (diff)
downloadlinux-3af2326ca0a13cf84aeb75e001e757ff3cefeae9.tar.gz
fs: dlm: memory cache for writequeue_entry
This patch introduces a kmem cache for writequeue entry. A writequeue entry get quite a lot allocated if dlm transmit messages. 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.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 8996c6453ad5c..94af986e83c6d 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -11,9 +11,11 @@
#include "dlm_internal.h"
#include "midcomms.h"
+#include "lowcomms.h"
#include "config.h"
#include "memory.h"
+static struct kmem_cache *writequeue_cache;
static struct kmem_cache *mhandle_cache;
static struct kmem_cache *lkb_cache;
static struct kmem_cache *rsb_cache;
@@ -21,9 +23,13 @@ static struct kmem_cache *rsb_cache;
int __init dlm_memory_init(void)
{
+ writequeue_cache = dlm_lowcomms_writequeue_cache_create();
+ if (!writequeue_cache)
+ goto out;
+
mhandle_cache = dlm_midcomms_cache_create();
if (!mhandle_cache)
- goto out;
+ goto mhandle;
lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb),
__alignof__(struct dlm_lkb), 0, NULL);
@@ -41,12 +47,15 @@ rsb:
kmem_cache_destroy(lkb_cache);
lkb:
kmem_cache_destroy(mhandle_cache);
+mhandle:
+ kmem_cache_destroy(writequeue_cache);
out:
return -ENOMEM;
}
void dlm_memory_exit(void)
{
+ kmem_cache_destroy(writequeue_cache);
kmem_cache_destroy(mhandle_cache);
kmem_cache_destroy(lkb_cache);
kmem_cache_destroy(rsb_cache);
@@ -110,3 +119,13 @@ void dlm_free_mhandle(struct dlm_mhandle *mhandle)
{
kmem_cache_free(mhandle_cache, mhandle);
}
+
+struct writequeue_entry *dlm_allocate_writequeue(void)
+{
+ return kmem_cache_alloc(writequeue_cache, GFP_ATOMIC);
+}
+
+void dlm_free_writequeue(struct writequeue_entry *writequeue)
+{
+ kmem_cache_free(writequeue_cache, writequeue);
+}