Commit Graph

3238 Commits

Author SHA1 Message Date
attilio
c53a782d3a MFC 2013-03-03 01:06:24 +00:00
alc
2322e91e7c Revert white space change in the previous commit.
Requested by:	attilio
2013-03-02 18:27:51 +00:00
alc
c5b028cc14 Assert that the trie is empty when a vm object is destroyed.
Since vm objects are allocated from type-stable memory, we don't need to
initialize the trie's root in _vm_object_allocate() on every vm object
allocation.  We can instead do it once in vm_object_zinit().

We don't need to call vm_radix_reclaim_allnodes() in vm_object_terminate()
unless the resident page count is non-zero.

Reviewed by:	attilio
Sponsored by:	EMC / Isilon Storage Division
2013-03-02 18:18:30 +00:00
alc
90d4aeb975 The value held by the vm object's field pg_color is only considered
valid if the flag OBJ_COLORED is set.  Since _vm_object_allocate()
doesn't set this flag, it needn't initialize pg_color.

Sponsored by:	EMC / Isilon Storage Division
2013-03-02 18:07:29 +00:00
attilio
e98f58faf6 MFC 2013-03-02 14:48:41 +00:00
attilio
89979cd218 Merge from vmcontention 2013-03-02 14:35:15 +00:00
attilio
17028bb6ae MFC 2013-03-02 14:28:31 +00:00
pjd
f07ebb8888 Merge Capsicum overhaul:
- Capability is no longer separate descriptor type. Now every descriptor
  has set of its own capability rights.

- The cap_new(2) system call is left, but it is no longer documented and
  should not be used in new code.

- The new syscall cap_rights_limit(2) should be used instead of
  cap_new(2), which limits capability rights of the given descriptor
  without creating a new one.

- The cap_getrights(2) syscall is renamed to cap_rights_get(2).

- If CAP_IOCTL capability right is present we can further reduce allowed
  ioctls list with the new cap_ioctls_limit(2) syscall. List of allowed
  ioctls can be retrived with cap_ioctls_get(2) syscall.

- If CAP_FCNTL capability right is present we can further reduce fcntls
  that can be used with the new cap_fcntls_limit(2) syscall and retrive
  them with cap_fcntls_get(2).

- To support ioctl and fcntl white-listing the filedesc structure was
  heavly modified.

- The audit subsystem, kdump and procstat tools were updated to
  recognize new syscalls.

- Capability rights were revised and eventhough I tried hard to provide
  backward API and ABI compatibility there are some incompatible changes
  that are described in detail below:

	CAP_CREATE old behaviour:
	- Allow for openat(2)+O_CREAT.
	- Allow for linkat(2).
	- Allow for symlinkat(2).
	CAP_CREATE new behaviour:
	- Allow for openat(2)+O_CREAT.

	Added CAP_LINKAT:
	- Allow for linkat(2). ABI: Reuses CAP_RMDIR bit.
	- Allow to be target for renameat(2).

	Added CAP_SYMLINKAT:
	- Allow for symlinkat(2).

	Removed CAP_DELETE. Old behaviour:
	- Allow for unlinkat(2) when removing non-directory object.
	- Allow to be source for renameat(2).

	Removed CAP_RMDIR. Old behaviour:
	- Allow for unlinkat(2) when removing directory.

	Added CAP_RENAMEAT:
	- Required for source directory for the renameat(2) syscall.

	Added CAP_UNLINKAT (effectively it replaces CAP_DELETE and CAP_RMDIR):
	- Allow for unlinkat(2) on any object.
	- Required if target of renameat(2) exists and will be removed by this
	  call.

	Removed CAP_MAPEXEC.

	CAP_MMAP old behaviour:
	- Allow for mmap(2) with any combination of PROT_NONE, PROT_READ and
	  PROT_WRITE.
	CAP_MMAP new behaviour:
	- Allow for mmap(2)+PROT_NONE.

	Added CAP_MMAP_R:
	- Allow for mmap(PROT_READ).
	Added CAP_MMAP_W:
	- Allow for mmap(PROT_WRITE).
	Added CAP_MMAP_X:
	- Allow for mmap(PROT_EXEC).
	Added CAP_MMAP_RW:
	- Allow for mmap(PROT_READ | PROT_WRITE).
	Added CAP_MMAP_RX:
	- Allow for mmap(PROT_READ | PROT_EXEC).
	Added CAP_MMAP_WX:
	- Allow for mmap(PROT_WRITE | PROT_EXEC).
	Added CAP_MMAP_RWX:
	- Allow for mmap(PROT_READ | PROT_WRITE | PROT_EXEC).

	Renamed CAP_MKDIR to CAP_MKDIRAT.
	Renamed CAP_MKFIFO to CAP_MKFIFOAT.
	Renamed CAP_MKNODE to CAP_MKNODEAT.

	CAP_READ old behaviour:
	- Allow pread(2).
	- Disallow read(2), readv(2) (if there is no CAP_SEEK).
	CAP_READ new behaviour:
	- Allow read(2), readv(2).
	- Disallow pread(2) (CAP_SEEK was also required).

	CAP_WRITE old behaviour:
	- Allow pwrite(2).
	- Disallow write(2), writev(2) (if there is no CAP_SEEK).
	CAP_WRITE new behaviour:
	- Allow write(2), writev(2).
	- Disallow pwrite(2) (CAP_SEEK was also required).

	Added convinient defines:

	#define	CAP_PREAD		(CAP_SEEK | CAP_READ)
	#define	CAP_PWRITE		(CAP_SEEK | CAP_WRITE)
	#define	CAP_MMAP_R		(CAP_MMAP | CAP_SEEK | CAP_READ)
	#define	CAP_MMAP_W		(CAP_MMAP | CAP_SEEK | CAP_WRITE)
	#define	CAP_MMAP_X		(CAP_MMAP | CAP_SEEK | 0x0000000000000008ULL)
	#define	CAP_MMAP_RW		(CAP_MMAP_R | CAP_MMAP_W)
	#define	CAP_MMAP_RX		(CAP_MMAP_R | CAP_MMAP_X)
	#define	CAP_MMAP_WX		(CAP_MMAP_W | CAP_MMAP_X)
	#define	CAP_MMAP_RWX		(CAP_MMAP_R | CAP_MMAP_W | CAP_MMAP_X)
	#define	CAP_RECV		CAP_READ
	#define	CAP_SEND		CAP_WRITE

	#define	CAP_SOCK_CLIENT \
		(CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \
		 CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN)
	#define	CAP_SOCK_SERVER \
		(CAP_ACCEPT | CAP_BIND | CAP_GETPEERNAME | CAP_GETSOCKNAME | \
		 CAP_GETSOCKOPT | CAP_LISTEN | CAP_PEELOFF | CAP_RECV | CAP_SEND | \
		 CAP_SETSOCKOPT | CAP_SHUTDOWN)

	Added defines for backward API compatibility:

	#define	CAP_MAPEXEC		CAP_MMAP_X
	#define	CAP_DELETE		CAP_UNLINKAT
	#define	CAP_MKDIR		CAP_MKDIRAT
	#define	CAP_RMDIR		CAP_UNLINKAT
	#define	CAP_MKFIFO		CAP_MKFIFOAT
	#define	CAP_MKNOD		CAP_MKNODAT
	#define	CAP_SOCK_ALL		(CAP_SOCK_CLIENT | CAP_SOCK_SERVER)

Sponsored by:	The FreeBSD Foundation
Reviewed by:	Christoph Mallon <christoph.mallon@gmx.de>
Many aspects discussed with:	rwatson, benl, jonathan
ABI compatibility discussed with:	kib
2013-03-02 00:53:12 +00:00
attilio
31dffb7b33 Merge from vmcontention 2013-02-27 18:25:57 +00:00
attilio
6ff1954532 MFC 2013-02-27 18:23:12 +00:00
attilio
8d28f94790 Merge from vmobj-rwlock:
VM_OBJECT_LOCKED() macro is only used to implement a custom version
of lock assertions right now (which likely spread out thanks to
copy and paste).
Remove it and implement actual assertions.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
Tested by:	pho
2013-02-27 18:12:13 +00:00
attilio
c74a3afc6a Fix compiling. 2013-02-26 23:54:17 +00:00
attilio
74f58faa15 MFC 2013-02-26 23:52:23 +00:00
attilio
cd86838830 Merge from vmcontention 2013-02-26 23:46:19 +00:00
attilio
cbe7c0e167 MFC 2013-02-26 23:43:28 +00:00
attilio
cc89d0bd92 Merge from vmc-playground branch:
Replace the sub-optimal uma_zone_set_obj() primitive with more modern
uma_zone_reserve_kva().  The new primitive reserves before hand
the necessary KVA space to cater the zone allocations and allocates pages
with ALLOC_NOOBJ.  More specifically:
- uma_zone_reserve_kva() does not need an object to cater the backend
  allocator.
- uma_zone_reserve_kva() can cater M_WAITOK requests, in order to
  serve zones which need to do uma_prealloc() too.
- When possible, uma_zone_reserve_kva() uses directly the direct-mapping
  by uma_small_alloc() rather than relying on the KVA / offset
  combination.

The removal of the object attribute allows 2 further changes:
1) _vm_object_allocate() becomes static within vm_object.c
2) VM_OBJECT_LOCK_INIT() is removed.  This function is replaced by
   direct calls to mtx_init() as there is no need to export it anymore
   and the calls aren't either homogeneous anymore: there are now small
   differences between arguments passed to mtx_init().

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc (which also offered almost all the comments)
Tested by:	pho, jhb, davide
2013-02-26 23:35:27 +00:00
attilio
726aa55a61 Merge from vmcontention 2013-02-26 21:17:38 +00:00
attilio
9d00dd1afe MFC 2013-02-26 21:13:09 +00:00
attilio
820ab571ec MFC 2013-02-26 21:09:35 +00:00
attilio
5a60eaa26c Remove white spaces.
Sponsored by:	EMC / Isilon storage division
2013-02-26 20:35:40 +00:00
attilio
43aa55b4cd Revert the moving of vm_object objects initialization:
the objects zone ensures type-stability and thus we want to execute
actual lock initialization only when the objects are brought into the
zone otherwise there could be races between lock threads doing
re-initilization and other threads that want to acquire the lock
without a reference.

Sponsored by:	EMC / Isilon storage division
Reported by:	alc
2013-02-26 20:18:25 +00:00
attilio
210a93e7f7 Merge from vmcontention 2013-02-26 18:18:39 +00:00
attilio
134623836d MFC 2013-02-26 18:11:43 +00:00
attilio
afe5ce0c13 MFC 2013-02-26 17:33:18 +00:00
attilio
49f99b7251 Wrap the sleeps synchronized by the vm_object lock into the specific
macro VM_OBJECT_SLEEP().
This hides some implementation details like the usage of the msleep()
primitive and the necessity to access to the lock address directly.
For this reason VM_OBJECT_MTX() macro is now retired.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
Tested by:	pho
2013-02-26 17:22:08 +00:00
alc
c5315c03fb Update a comment: noobj_alloc() has replaced obj_alloc(), but it doesn't
really make sense for this comment to name specific backend allocators,
instead simply refer to backend allocators.

Sponsored by:	EMC / Isilon Storage Division
2013-02-26 06:38:00 +00:00
attilio
e590e8091e As VM_OBJECT_SLEEP() is a vm_object_t specific function, make
the passed object as the first argument of the function for consistency.

Sponsored by:	EMC / Isilon storage revision
2013-02-26 01:38:12 +00:00
attilio
fc0ecac2f8 Revert wrongly added asserts: lookup and remove from the collection
of cached pages doesn't require the object lock to be held.

Sponsored by:	EMC / Isilon storage division
2013-02-26 00:34:52 +00:00
alc
26f238c055 Revise the comment describing uma_zone_reserve_kva().
Sponsored by:	EMC / Isilon Storage Division
Reviewed by:	attilio
2013-02-26 00:18:50 +00:00
attilio
343c9f6f19 Missing semicolon.
Sponsored by:	EMC / Isilon storage division
Submitted by:	alc
Pointy hat to:	me
2013-02-24 19:10:16 +00:00
attilio
1a753217f3 Simplify return logic.
Sponsored by:	EMC / Isilon storage division
Submitted by:	alc
2013-02-24 19:05:11 +00:00
attilio
69d25b60d5 Merge from vmcontention 2013-02-24 17:11:10 +00:00
attilio
cff31deb1a MFC 2013-02-24 16:50:53 +00:00
attilio
12289fcebc Retire the old UMA primitive uma_zone_set_obj() and replace it with the
more modern uma_zone_reserve_kva(). The difference is that it doesn't
rely anymore on an obj to allocate pages and the slab allocator doesn't
use any more any specific locking but atomic operations to complete
the operation.
Where possible, the uma_small_alloc() is instead used and the uk_kva
member becomes unused.

The subsequent cleanups also brings along the removal of
VM_OBJECT_LOCK_INIT() macro which is not used anymore as the code
can be easilly cleaned up to perform a single mtx_init(), private
to vm_object.c.
For the same reason, _vm_object_allocate() becomes private as well.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
2013-02-24 16:41:36 +00:00
attilio
6b1291b4d1 Do not call vm_radix_lookup_ge() in the reservation system unless
it is absolutely necessary.

Sponsored by:	EMC / Isilon storage division
Submitted by:	alc
2013-02-24 16:10:43 +00:00
attilio
f6d331e804 Fix an inverted check that was reporting indexes wrongly detected
as wrapped.

Sponsored by:	EMC / Isilon storage divison
Reported by:	alc
2013-02-24 16:08:37 +00:00
alc
96feae12e9 Correctly assert that no page already exists at the offset within the
object that is currently being allocated.

Sponsored by:	EMC / Isilon Storage Division
2013-02-23 19:28:31 +00:00
attilio
8702b26c68 Complete the asserts by definining also assertions for
RA_RLOCKED and RA_LOCKED cases.

Sponsored by:	EMC / Isilon storage division
Requested by:	alc
2013-02-21 21:56:51 +00:00
attilio
905e648d42 Hide the details for the assertion for VM_OBJECT_LOCK operations.
Rename current VM_OBJECT_LOCK_ASSERT(foo, RA_WLOCKED) into
VM_OBJECT_ASSERT_WLOCKED(foo)

Sponsored by:	EMC / Isilon storage division
Requested by:	alc
2013-02-21 21:54:53 +00:00
attilio
b2afca4987 Add read mode operations to VM_OBJECT_LOCK* class of functions.
Sponsored by:	EMC / Isilon storage division
2013-02-20 12:06:33 +00:00
attilio
15bf891afe Rename VM_OBJECT_LOCK(), VM_OBJECT_UNLOCK() and VM_OBJECT_TRYLOCK() to
their "write" versions.

Sponsored by:	EMC / Isilon storage division
2013-02-20 12:03:20 +00:00
attilio
1f1e13ca03 There is no need to use VM_OBJECT_LOCKED() as the assertion won't
make the check available in any case if INVARIANTS is switched off.
Remove VM_OBJECT_LOCKED().
2013-02-20 10:51:34 +00:00
attilio
6a2e2ce522 Remove unused VM_OBJECT_LOCKPTR().
Sponsored by:	EMC / Isilon storage division
2013-02-20 10:40:27 +00:00
attilio
658534ed5a Switch vm_object lock to be a rwlock.
* VM_OBJECT_LOCK and VM_OBJECT_UNLOCK are mapped to write operations
* VM_OBJECT_SLEEP() is introduced as a general purpose primitve to
  get a sleep operation using a VM_OBJECT_LOCK() as protection
* The approach must bear with vm_pager.h namespace pollution so many
  files require including directly rwlock.h
2013-02-20 10:38:34 +00:00
alc
88b6705ed6 On arm, like sparc64, the end of the kernel map varies from one type of
machine to another.  Therefore, VM_MAX_KERNEL_ADDRESS can't be a constant.
Instead, #define it to be a variable, vm_max_kernel_address, just like we
do on sparc64.

Reviewed by:	kib
Tested by:	ian
2013-02-18 01:02:48 +00:00
attilio
47d4527f8f Remove an unuseful check as looking up into an empty trie should be
as fast as checking a NULL ptr.

Sponsored by:	EMC / Isilon storage division
2013-02-15 17:22:57 +00:00
attilio
ea8f6ef283 Remove whitespace. 2013-02-15 17:21:41 +00:00
attilio
ebcaab64ea Merge from vmcontention 2013-02-15 16:11:30 +00:00
attilio
b4e24f9126 MFC 2013-02-15 16:08:08 +00:00
attilio
1cf2f4550b On arches with VM_PHYSSEG_DENSE the vm_page_array is larger than
the actual number of vm_page_t that will be derived, so v_page_count
should be used appropriately.

Besides that, add a panic condition in case UMA fails to properly
restrict the area in a way to keep all the desired objects.

Sponsored by:	EMC / Isilon storage division
Reported by:	alc
2013-02-15 16:05:18 +00:00
attilio
757b950804 Remove unused headers. 2013-02-15 15:34:19 +00:00
attilio
daa1f2caab Fix comment. 2013-02-15 14:54:09 +00:00
attilio
fa12391493 Move the radix node zone destructor definition closer to
vm_radix_init() definition.

Sponsored by:	EMC / Isilon storage division
2013-02-15 14:53:42 +00:00
attilio
be627ca24c - When panicing for "too small boot cache" reason, print the actual
cache size value
- Add a way to specify the size of the boot cache at compile time

Sponsored by:	EMC / Isilon storage division
2013-02-15 14:50:36 +00:00
attilio
47ecbcf556 Improve dynamic branch prediction and i-cache utilization:
- Use predict_false() to tag boot-time cache decisions
- Compact boot-time cache allocation into a separate, non-inline,
  function that won't be called most of the times.

Sponsored by:	EMC / Isilon storage division
2013-02-15 14:48:06 +00:00
attilio
af55a9fb46 - Fix style in vm_page_lookup(): there is no whiteline between
assertions and other code in this file.
- Reinsert some comments that were lost during the work but which are
  actual yet, reducing differences with HEAD.

Sponsoed by:	EMC / Isilon storage division
2013-02-15 12:35:16 +00:00
jhb
ca6ecf3ea5 Make VM_NDOMAIN a kernel option so that it can be enabled from a kernel
config file.

Requested by:	phk (ages ago)
MFC after:	1 month
2013-02-14 19:38:04 +00:00
attilio
642ba82fdf Remove an unuseful check on resident_page_count.
vm_radix_lookup_ge() of an empty trie is as fast as checking a
NULL pointer.
2013-02-14 15:25:31 +00:00
attilio
908e129569 Fix style. 2013-02-14 15:24:13 +00:00
attilio
eafe26c8a6 The radix preallocation pages can overfow the biggestone segment, so
use a different scheme for preallocation: reserve few KB of nodes to be
used to cater page allocations before the memory can be efficiently
pre-allocated by UMA.

This at all effects remove boot_pages further carving and along with
this modifies to the boot_pages allocation system and necessity to
initialize the UMA zone before pmap_init().

Reported by:	pho, jhb
2013-02-14 15:23:00 +00:00
attilio
3db337c2ea Grammar.
Sponsored by:	EMC / Isilon storage division
2013-02-13 02:04:49 +00:00
attilio
53f78d1a7d Implement a new algorithm for managing the radix trie which also
includes path-compression. This greatly helps with sparsely populated
tries, where an uncompressed trie may end up by having a lot of
intermediate nodes for very little leaves.

The new algorithm introduces 2 main concepts: the node level and the
node owner.  Every node represents a branch point where the leaves share
the key up to the level specified in the node-level (current level
excluded, of course).  Such key partly shared is the one contained in
the owner.  Of course, the root branch is exempted to keep a valid
owner, because theoretically all the keys are contained in the space
designed by the root branch node.  The search algorithm seems very
intuitive and that is where one should start reading to understand the
full approach.

In the end, the algorithm ends up by demanding only one node per insert
and this is not necessary in all the cases.  To stay safe, we basically
preallocate as many nodes as the number of physical pages are in the
system, using uma_preallocate().  However, this raises 2 concerns:
* As pmap_init() needs to kmem_alloc(), the nodes must be pre-allocated
  when vm_radix_init() is currently called, which is much before UMA
  is fully initialized.  This means that uma_prealloc() will dig into the
  UMA_BOOT_PAGES pool of pages, which is often not enough to keep track
  of such large allocations.
  In order to fix this, change a bit the concept of UMA_BOOT_PAGES and
  vm.boot_pages. More specifically make the UMA_BOOT_PAGES an initial "value"
  as long as vm.boot_pages and extend the boot_pages physical area by as
  many bytes as needed with the information returned by
  vm_radix_allocphys_size().
* A small amount of pages will be held in per-cpu buckets and won't be
  accessible from curcpu, so the vm_radix_node_get() could really panic
  when the pre-allocation pool is close to be exhausted.
  In theory we could pre-allocate more pages than the number of physical
  frames to satisfy such request, but as many insert would happen without
  a node allocation anyway, I think it is safe to assume that the
  over-allocation is already compensating for such problem.
  On the field testing can stand me correct, of course.  This could be
  further helped by the case where we allow a single-page insert to not
  require a complete root node.

The use of pre-allocation gets rid all the non-direct mapping trickery
and introduced lock recursion allowance for vm_page_free_queue.

The nodes children are reduced in number from 32 -> 16 and from 16 -> 8
(for respectively 64 bits and 32 bits architectures).
This would make the children to fit into cacheline for amd64 case,
for example, and in general spawn less cacheline, which may be
helpful in lookup_ge() case.
Also, path-compression cames to help in cases where there are many levels,
making the fallouts of such change less hurting.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	jeff (partially)
Tested by:	flo
2013-02-13 01:19:31 +00:00
attilio
87d8d2eec7 Fix style. 2013-02-10 16:00:14 +00:00
attilio
8743c2878e Fix wrong object reference.
Sponsored by:	EMC / Isilon Storage Division
2013-02-10 01:30:13 +00:00
attilio
25a17068be Remove implementation specific comments from a public interface. 2013-02-07 15:13:35 +00:00
attilio
702feea4c3 Correctly complete r246474. 2013-02-07 15:08:35 +00:00
attilio
5ab232ef16 Strengten checks. 2013-02-07 15:06:45 +00:00
attilio
59f669fb82 Style. 2013-02-07 15:06:04 +00:00
attilio
12b7890c27 Reduce differences with HEAD. 2013-02-07 11:36:34 +00:00
attilio
950536d7a4 Reformat comments to follow original version and re-add correct
locking flags.
2013-02-06 23:48:04 +00:00
attilio
86cff934d5 Do not assume the lock to be held so that this can be used also in
safe cases as a short-cut.
2013-02-06 19:03:48 +00:00
attilio
9066f231e3 Tweak comment to remove splay tree references. 2013-02-06 19:02:46 +00:00
attilio
1bab15985e Make vm_object_cache_is_empty() inline. 2013-02-06 18:59:34 +00:00
attilio
4c22b4bafe Cleanup vm_radix KPI:
- Avoid the return value for vm_radix_insert()
- Name the functions argument per-style(9)
- Avoid to get and return opaque objects but use vm_page_t as vm_radix is
  thought to not really be general code but to cater specifically page
  cache and resident cache.
2013-02-06 18:37:46 +00:00
attilio
3bbca3bce2 Fixup r246423 by adding vm_radix.h includes where it is not present
currently.
2013-02-06 18:33:32 +00:00
attilio
c02c27a33d Avoid a namespace pollution in vm_object.h by defining separately the
structure for vm_radix implementation.
2013-02-06 18:04:28 +00:00
attilio
d3fb98bfb4 Enrich comments on newly added assertions. 2013-02-06 17:47:24 +00:00
attilio
abbe2a9b91 - Move the vm_object_cache_is_empty() prototype to be sorted
alphabetically.
- Change the return type to be boolean_t in order to match what
  vm_page_is_cached() does.
2013-02-06 17:27:41 +00:00
attilio
cde4f0caa2 Fix mismerge. 2013-02-06 17:22:16 +00:00
attilio
22b0de04b3 Reduce diffs against HEAD. 2013-02-06 17:17:11 +00:00
attilio
9d88c5279c Now that vm_page_cache_free() and vm_page_cache_transfer() are
reimplemented as ranged operations, sync vm_page_is_cached() semantic
with HEAD.
2013-02-06 14:50:34 +00:00
attilio
44f85cd1a5 Reduce diffs against HEAD:
Reimplement vm_page_cache_free() as a range operation.
2013-02-06 14:29:05 +00:00
attilio
439c0b8cf1 Reduce diffs against HEAD:
- Reimplement vm_page_cache_transfer() properly
- Remove vm_page_cache_rename() as a subsequent change
2013-02-05 00:09:33 +00:00
attilio
62f53da2e7 Merge from vmcontention 2013-02-04 22:15:36 +00:00
attilio
d3b7ec3a08 MFC 2013-02-04 22:10:01 +00:00
attilio
d61cd60feb Reduce differences with HEAD. 2013-02-04 22:05:22 +00:00
attilio
b972b67ed7 Merge from vmcontention 2013-02-04 15:44:42 +00:00
marius
790d2fce4f Try to improve r242655 take III: move these SYSCTLs describing the kernel
map, which is defined and initialized in vm/vm_kern.c, to the latter.

Submitted by:	alc
2013-02-04 09:35:48 +00:00
attilio
b134f527dc Detect address wrapup without defining the right boundary. 2013-02-04 08:53:51 +00:00
attilio
0d3b58aee0 MFC 2013-02-03 20:13:33 +00:00
glebius
e3e319a0b6 Fix typo in debug printf. 2013-01-29 19:06:16 +00:00
zont
b5edc96a84 - Add system wide page faults requiring I/O counter.
Reviewed by:	alc
MFC after:	2 weeks
2013-01-28 12:54:53 +00:00
zont
875b69507c - Add sysctls to show number of stats scans.
MFC after:	2 weeks
2013-01-28 12:20:20 +00:00
zont
b3905d7835 - Style.
MFC after:	2 weeks
2013-01-28 12:08:29 +00:00
zont
ee65990ea4 - Get rid of unused function vmspace_wired_count().
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-14 12:12:56 +00:00
zont
3b71bce613 - Improve readability of sys_obreak().
Suggested by:	alc
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-11 09:58:35 +00:00
zont
d2863e4c68 - Reduce kernel size by removing unnecessary pointer indirections.
GENERIC kernel size reduced in 16 bytes and RACCT kernel in 336 bytes.

Suggested by:	alc
Reviewed by:	alc
Approved by:	kib (mentor)
MFC after:	1 week
2013-01-10 12:43:58 +00:00
attilio
f458bac614 Remove vm_radix_lookupn() and its usage in the kernel. 2013-01-10 12:30:58 +00:00
ken
1abc90f894 Fix a bug in the device pager code that can trigger an assertion
in devfs if a particular race condition is hit in the device pager
code.

This was a side effect of change 227530 which changed the device
pager interface to call a new destructor routine for the cdev.
That destructor routine, old_dev_pager_dtor(), takes a VM object
handle.

The object handle is cast to a struct cdev *, and passed into
dev_rel().

That works in most cases, except the case in cdev_pager_allocate()
where there is a race condition between two threads allocating an
object backed by the same device.  The loser of the race
deallocates its object at the end of the function.

The problem is that before inserting the object into the
dev_pager_object_list, the object's handle is changed from the
struct cdev pointer to the object's own address.  This is to avoid
conflicts with the winner of the race, which already inserted an
object in the list with a handle that is a pointer to the same cdev
structure.

The object is then passed to vm_object_deallocate(), and eventually
makes its way down to old_dev_pager_dtor().  That function passes
the handle pointer (which is actually a VM object, not a struct
cdev as usual) into dev_rel().  dev_rel() decrements the reference
count in the assumed struct cdev (which happens to be 0), and
that triggers the assertion in dev_rel() that the reference count
is greater than or equal to 0.

The fix is to add a cdev pointer to the VM object, and use that
pointer when calling the cdev_pg_dtor() routine.

vm_object.h:	Add a struct cdev pointer to the VM object
		structure.

device_pager.c:	In cdev_pager_allocate(), populate the new cdev
		pointer.

		In dev_pager_dealloc(), use the new cdev pointer
		when calling the object's cdev_pg_dtor() routine.

Reviewed by:	kib
Sponsored by:	Spectra Logic Corporation
MFC after:	1 week
2013-01-09 16:48:38 +00:00
attilio
fcadd67d75 MFC 2012-12-26 08:20:27 +00:00