Commit Graph

17 Commits

Author SHA1 Message Date
attilio
1f27e97ae5 Use atomics for rn_count on leaf node because RED operations happen
without the VM_OBJECT_LOCK held, thus can be concurrent with BLACK ones.
However, also use a write memory barrier in order to not reorder the
operation of decrementing rn_count in respect fetching the pointer.

Discussed with:	jeff
2011-12-06 22:57:48 +00:00
attilio
2436e63a9c - Make rn_count 32-bits as it will naturally pad for 32-bit arches
- Avoid to use atomic to manipulate it at level0 because it seems
  unneeded and introduces a bug on big-endian architectures where only
  the top half (2 bits) of the double-words are written (as sparc64,
  for example, doesn't support atomics at 16-bits) heading to a wrong
  handling of rn_count.

Reported by:	flo, andreast
Found by:	marius
No answer by:	jeff
2011-12-06 19:04:45 +00:00
andreast
8c385e6008 Fix compilation issue on 32-bit targets.
Reviewed by:	attilio
2011-12-05 16:06:12 +00:00
attilio
8fbad61ab4 Revert a change that sneaked in during the last MFC. 2011-12-02 23:21:59 +00:00
attilio
b2701fb716 MFC 2011-12-02 21:45:46 +00:00
attilio
984f9ddc2b - Remove unnecessary checks on rnode in KTR prints
- Track rn_count in KTR prints
- Improve KTR in a way it best fits rn_count tracking
2011-11-29 02:07:07 +00:00
attilio
27cea0290f Fix compile.
Submitted by:	flo
2011-11-28 19:14:38 +00:00
attilio
77442309d8 Improve the diagnostic in the remove case. 2011-11-28 17:26:19 +00:00
attilio
4391f6c279 Fix a bug when the 'rnode' pointer can be NULL and we try to track
the children.  This helps in debugging case.

Reported by:	flo
2011-11-26 14:26:37 +00:00
attilio
062b8ecde4 Add more KTR points for failure in vm_radix_insert(). 2011-11-20 14:51:27 +00:00
attilio
7272c08497 vm_object_terminate() doesn't actually free the pages in the splay
tree.
Reclaim all the nodes related to the radix tree for a specified
vm_object when calling vm_object_terminate() via the newly added
interface vm_radix_reclaim_nodes().
The function is recursive, but we have a well-defined maximum depth,
thus the amount of necessary stack can be easilly calculated.

Reported by:	alc
Discussed and reviewed by:	jeff
2011-11-01 03:40:38 +00:00
jeff
146842f2d2 - Extract part of vm_radix_lookupn() into a function that just finds the
first leaf page in a specified range.  This permits us to make many
   search & operate functions without much code duplication.
 - Make a generic iterator for radix items.
2011-10-30 22:57:42 +00:00
jeff
9e2e6a2980 - Support two types of nodes, red and black, within the same radix tree.
Black nodes support standard active pages and red nodes support cached
   pages.  Red nodes may be removed without the object lock but will not
   collapse unused tree nodes.  Red nodes may not be directly inserted,
   instead a new function is supplied to convert between black and red.
 - Handle cached pages and active pages in the same loop in vm_object_split,
   vm_object_backing_scan, and vm_object_terminate.
 - Retire the splay page handling as the ifdefs are too difficult to
   maintain.
 - Slightly optimize the vm_radix_lookupn() function.
2011-10-30 11:11:04 +00:00
jeff
1f2c60154d - Use a single uintptr_t for the root of the radix node that encodes the
height and a pointer so that the update to the root is atomic.  This
   permits safe lookups in parallel with tree expansion.  Shrinking the
   space requirements is a small bonus.
2011-10-28 03:42:41 +00:00
attilio
588d89046c Use an UMA zone for the radix node. This avoids the problem to check
for the kernel_map/kmem_map recursion because it uses direct mapping
provided by amd64 to avoid object and map search and recursion.

Probabilly all the others architectures using UMA_MD_SMALL_ALLOC are also
fixed by this, but other remains, where the most notable case is i386.
For it a solution has still to be determined.  A way to do this would
be to have a reserved map just for radix node and mark all accesses to
its lock to be witness safe, but that would still be unoptimal due to
the large amount of virtual address space needed to cater the whole
tree.
2011-10-28 01:56:36 +00:00
jeff
e6b90196c0 - Implement vm_radix_lookup_le().
- Fix vm_radix_lookupn() when max == -1 by making the end parameter
   inclusive.
2011-10-23 01:19:01 +00:00
attilio
c2583b6922 Check in an intial implementation of radix tree implementation to replace
the vm object pages splay.

TODO:
- Handle differently the negative keys for having smaller depth
  index nodes (negative keys caming from indirect blocks)
- Fix the get_node() by having support for a low reserved objects
  directly from UMA
- Implement the lookup_le and re-enable VM_NRESERVELEVEL = 1
- Try to rework the superpage splay of idle pages and the cache splay
  for every vm object in order to regain space on vm_page structure
- Verify performance and improve them (likely by having consumers to deal
  with several ranges of pages manually?)

Obtained from:	jeff, Mayur Shardul (GSoC 2009)
2011-10-22 23:34:37 +00:00