vm_page_reserve_pages() and vm_page_allocate_page() will now steal pages from
the inactive queue as needed.
* We currently never steal active pages anymore, but this might need to be
revised later (therefore, the page scanner never waits anymore, but uses
mutex_trylock() to lock a cache).
* The page scanner and writer now both run at normal priority - let's see how
that will work out.
* Introduced an inactive queue.
* Instead of shuffling pages around in the queue (and therefore destroying LRU)
the page stealing mechanism now uses a marker page to be able to release the
page lock without losing its position in the queue.
* The page writer now always grabs the whole release count of the semaphore, so
that there won't be a huge backlog to catch up with.
* vm_page_num_free_pages() now also includes the inactive queue as well as the
reserved pages (they are no longer regarded as free pages).
* Added a insert_page_after() function that inserts a page after another one,
needed by the marker code.
* clear_page() now gets a vm_page instead of a physical address which simplified
some code.
* Removed superfluous initialization of the queues (if those aren't zeroed on
start, we would have serious problems, anyway).
* Removed old and unimplemented dump_free_page_table() ("free_pages") KDL
command.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22506 a95241bf-73f2-0310-859d-f6bbb57e9c96
64 lines
1.5 KiB
C
64 lines
1.5 KiB
C
/*
|
|
* Copyright 2002-2007, Haiku. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
|
|
* Distributed under the terms of the NewOS License.
|
|
*/
|
|
#ifndef _KERNEL_VM_PRIV_H
|
|
#define _KERNEL_VM_PRIV_H
|
|
|
|
|
|
#include <vm_types.h>
|
|
|
|
|
|
/* should make these scale with the system */
|
|
#define DEFAULT_KERNEL_WORKING_SET 1024
|
|
#define DEFAULT_WORKING_SET 256
|
|
#define DEFAULT_MAX_WORKING_SET 65536
|
|
#define DEFAULT_MIN_WORKING_SET 64
|
|
|
|
#define WORKING_SET_INCREMENT 32
|
|
#define WORKING_SET_DECREMENT 32
|
|
|
|
#define PAGE_DAEMON_INTERVAL 500000
|
|
#define PAGE_SCAN_QUANTUM 500
|
|
#define WORKING_SET_ADJUST_INTERVAL 5000000
|
|
#define MAX_FAULTS_PER_SECOND 100
|
|
#define MIN_FAULTS_PER_SECOND 10
|
|
|
|
#define WRITE_COUNT 1024
|
|
#define READ_COUNT 1
|
|
|
|
// reserved area definitions
|
|
#define RESERVED_AREA_ID -1
|
|
#define RESERVED_AVOID_BASE 0x01
|
|
|
|
// page attributes (in addition to B_READ_AREA etc.)
|
|
#define PAGE_MODIFIED 0x1000
|
|
#define PAGE_ACCESSED 0x2000
|
|
#define PAGE_PRESENT 0x4000
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
// Should only be used by vm internals
|
|
status_t vm_page_fault(addr_t address, addr_t faultAddress, bool isWrite,
|
|
bool isUser, addr_t *newip);
|
|
void vm_unreserve_memory(size_t bytes);
|
|
status_t vm_try_reserve_memory(size_t bytes);
|
|
void vm_schedule_page_scanner(uint32 target);
|
|
status_t vm_daemon_init(void);
|
|
|
|
const char *page_state_to_string(int state);
|
|
// for debugging purposes only
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* _KERNEL_VM_PRIV_H */
|
|
|