mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 02:00:31 -04:00
vm: remove pa_index from the machine-independent layer
After the demise of vm_page_lock(), the only remaining uses of pa_index() are in various pmap implementations. In many cases, e.g., amd64, the pmap implementations already provided their own definitions, often identical to the machine-independent one. For those that didn't provide one, this change adds it. Reviewed by: kib, markj Differential Revision: https://reviews.freebsd.org/D50823
This commit is contained in:
parent
7747d82657
commit
330b17e1cf
4 changed files with 6 additions and 11 deletions
|
|
@ -342,7 +342,6 @@ safe_to_clear_referenced(pmap_t pmap, pt_entry_t pte)
|
|||
#define PV_STAT(x) do { } while (0)
|
||||
#endif
|
||||
|
||||
#undef pa_index
|
||||
#ifdef NUMA
|
||||
#define pa_index(pa) ({ \
|
||||
KASSERT((pa) <= vm_phys_segs[vm_phys_nsegs - 1].end, \
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@ uintptr_t moea64_get_unique_vsid(void);
|
|||
#define PV_LOCK_COUNT MAXCPU
|
||||
static struct mtx_padalign pv_lock[PV_LOCK_COUNT];
|
||||
|
||||
#define PV_LOCK_SHIFT 21
|
||||
#define pa_index(pa) ((pa) >> PV_LOCK_SHIFT)
|
||||
|
||||
/*
|
||||
* Cheap NUMA-izing of the pv locks, to reduce contention across domains.
|
||||
* NUMA domains on POWER9 appear to be indexed as sparse memory spaces, with the
|
||||
|
|
@ -145,7 +148,7 @@ static struct mtx_padalign pv_lock[PV_LOCK_COUNT];
|
|||
|
||||
/* Superpage PV lock */
|
||||
|
||||
#define PV_LOCK_SIZE (1<<PDRSHIFT)
|
||||
#define PV_LOCK_SIZE (1 << PV_LOCK_SHIFT)
|
||||
|
||||
static __always_inline void
|
||||
moea64_sp_pv_lock(vm_paddr_t pa)
|
||||
|
|
|
|||
|
|
@ -183,12 +183,13 @@
|
|||
|
||||
#define pmap_l1_pindex(v) (NUL2E + ((v) >> L1_SHIFT))
|
||||
#define pmap_l2_pindex(v) ((v) >> L2_SHIFT)
|
||||
#define pa_index(pa) ((pa) >> L2_SHIFT)
|
||||
#define pa_to_pvh(pa) (&pv_table[pa_index(pa)])
|
||||
|
||||
#define NPV_LIST_LOCKS MAXCPU
|
||||
|
||||
#define PHYS_TO_PV_LIST_LOCK(pa) \
|
||||
(&pv_list_locks[pmap_l2_pindex(pa) % NPV_LIST_LOCKS])
|
||||
(&pv_list_locks[pa_index(pa) % NPV_LIST_LOCKS])
|
||||
|
||||
#define CHANGE_PV_LIST_LOCK_TO_PHYS(lockp, pa) do { \
|
||||
struct rwlock **_lockp = (lockp); \
|
||||
|
|
|
|||
|
|
@ -336,14 +336,6 @@ SLIST_HEAD(spglist, vm_page);
|
|||
extern vm_page_t bogus_page;
|
||||
#endif /* _KERNEL */
|
||||
|
||||
#if defined(__arm__)
|
||||
#define PDRSHIFT PDR_SHIFT
|
||||
#elif !defined(PDRSHIFT)
|
||||
#define PDRSHIFT 21
|
||||
#endif
|
||||
|
||||
#define pa_index(pa) ((pa) >> PDRSHIFT)
|
||||
|
||||
/*
|
||||
* The vm_page's aflags are updated using atomic operations. To set or clear
|
||||
* these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear()
|
||||
|
|
|
|||
Loading…
Reference in a new issue