]>
git.proxmox.com Git - mirror_spl-debian.git/blob - include/sys/vmsystm.h
75ae8a9914d788704864d5a83ab9a64c5fc03d29
2 * This file is part of the SPL: Solaris Porting Layer.
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 #ifndef _SPL_VMSYSTM_H
28 #define _SPL_VMSYSTM_H
30 #include <linux/mmzone.h>
32 #include <linux/swap.h>
33 #include <sys/types.h>
34 #include <asm/uaccess.h>
36 /* These values are loosely coupled with the the VM page reclaim.
37 * Linux uses its own heuristics to trigger page reclamation, and
38 * because those interface are difficult to interface with. These
39 * values should only be considered as a rough guide to the system
40 * memory state and not as direct evidence that page reclaimation
41 * is or is not currently in progress.
43 #define ptob(pages) (pages * PAGE_SIZE)
44 #define membar_producer() smp_wmb()
46 #define physmem num_physpages
47 #define freemem nr_free_pages()
48 #define availrmem spl_kmem_availrmem()
50 extern pgcnt_t minfree
; /* Sum of zone->pages_min */
51 extern pgcnt_t desfree
; /* Sum of zone->pages_low */
52 extern pgcnt_t lotsfree
; /* Sum of zone->pages_high */
53 extern pgcnt_t needfree
; /* Always 0 unused in new Solaris */
54 extern pgcnt_t swapfs_minfree
; /* Solaris default value */
55 extern pgcnt_t swapfs_reserve
; /* Solaris default value */
57 extern vmem_t
*heap_arena
; /* primary kernel heap arena */
58 extern vmem_t
*zio_alloc_arena
; /* arena for zio caches */
59 extern vmem_t
*zio_arena
; /* arena for allocating zio memory */
61 #define VMEM_ALLOC 0x01
62 #define VMEM_FREE 0x02
64 extern pgcnt_t
spl_kmem_availrmem(void);
65 extern size_t vmem_size(vmem_t
*vmp
, int typemask
);
67 #define xcopyin(from, to, size) copy_from_user(to, from, size)
68 #define xcopyout(from, to, size) copy_to_user(to, from, size)
71 copyin(const void *from
, void *to
, size_t len
)
73 /* On error copyin routine returns -1 */
74 if (xcopyin(from
, to
, len
))
81 copyout(const void *from
, void *to
, size_t len
)
83 /* On error copyout routine returns -1 */
84 if (xcopyout(from
, to
, len
))
91 copyinstr(const void *from
, void *to
, size_t len
, size_t *done
)
98 /* XXX: Should return ENAMETOOLONG if 'strlen(from) > len' */
101 rc
= copyin(from
, to
, len
- 1);
108 #endif /* SPL_VMSYSTM_H */