mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-03 12:35:02 +00:00
add support for resizing the the tte_hash of multi-threaded processes
This commit is contained in:
parent
9872e24f3c
commit
34ec92870b
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164497
@ -73,6 +73,6 @@ tte_t tte_hash_update(tte_hash_t hash, vm_offset_t va, tte_t tte_data);
|
||||
|
||||
int tte_hash_needs_resize(tte_hash_t th);
|
||||
|
||||
tte_hash_t tte_hash_resize(tte_hash_t th, uint64_t *scratchval);
|
||||
tte_hash_t tte_hash_resize(tte_hash_t th);
|
||||
|
||||
#endif /* _MACHINE_TTE_HASH_H_ */
|
||||
|
@ -195,6 +195,8 @@ static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
|
||||
static void pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va);
|
||||
static void pmap_remove_tte(pmap_t pmap, tte_t tte_data, vm_offset_t va);
|
||||
static void pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot);
|
||||
static void pmap_tte_hash_resize(pmap_t pmap);
|
||||
|
||||
void pmap_set_ctx_panic(uint64_t error, vm_paddr_t tsb_ra, pmap_t pmap);
|
||||
|
||||
|
||||
@ -903,7 +905,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr,
|
||||
PMAP_UNLOCK(src_pmap);
|
||||
|
||||
if (tte_hash_needs_resize(dst_pmap->pm_hash))
|
||||
dst_pmap->pm_hash = tte_hash_resize(dst_pmap->pm_hash, &dst_pmap->pm_hashscratch);
|
||||
pmap_tte_hash_resize(dst_pmap);
|
||||
sched_unpin();
|
||||
vm_page_unlock_queues();
|
||||
PMAP_UNLOCK(dst_pmap);
|
||||
@ -1048,7 +1050,7 @@ pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot,
|
||||
}
|
||||
|
||||
if (tte_hash_needs_resize(pmap->pm_hash))
|
||||
pmap->pm_hash = tte_hash_resize(pmap->pm_hash, &pmap->pm_hashscratch);
|
||||
pmap_tte_hash_resize(pmap);
|
||||
#ifdef notyet
|
||||
if ((PCPU_GET(curpmap) != kernel_pmap) && (curthread->td_proc->p_numthreads == 1)
|
||||
&& (pmap->pm_tsb_cap_miss_count > pmap->pm_tsb_miss_count >> 2)) {
|
||||
@ -1974,6 +1976,20 @@ pmap_remove_tte(pmap_t pmap, tte_t tte_data, vm_offset_t va)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
pmap_tte_hash_resize(pmap_t pmap)
|
||||
{
|
||||
tte_hash_t old_th = pmap->pm_hash;
|
||||
|
||||
pmap->pm_hash = tte_hash_resize(pmap->pm_hash);
|
||||
|
||||
if (curthread->td_proc->p_numthreads != 1)
|
||||
pmap_ipi(pmap, tl_ttehashupdate, pmap->pm_context, pmap->pm_hashscratch);
|
||||
|
||||
pmap->pm_hashscratch = tte_hash_set_scratchpad_user(pmap->pm_hash, pmap->pm_context);
|
||||
tte_hash_destroy(old_th);
|
||||
}
|
||||
|
||||
/*
|
||||
* pmap_ts_referenced:
|
||||
*
|
||||
|
@ -267,9 +267,7 @@ tte_hash_create(uint64_t context, uint64_t *scratchval)
|
||||
void
|
||||
tte_hash_destroy(tte_hash_t th)
|
||||
{
|
||||
panic("FIXME");
|
||||
|
||||
free_tte_hash(th);
|
||||
tte_hash_cached_free(th);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -617,22 +615,18 @@ tte_hash_update(tte_hash_t th, vm_offset_t va, tte_t tte_data)
|
||||
int
|
||||
tte_hash_needs_resize(tte_hash_t th)
|
||||
{
|
||||
return ((th->th_entries > (1 << (th->th_shift + PAGE_SHIFT - TTE_SHIFT)))
|
||||
&& (th != &kernel_tte_hash) && (curthread->td_proc->p_numthreads == 1));
|
||||
return ((th->th_entries > (1 << (th->th_shift + PAGE_SHIFT - TTE_SHIFT + 1)))
|
||||
&& (th != &kernel_tte_hash));
|
||||
}
|
||||
|
||||
tte_hash_t
|
||||
tte_hash_resize(tte_hash_t th, uint64_t *scratchval)
|
||||
tte_hash_resize(tte_hash_t th)
|
||||
{
|
||||
int i, j, nentries;
|
||||
tte_hash_t newth;
|
||||
tte_hash_entry_t src_entry, dst_entry, newentry;
|
||||
|
||||
/*
|
||||
* only resize single threaded processes for now :-(
|
||||
*/
|
||||
if (th == &kernel_tte_hash || curthread->td_proc->p_numthreads != 1)
|
||||
panic("tte_hash_resize not supported for this pmap");
|
||||
KASSERT(th != &kernel_tte_hash,("tte_hash_resize not supported for this pmap"));
|
||||
|
||||
if ((newth = tte_hash_cached_get((th->th_shift - HASH_ENTRY_SHIFT) + 1)) != NULL) {
|
||||
newth->th_context = th->th_context;
|
||||
@ -662,8 +656,6 @@ tte_hash_resize(tte_hash_t th, uint64_t *scratchval)
|
||||
|
||||
KASSERT(th->th_entries == newth->th_entries,
|
||||
("not all entries copied old=%d new=%d", th->th_entries, newth->th_entries));
|
||||
|
||||
tte_hash_cached_free(th);
|
||||
*scratchval = tte_hash_set_scratchpad_user(newth, newth->th_context);
|
||||
|
||||
return (newth);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user