net/ceph replace ceph_kvmalloc with kvmalloc
Subsystems (3)
PATCH 1/1 net/ceph replace ceph_kvmalloc with kvmalloc
There is nearly no difference between both implemenations. ceph_kvmalloc existed before kvmalloc which makes me think it's a leftover.
Signed-off-by Marc Koderer <[email protected]>
--- net/ceph/buffer.c | 3 +-- net/ceph/ceph_common.c | 11 ----------- net/ceph/crypto.c | 2 +- net/ceph/messenger.c | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-)
net/ceph/buffer.c +1 -2
@@ -7,7 +7,6 @@#include <linux/ceph/buffer.h> #include <linux/ceph/decode.h> -#include <linux/ceph/libceph.h> /* for ceph_kvmalloc */ struct ceph_buffer *ceph_buffer_new (size_t len,gfp_t gfp) {
@@ -17,7 +16,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)if (!b)return NULL ; - b->vec.iov_base =ceph_kvmalloc (len, gfp); + b->vec.iov_base =kvmalloc (len, gfp);if (!b->vec.iov_base) {kfree (b);return NULL ;
net/ceph/ceph_common.c +0 -11
@@ -185,17 +185,6 @@ int ceph_compare_options(struct ceph_options *new_opt, }EXPORT_SYMBOL (ceph_compare_options); -void *ceph_kvmalloc (size_t size,gfp_t flags) -{ -if (size <= (PAGE_SIZE <<PAGE_ALLOC_COSTLY_ORDER )) { -void *ptr =kmalloc (size, flags | __GFP_NOWARN); -if (ptr) -return ptr; - } - -return __vmalloc (size, flags,PAGE_KERNEL ); -} -static int parse_fsid (const char *str,struct ceph_fsid *fsid) {
net/ceph/crypto.c +1 -1
@@ -144,7 +144,7 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key)static const u8 *aes_iv = (u8 *)CEPH_AES_IV ;/* -* Should be used for buffers allocated with ceph_kvmalloc(). +* Should be used for buffers allocated with kvmalloc(). * Currently these are encrypt out-buffer (ceph_buffer) and decrypt * in-buffer (msg front). *
net/ceph/messenger.c +1 -1
@@ -3334,7 +3334,7 @@ struct ceph_msg *ceph_msg_new2(int type, int front_len, int max_data_items,/* front */ if (front_len) { - m->front.iov_base =ceph_kvmalloc (front_len, flags); + m->front.iov_base =kvmalloc (front_len, flags);if (m->front.iov_base ==NULL ) {dout ("ceph_msg_new can't allocate %d bytes\n" , front_len);
Signature · 1 line
2.22.0
Ilya Dryomov
maintainerQuoted 74 lines · Marc Koderer
There is nearly no difference between both implemenations.
ceph_kvmallocexisted before kvmalloc which makes me think it's a leftover.Signed-off-by Marc Koderer <[email protected]>--- net/ceph/buffer.c | 3 +-- net/ceph/ceph_common.c | 11 ----------- net/ceph/crypto.c | 2 +- net/ceph/messenger.c | 2 +- 4 files changed, 3 insertions(+), 15 deletions(-)net/ceph/buffer.c +1
-2@@ -7,7 +7,6 @@#include <linux/ceph/buffer.h> #include <linux/ceph/decode.h> -#include <linux/ceph/libceph.h> /* for ceph_kvmalloc */ struct ceph_buffer *ceph_buffer_new (size_t len,gfp_t gfp) {@@ -17,7 +16,7 @@ struct ceph_buffer *ceph_buffer_new(size_t len, gfp_t gfp)if (!b)return NULL ; - b->vec.iov_base =ceph_kvmalloc (len, gfp); + b->vec.iov_base =kvmalloc (len, gfp);if (!b->vec.iov_base) {kfree (b);return NULL ;net/ceph/ceph_common.c +0
-11@@ -185,17 +185,6 @@ int ceph_compare_options(struct ceph_options *new_opt, }EXPORT_SYMBOL (ceph_compare_options); -void *ceph_kvmalloc (size_t size,gfp_t flags) -{ -if (size <= (PAGE_SIZE <<PAGE_ALLOC_COSTLY_ORDER )) { -void *ptr =kmalloc (size, flags | __GFP_NOWARN); -if (ptr) -return ptr; - } - -return __vmalloc (size, flags,PAGE_KERNEL ); -} -static int parse_fsid (const char *str,struct ceph_fsid *fsid) {net/ceph/crypto.c +1
-1@@ -144,7 +144,7 @@ void ceph_crypto_key_destroy(struct ceph_crypto_key *key)static const u8 *aes_iv = (u8 *)CEPH_AES_IV ;/* -* Should be used for buffers allocated with ceph_kvmalloc(). +* Should be used for buffers allocated with kvmalloc(). * Currently these are encrypt out-buffer (ceph_buffer) and decrypt * in-buffer (msg front). * net/ceph/messenger.c +0
-0
net/ceph/messenger.c struct ceph_msg *ceph_msg_new2(int type, int front_len, int max_data_items, · line 3340
Quoted 8 lines
net/ceph/messenger.c +1
-1@@ -3334,7 +3334,7 @@ struct ceph_msg *ceph_msg_new2(int type, int front_len, int max_data_items,/* front */ if (front_len) { - m->front.iov_base =ceph_kvmalloc (front_len, flags); + m->front.iov_base =kvmalloc (front_len, flags);if (m->front.iov_base ==NULL ) {dout ("ceph_msg_new can't allocate %d bytes\n" , front_len);
Hi Marc,
I'm working on a patch for https://tracker.ceph.com/issues/40481 which changes ceph_kvmalloc() to properly deal with non-GFP_KERNEL contexts. We can't switch to kvmalloc() because it doesn't actually fall back to vmalloc() for GFP_NOFS or GFP_NOIO.
Thanks,
Ilya