+struct kmem_cache *lnet_mes_cachep; /* MEs kmem_cache */
+struct kmem_cache *lnet_small_mds_cachep; /* <= LNET_SMALL_MD_SIZE bytes
+ * MDs kmem_cache */
+
+static int
+lnet_descriptor_setup(void)
+{
+ /* create specific kmem_cache for MEs and small MDs (i.e., originally
+ * allocated in <size-xxx> kmem_cache).
+ */
+ lnet_mes_cachep = kmem_cache_create("lnet_MEs", sizeof(lnet_me_t),
+ 0, 0, NULL);
+ if (!lnet_mes_cachep)
+ return -ENOMEM;
+
+ lnet_small_mds_cachep = kmem_cache_create("lnet_small_MDs",
+ LNET_SMALL_MD_SIZE, 0, 0,
+ NULL);
+ if (!lnet_small_mds_cachep)
+ return -ENOMEM;
+
+ return 0;
+}
+
+static void
+lnet_descriptor_cleanup(void)
+{
+
+ if (lnet_small_mds_cachep) {
+ kmem_cache_destroy(lnet_small_mds_cachep);
+ lnet_small_mds_cachep = NULL;
+ }
+
+ if (lnet_mes_cachep) {
+ kmem_cache_destroy(lnet_mes_cachep);
+ lnet_mes_cachep = NULL;
+ }
+}
+