4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 only,
8 * as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License version 2 for more details (a copy is included
14 * in the LICENSE file that accompanied this code).
16 * You should have received a copy of the GNU General Public License
17 * version 2 along with this program; If not, see
18 * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
20 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
21 * CA 95054 USA or visit www.sun.com if you need additional information or
27 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
28 * Use is subject to license terms.
30 * Copyright (c) 2012, Intel Corporation.
33 * This file is part of Lustre, http://www.lustre.org/
34 * Lustre is a trademark of Sun Microsystems, Inc.
36 #define DEBUG_SUBSYSTEM S_LNET
39 #include <linux/vmalloc.h>
40 #include <linux/slab.h>
41 #include <linux/highmem.h>
42 #include <libcfs/libcfs.h>
45 cfs_cpt_malloc(struct cfs_cpt_table *cptab, int cpt,
46 size_t nr_bytes, unsigned int flags)
48 return kmalloc_node(nr_bytes, flags,
49 cfs_cpt_spread_node(cptab, cpt));
51 EXPORT_SYMBOL(cfs_cpt_malloc);
54 cfs_cpt_vmalloc(struct cfs_cpt_table *cptab, int cpt, size_t nr_bytes)
56 return vmalloc_node(nr_bytes, cfs_cpt_spread_node(cptab, cpt));
58 EXPORT_SYMBOL(cfs_cpt_vmalloc);
61 cfs_page_cpt_alloc(struct cfs_cpt_table *cptab, int cpt, unsigned int flags)
63 return alloc_pages_node(cfs_cpt_spread_node(cptab, cpt), flags, 0);
65 EXPORT_SYMBOL(cfs_page_cpt_alloc);
68 cfs_mem_cache_cpt_alloc(struct kmem_cache *cachep, struct cfs_cpt_table *cptab,
69 int cpt, unsigned int flags)
71 return kmem_cache_alloc_node(cachep, flags,
72 cfs_cpt_spread_node(cptab, cpt));
74 EXPORT_SYMBOL(cfs_mem_cache_cpt_alloc);