Remove get_vmalloc_info() wrapper

The get_vmalloc_info() function was used to back the vmem_size()
function.  This was always problematic and resulted in brittle
code because the kernel never provided a clean interface for
modules.

However, it turns out that the only caller of this function in
ZFS uses it to determine the total virtual address space size.
This can be determined easily without get_vmalloc_info() so
vmem_size() has been updated to take this approach which allows
us to shed the get_vmalloc_info() dependency.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
Brian Behlendorf
2014-10-01 18:05:39 -04:00
parent 50e41ab1e1
commit e1310afae3
4 changed files with 8 additions and 182 deletions
+4 -31
View File
@@ -60,40 +60,13 @@ extern vmem_t *zio_arena; /* arena for allocating zio memory */
extern pgcnt_t spl_kmem_availrmem(void);
extern size_t vmem_size(vmem_t *vmp, int typemask);
/*
* The following symbols are available for use within the kernel
* itself, and they used to be available in older kernels. But it
* looks like they have been removed perhaps due to lack of use.
* For our purposes we need them to access the global memory state
* of the system, which is even available to user space process
* in /proc/meminfo. It's odd to me that there is no kernel API
* to get the same information, minimally the proc handler for
* the above mentioned /proc/meminfo file would make use of it.
*/
#define VMEM_ALLOC 0x01
#define VMEM_FREE 0x02
/* Source linux/fs/proc/mmu.c */
#ifndef HAVE_GET_VMALLOC_INFO
#ifdef CONFIG_MMU
#ifndef HAVE_VMALLOC_INFO
struct vmalloc_info {
unsigned long used;
unsigned long largest_chunk;
};
#ifndef VMALLOC_TOTAL
#define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
#endif
typedef void (*get_vmalloc_info_t)(struct vmalloc_info *);
extern get_vmalloc_info_t get_vmalloc_info_fn;
# define VMEM_ALLOC 0x01
# define VMEM_FREE 0x02
# define VMALLOC_TOTAL (VMALLOC_END - VMALLOC_START)
# define get_vmalloc_info(vmi) get_vmalloc_info_fn(vmi)
#else
# error "CONFIG_MMU must be defined"
#endif /* CONFIG_MMU */
#endif /* HAVE_GET_VMALLOC_INFO */
#ifdef HAVE_PGDAT_HELPERS
/* Source linux/mm/mmzone.c */
# ifndef HAVE_FIRST_ONLINE_PGDAT