Add vm_page_alloc1() and vm_page_free1(), which allocate/free single
VM pages, not associated with any object.
This commit is contained in:
parent
1f8d640c4b
commit
d214d5c30a
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: vm_page.c,v 1.42 1998/03/01 02:24:01 fvdl Exp $ */
|
/* $NetBSD: vm_page.c,v 1.43 1998/03/12 06:25:52 thorpej Exp $ */
|
||||||
|
|
||||||
#define VM_PAGE_ALLOC_MEMORY_STATS
|
#define VM_PAGE_ALLOC_MEMORY_STATS
|
||||||
|
|
||||||
@ -1401,6 +1401,70 @@ vm_page_free(mem)
|
|||||||
{
|
{
|
||||||
|
|
||||||
vm_page_remove(mem);
|
vm_page_remove(mem);
|
||||||
|
vm_page_free1(mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vm_page_alloc1:
|
||||||
|
*
|
||||||
|
* Allocate and return a memory cell with no associated object.
|
||||||
|
*/
|
||||||
|
vm_page_t
|
||||||
|
vm_page_alloc1()
|
||||||
|
{
|
||||||
|
vm_page_t mem;
|
||||||
|
int spl;
|
||||||
|
|
||||||
|
spl = splimp();
|
||||||
|
simple_lock(&vm_page_queue_free_lock);
|
||||||
|
if (vm_page_queue_free.tqh_first == NULL) {
|
||||||
|
simple_unlock(&vm_page_queue_free_lock);
|
||||||
|
splx(spl);
|
||||||
|
return (NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem = vm_page_queue_free.tqh_first;
|
||||||
|
TAILQ_REMOVE(&vm_page_queue_free, mem, pageq);
|
||||||
|
|
||||||
|
cnt.v_free_count--;
|
||||||
|
simple_unlock(&vm_page_queue_free_lock);
|
||||||
|
splx(spl);
|
||||||
|
|
||||||
|
mem->flags = PG_BUSY | PG_CLEAN | PG_FAKE;
|
||||||
|
mem->wire_count = 0;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Decide if we should poke the pageout daemon.
|
||||||
|
* We do this if the free count is less than the low
|
||||||
|
* water mark, or if the free count is less than the high
|
||||||
|
* water mark (but above the low water mark) and the inactive
|
||||||
|
* count is less than its target.
|
||||||
|
*
|
||||||
|
* We don't have the counts locked ... if they change a little,
|
||||||
|
* it doesn't really matter.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (cnt.v_free_count < cnt.v_free_min ||
|
||||||
|
(cnt.v_free_count < cnt.v_free_target &&
|
||||||
|
cnt.v_inactive_count < cnt.v_inactive_target))
|
||||||
|
thread_wakeup((void *)&vm_pages_needed);
|
||||||
|
|
||||||
|
return (mem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* vm_page_free1:
|
||||||
|
*
|
||||||
|
* Returns the given page to the free list.
|
||||||
|
*
|
||||||
|
* The page must already be disassociated with
|
||||||
|
* any objects.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
vm_page_free1(mem)
|
||||||
|
vm_page_t mem;
|
||||||
|
{
|
||||||
|
|
||||||
if (mem->flags & PG_ACTIVE) {
|
if (mem->flags & PG_ACTIVE) {
|
||||||
TAILQ_REMOVE(&vm_page_queue_active, mem, pageq);
|
TAILQ_REMOVE(&vm_page_queue_active, mem, pageq);
|
||||||
mem->flags &= ~PG_ACTIVE;
|
mem->flags &= ~PG_ACTIVE;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: vm_page.h,v 1.25 1998/03/01 02:24:02 fvdl Exp $ */
|
/* $NetBSD: vm_page.h,v 1.26 1998/03/12 06:25:53 thorpej Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1991, 1993
|
* Copyright (c) 1991, 1993
|
||||||
@ -330,6 +330,7 @@ static int vm_physseg_find __P((vm_offset_t, int *));
|
|||||||
|
|
||||||
void vm_page_activate __P((vm_page_t));
|
void vm_page_activate __P((vm_page_t));
|
||||||
vm_page_t vm_page_alloc __P((vm_object_t, vm_offset_t));
|
vm_page_t vm_page_alloc __P((vm_object_t, vm_offset_t));
|
||||||
|
vm_page_t vm_page_alloc1 __P((void));
|
||||||
int vm_page_alloc_memory __P((vm_size_t size, vm_offset_t low,
|
int vm_page_alloc_memory __P((vm_size_t size, vm_offset_t low,
|
||||||
vm_offset_t high, vm_offset_t alignment, vm_offset_t boundary,
|
vm_offset_t high, vm_offset_t alignment, vm_offset_t boundary,
|
||||||
struct pglist *rlist, int nsegs, int waitok));
|
struct pglist *rlist, int nsegs, int waitok));
|
||||||
@ -340,6 +341,7 @@ void vm_page_bootstrap __P((vm_offset_t *, vm_offset_t *));
|
|||||||
void vm_page_copy __P((vm_page_t, vm_page_t));
|
void vm_page_copy __P((vm_page_t, vm_page_t));
|
||||||
void vm_page_deactivate __P((vm_page_t));
|
void vm_page_deactivate __P((vm_page_t));
|
||||||
void vm_page_free __P((vm_page_t));
|
void vm_page_free __P((vm_page_t));
|
||||||
|
void vm_page_free1 __P((vm_page_t));
|
||||||
void vm_page_insert __P((vm_page_t, vm_object_t, vm_offset_t));
|
void vm_page_insert __P((vm_page_t, vm_object_t, vm_offset_t));
|
||||||
vm_page_t vm_page_lookup __P((vm_object_t, vm_offset_t));
|
vm_page_t vm_page_lookup __P((vm_object_t, vm_offset_t));
|
||||||
#if defined(MACHINE_NEW_NONCONTIG)
|
#if defined(MACHINE_NEW_NONCONTIG)
|
||||||
|
Loading…
Reference in New Issue
Block a user