Those are simple wrappers for numa allocator. We don't need them.
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
do { \
LIBCFS_ALLOC_PRE((size), (mask)); \
(ptr) = (size) <= LIBCFS_VMALLOC_SIZE ? \
- cfs_cpt_malloc((cptab), (cpt), (size), (mask)) : \
- cfs_cpt_vmalloc((cptab), (cpt), (size)); \
+ kmalloc_node((size), (mask), cfs_cpt_spread_node(cptab, cpt)) :\
+ vmalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); \
LIBCFS_ALLOC_POST((ptr), (size)); \
} while (0)
do { __oldfs = get_fs(); set_fs(get_ds());} while(0)
#define MMSPACE_CLOSE set_fs(__oldfs)
-
-/*
- * NUMA allocators
- *
- * NB: we will rename these functions in a separate patch:
- * - rename kmalloc to cfs_malloc
- * - rename kmalloc/free_page to cfs_page_alloc/free
- * - rename kmalloc/free_large to cfs_vmalloc/vfree
- */
-extern void *cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt,
- size_t nr_bytes, unsigned int flags);
-extern void *cfs_cpt_vmalloc(struct cfs_cpt_table *cptab, int cpt,
- size_t nr_bytes);
-extern struct page *cfs_page_cpt_alloc(struct cfs_cpt_table *cptab,
- int cpt, unsigned int flags);
-extern void *cfs_mem_cache_cpt_alloc(struct kmem_cache *cachep,
- struct cfs_cpt_table *cptab,
- int cpt, unsigned int flags);
-
/*
* Shrinker
*/
p->ibp_npages = npages;
for (i = 0; i < npages; i++) {
- p->ibp_pages[i] = cfs_page_cpt_alloc(lnet_cpt_table(), cpt,
- __GFP_IO);
+ p->ibp_pages[i] = alloc_pages_node(
+ cfs_cpt_spread_node(lnet_cpt_table(), cpt),
+ __GFP_IO, 0);
if (p->ibp_pages[i] == NULL) {
CERROR("Can't allocate page %d of %d\n", i, npages);
kiblnd_free_pages(p);
rb->rb_pool = rbp;
for (i = 0; i < npages; i++) {
- page = cfs_page_cpt_alloc(lnet_cpt_table(), cpt,
- __GFP_ZERO | GFP_IOFS);
+ page = alloc_pages_node(
+ cfs_cpt_spread_node(lnet_cpt_table(), cpt),
+ __GFP_ZERO | GFP_IOFS, 0);
if (page == NULL) {
while (--i >= 0)
__free_page(rb->rb_kiov[i].kiov_page);
struct page *pg;
int nob;
- pg = cfs_page_cpt_alloc(lnet_cpt_table(), cpt, GFP_IOFS);
+ pg = alloc_pages_node(cfs_cpt_spread_node(lnet_cpt_table(), cpt),
+ GFP_IOFS, 0);
if (pg == NULL) {
CERROR("Can't allocate page %d of %d\n", i, bulk_npg);
srpc_free_bulk(bk);
do { \
(ptr) = (cptab) == NULL ? \
kmalloc(size, flags) : \
- cfs_cpt_malloc(cptab, cpt, size, flags); \
+ kmalloc_node(size, flags, cfs_cpt_spread_node(cptab, cpt)); \
if (unlikely((ptr) == NULL)) { \
CERROR("kmalloc of '" #ptr "' (%d bytes) failed at %s:%d\n", \
(int)(size), __FILE__, __LINE__); \
#define __OBD_MALLOC_VERBOSE(ptr, cptab, cpt, size, flags) \
do { \
(ptr) = (cptab) == NULL ? \
- kmalloc(size, flags) : \
- cfs_cpt_malloc(cptab, cpt, size, flags); \
+ kmalloc(size, flags | __GFP_ZERO) : \
+ kmalloc_node(size, flags | __GFP_ZERO, \
+ cfs_cpt_spread_node(cptab, cpt)); \
if (likely((ptr) != NULL && \
(!HAS_FAIL_ALLOC_FLAG || obd_alloc_fail_rate == 0 || \
!obd_alloc_fail(ptr, #ptr, "km", size, \
__FILE__, __LINE__) || \
OBD_FREE_RTN0(ptr)))){ \
- memset(ptr, 0, size); \
OBD_ALLOC_POST(ptr, size, "kmalloced"); \
} \
} while (0)
# define __OBD_VMALLOC_VEROBSE(ptr, cptab, cpt, size) \
do { \
(ptr) = cptab == NULL ? \
- vmalloc(size) : \
- cfs_cpt_vmalloc(cptab, cpt, size); \
+ vzalloc(size) : \
+ vzalloc_node(size, cfs_cpt_spread_node(cptab, cpt)); \
if (unlikely((ptr) == NULL)) { \
CERROR("vmalloc of '" #ptr "' (%d bytes) failed\n", \
(int)(size)); \
CERROR(LPU64" total bytes allocated by Lustre, %d by LNET\n", \
obd_memory_sum(), atomic_read(&libcfs_kmemory)); \
} else { \
- memset(ptr, 0, size); \
OBD_ALLOC_POST(ptr, size, "vmalloced"); \
} \
} while(0)
do { \
LASSERT(ergo((type) != GFP_ATOMIC, !in_interrupt())); \
(ptr) = (cptab) == NULL ? \
- kmem_cache_alloc(slab, type) : \
- cfs_mem_cache_cpt_alloc(slab, cptab, cpt, type); \
+ kmem_cache_alloc(slab, type | __GFP_ZERO) : \
+ kmem_cache_alloc_node(slab, type | __GFP_ZERO, \
+ cfs_cpt_spread_node(cptab, cpt)); \
if (likely((ptr) != NULL && \
(!HAS_FAIL_ALLOC_FLAG || obd_alloc_fail_rate == 0 || \
!obd_alloc_fail(ptr, #ptr, "slab-", size, \
__FILE__, __LINE__) || \
OBD_SLAB_FREE_RTN0(ptr, slab)))) { \
- memset(ptr, 0, size); \
OBD_ALLOC_POST(ptr, size, "slab-alloced"); \
} \
} while(0)
do { \
(ptr) = (cptab) == NULL ? \
alloc_page(gfp_mask) : \
- cfs_page_cpt_alloc(cptab, cpt, gfp_mask); \
+ alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), gfp_mask, 0);\
if (unlikely((ptr) == NULL)) { \
CERROR("alloc_pages of '" #ptr "' %d page(s) / "LPU64" bytes "\
"failed\n", (int)1, \
obj-$(CONFIG_LUSTRE_FS) += libcfs.o
libcfs-linux-objs := linux-tracefile.o linux-debug.o
-libcfs-linux-objs += linux-prim.o linux-mem.o linux-cpu.o
+libcfs-linux-objs += linux-prim.o linux-cpu.o
libcfs-linux-objs += linux-tcpip.o
libcfs-linux-objs += linux-proc.o linux-curproc.o
libcfs-linux-objs += linux-module.o
+++ /dev/null
-/*
- * GPL HEADER START
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 only,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License version 2 for more details (a copy is included
- * in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU General Public License
- * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- *
- * GPL HEADER END
- */
-/*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- */
-#define DEBUG_SUBSYSTEM S_LNET
-
-#include <linux/mm.h>
-#include <linux/vmalloc.h>
-#include <linux/slab.h>
-#include <linux/highmem.h>
-#include <linux/libcfs/libcfs.h>
-
-/*
- * NB: we will rename some of above functions in another patch:
- * - rename kmalloc to cfs_malloc
- * - rename kmalloc/free_page to cfs_page_alloc/free
- * - rename kmalloc/free_large to cfs_vmalloc/vfree
- */
-
-void *
-cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt,
- size_t nr_bytes, unsigned int flags)
-{
- void *ptr;
-
- ptr = kmalloc_node(nr_bytes, flags,
- cfs_cpt_spread_node(cptab, cpt));
- if (ptr != NULL && (flags & __GFP_ZERO) != 0)
- memset(ptr, 0, nr_bytes);
-
- return ptr;
-}
-EXPORT_SYMBOL(cfs_cpt_malloc);
-
-void *
-cfs_cpt_vmalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes)
-{
- return vmalloc_node(nr_bytes, cfs_cpt_spread_node(cptab, cpt));
-}
-EXPORT_SYMBOL(cfs_cpt_vmalloc);
-
-struct page *
-cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, int cpt, unsigned int flags)
-{
- return alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), flags, 0);
-}
-EXPORT_SYMBOL(cfs_page_cpt_alloc);
-
-void *
-cfs_mem_cache_cpt_alloc(struct kmem_cache *cachep, struct cfs_cpt_table *cptab,
- int cpt, unsigned int flags)
-{
- return kmem_cache_alloc_node(cachep, flags,
- cfs_cpt_spread_node(cptab, cpt));
-}
-EXPORT_SYMBOL(cfs_mem_cache_cpt_alloc);