staging: lustre: use kmalloc for allocating ksock_tx
authorNeilBrown <neilb@suse.com>
Tue, 9 Jan 2018 01:19:38 +0000 (12:19 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Jan 2018 14:41:57 +0000 (15:41 +0100)
The size of the data structure is primarily controlled
by the iovec size, which is limited to 256.
Entries in this vector are 12 bytes, so the whole
will always fit in a page.
So it is safe to use kmalloc (kvmalloc not needed).
So replace LIBCFS_ALLOC with kmalloc.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c

index dc63ed2ceb97e8ae61df8751ea6d13932385af91..7dba949a95a746e44b42c8535bc65d01f4ed594c 100644 (file)
@@ -2282,7 +2282,7 @@ ksocknal_free_buffers(void)
 
                list_for_each_entry_safe(tx, temp, &zlist, tx_list) {
                        list_del(&tx->tx_list);
-                       LIBCFS_FREE(tx, tx->tx_desc_size);
+                       kfree(tx);
                }
        } else {
                spin_unlock(&ksocknal_data.ksnd_tx_lock);
index 994b6693c6b75a5e3de3add282763931dc1e43ca..11fd3a36424fa30cd47567402fecfac1a1d784c7 100644 (file)
@@ -46,7 +46,7 @@ ksocknal_alloc_tx(int type, int size)
        }
 
        if (!tx)
-               LIBCFS_ALLOC(tx, size);
+               tx = kzalloc(size, GFP_NOFS);
 
        if (!tx)
                return NULL;
@@ -102,7 +102,7 @@ ksocknal_free_tx(struct ksock_tx *tx)
 
                spin_unlock(&ksocknal_data.ksnd_tx_lock);
        } else {
-               LIBCFS_FREE(tx, tx->tx_desc_size);
+               kfree(tx);
        }
 }