Commit Graph

1550 Commits

Author SHA1 Message Date
rmind cdc76ff97e Replace uvm_aobj_cache with kmem(9). 2011-02-11 00:21:18 +00:00
skrll b5b02ca20c Spell uvm_fault_lower_neighbor correctly in UVMHIST_FUNC by using
__func__
2011-02-10 21:05:52 +00:00
pooka 22c822c7f3 Make vmapbuf() return success/error and make physio deal with a
failure.
2011-02-10 14:46:44 +00:00
yamt c6c7ed993c pageobj: remove a wrong assertion. 2011-02-05 13:33:47 +00:00
chuck afca0358a6 udpate license clauses on my code to match the new-style BSD licenses.
verified with Mike Hibler it is ok to remove clause 3 on utah copyright,
as per UCB.
based on diff that rmind@ sent me.

no functional change with this commit.
2011-02-02 20:07:25 +00:00
chuck beb929a933 udpate license clauses on my code to match the new-style BSD licenses.
based on diff that rmind@ sent me.

no functional change with this commit.
2011-02-02 17:53:41 +00:00
chuck f9d8cc1a37 udpate license clauses on chuck^2 code to match the new-style BSD licenses.
based on diff that rmind@ sent me (and confirmed with chs@ via email).

no functional change with this commit.
2011-02-02 15:28:38 +00:00
chuck 40ec801a13 udpate license clauses on my code to match the new-style BSD licenses.
based on second diff that rmind@ sent me.

no functional change with this commit.
2011-02-02 15:25:27 +00:00
chuck 3ba477b154 udpate license clauses on my code to match the new-style BSD licenses.
based on diff that rmind@ sent me.

no functional change with this commit.
2011-02-02 15:13:33 +00:00
enami 40713a94c3 Introducing inner loop prevent us from exiting from the original loop. 2011-01-26 08:49:48 +00:00
matt d32b258b78 When starting the second pass, don't continue the for loop but instead
just test try exceeding limit.
2011-01-25 17:22:43 +00:00
enami 7f4cb8b53c Remove nop code; the code is moved to uao_dropswap_range1() when it is
introduced in rev. 1.75.
2011-01-25 03:34:29 +00:00
matt cb4ebd8be4 Use the (new) KDASSERTMSG 2011-01-24 22:54:01 +00:00
matt 12708a66ee Fix start_hint in "simple" alloc (fencepost error).
When restarting the loop, make sure end is not above current limit.
Do a quick test to see if the physseg is within the range of desired addresses.
2011-01-24 19:13:55 +00:00
he e9075e068f DEBUG does not imply DIAGNOSTIC; make sure we have a non-null
KASSERTMSG implementation (DIAGNOSTIC) so that the variable inside
the DEBUG section gets used.
2011-01-23 21:29:52 +00:00
matt 5f98725eda Fix the corruption of ps->start_hint. 2011-01-22 01:36:27 +00:00
matt 651bde3939 Cleanup/add some asserts. no functional change. 2011-01-21 19:27:09 +00:00
cegger c6a6ce3477 buildfix: use PRIxPADDR for type paddr_t 2011-01-21 16:56:38 +00:00
matt 37726e8583 Improve the efficiency of searching for a contiguous set of free pages. 2011-01-18 21:43:29 +00:00
rmind 7146b2f61d Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete.  Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
2011-01-14 02:06:22 +00:00
enami eaefa873fe Fix bugs introduced by previous commit; allocated page needs to be bound
with the anon, and uvmfault_anonget may be called with ufi NULL.
2011-01-06 05:51:57 +00:00
enami 7b2a66bec9 Fix format string; use PRIu64 for uint64_t. 2011-01-05 21:20:44 +00:00
matt 4d8e8a7e36 Add better color matching selecting free pages. KM pages will now allocated
so that VA and PA have the same color.  On a page fault, choose a physical
page that has the same color as the virtual address.

When allocating kernel memory pages, allow the MD to specify a preferred
VM_FREELIST from which to choose pages.  For machines with large amounts
of memory (> 4GB), all kernel memory to come from <4GB to reduce the amount
of bounce buffering needed with 32bit DMA devices.
2011-01-04 08:26:33 +00:00
matt 5d3db402fb Add a MD hook to indicate a change of vmspace due to exec. (This is useful
to update any cpu flag due to a change to/from a 64bit and a 32bit address
space).  This can set the state needed for copyout/copyin before setregs
is invoked.
2011-01-04 08:21:18 +00:00
matt b3322481fa Print the number of page colors in use with db> show uvm 2011-01-04 08:17:01 +00:00
matt 6a66466f0c Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits.  Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
2010-12-20 00:25:23 +00:00
yamt 473b1715a5 cosmetics. no functional changes.
- constify
- wrap long lines
- assertions
- comments
2010-12-17 22:00:43 +00:00
pooka fe0a6aa142 Remove duplicate asserts from when uvm_fault_lower1() was merged
into uvm_fault_lower() (the duplicates were there already before,
just in different functions).

reported by Alexander Nasonov on tech-kern
2010-12-15 13:44:17 +00:00
matt 9898b7c4fd When panicing due a non-power of 2 pagesize, include the pagesize in the
panic message.
2010-12-11 22:34:03 +00:00
uebayasi 565a3d3094 Make UVM_PAGE_TRKOWN a real flag. 2010-12-09 01:48:05 +00:00
hannken bd8f6f0b8f Always take the object lock before changing vmpage flags. Fixes a deadlock
where a thread is waiting on "genput" but the page in question is neither
BUSY nor WANTED.

No objections from tech-kern@.
2010-11-30 10:55:25 +00:00
mrg 05061c6ad9 put the kernel-only externs back before <machine/pmap.h>. fixes ofppc build. 2010-11-29 09:49:33 +00:00
christos a9bdee4f4d don't leak kernel variables to userland! 2010-11-26 18:51:19 +00:00
uebayasi f4ae5ecf6e Put back VM_PAGE_TO_MD(); pointed out by skrll@, thanks. 2010-11-26 00:45:27 +00:00
uebayasi e3b768e416 Revert vm_physseg allocation changes. A report says that it causes
panics when used with mplayer in heavy load.
2010-11-25 04:45:30 +00:00
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
cegger 7f56ec2e89 build fix: vm_physmem_index is only used with DEBUG.
Fix build when DIAGNOSTIC is enabled but not DEBUG
2010-11-18 11:49:41 +00:00
uebayasi 5cdd3cec1f Optimize DIAGNOSTIC check code. 2010-11-18 08:41:11 +00:00
uebayasi 56df070b0c Fix DIAGNOSTIC physseg find check. 2010-11-18 08:18:31 +00:00
enami 2c376812ef Nowadays, comparing priority against PZERO doesn't make any sense.
Instead, see if a process waits uninterruptibly like ps does,
so that the second column (`b') of default vmstat output prints
some useful value (-t is still broken though).
2010-11-16 03:49:53 +00:00
uebayasi 2bc2c4def2 ... and another. 2010-11-14 15:18:07 +00:00
uebayasi 12d4db54c0 Fix build caused by a last minute change. 2010-11-14 15:16:53 +00:00
uebayasi 26dd1e598f Be a little more friendly to dynamic physical segment registration.
Maintain an array of pointer to struct vm_physseg, instead of struct
array.  So that VM subsystem can take its pointer safely.  Pointer
to this struct will replace raw paddr_t usage in the future.

Dynamic removal is not supported yet.

Only MD data structure changes, no kernel bump needed.

Tested on i386, amd64, powerpc/ibm40x, arm11.
2010-11-14 15:06:34 +00:00
uebayasi 1674b65491 Oops. Fix thinko. 2010-11-14 04:31:02 +00:00
uebayasi c9ff0b160b Platforms that dynamically set PAGE_{SIZE,MASK,SHIFT}, those values are
saved in struct uvmexp.  Expose only the relevant part for symbol users,
so that they don't need to include the whole uvm(9) API.
2010-11-14 04:25:16 +00:00
uebayasi e048abfd86 UVM constants should not rely on sys/lock.h. 2010-11-13 12:50:09 +00:00
uebayasi 6d3191d5b6 Hide uvm/uvm_page.h again to ensure its internal structures are MD.
GENERIC or at least one kernel compile tested for:
	acorn26, acorn32, algor, all, alpha, amd64, amiga, amigappc,
	arc, bebox, bighill, cats, cobalt, dreamcast, ews4800mips,
	hp300, hp700, hpcarm, hpcmips, hpcsh, i386, ibmnws,
	integrator, ixm1200, iyonix, landisk, luna68k, mac68k,
	macppc, mipsco, mmeye, mvme68k, mvmeppc, netwinder, news68k,
	newsmips, next68k, obs266a, ofppc, pmax, pmppc, prep,
	rs6000, sandpoint, sbmips, shark, sidebeach, sparc, sparc64,
	sun2, sun3, usermode, vax, x68k, zaurus
2010-11-13 05:52:55 +00:00
uebayasi 3ebf409bf5 Put back uvm_page.h for now. Sorry for mess. 2010-11-12 12:02:35 +00:00
uebayasi 4f1dd4067f Put VM_PAGE_TO_MD() definition in one place. No functional changes. 2010-11-12 07:59:24 +00:00
uebayasi 77d80f38cd Abstraction fix; move physical address -> per-page metadata (struct
vm_page *) "reverse" lookup code from uvm_page.h to uvm_page.c, to
help migration to not do that.

Likewise move per-page metadata (struct vm_page *) -> physical
address "forward" conversion code into *.c too.  This is called
only low-layer VM and MD code.
2010-11-12 05:23:41 +00:00
uebayasi aa803dbb9d Abstraction fix; move physical address -> physical segment "reverse"
lookup code from uvm_page.h to uvm_page.c.

This code is used by some pmaps to lookup per-page state (PV) from
per-segment metadata (struct vm_physseg).  This is not needed if
UVM looks up physical segment once in fault handler, then directly
passes it to pmap.  This change helps transition to that model.

The only users of vm_physseg_find() are pmap_motorola.c and
powerpc/ibm4xx/pmap.c.

Tested By:	Compiling and running powerpc/ibm4xx/pmap.c
		(evbppc/conf/OPENBLOCKS266)
2010-11-12 03:21:04 +00:00
uebayasi 186b58eb54 Abstraction fix; don't pull in physical segment/page definitions
in UVM external API, uvm_extern.h.  Because most users care only
virtual memory.

Device drivers use bus_dma(9) to manage physical memory.  Device
drivers pull in bus_dma(9) API, bus_dma.h.  bus_dma(9) implementations
pull in UVM internal API, uvm.h.

Tested By:	Compiling i386 ALL kernel
2010-11-12 02:36:02 +00:00
uebayasi 7e090d7604 C style; make a sentinel pointer have an exclusive value; no
functional changes.
2010-11-11 15:59:27 +00:00
uebayasi 4e73439bf8 Typo in a comment. 2010-11-11 15:51:05 +00:00
uebayasi 2d8b28a059 Minor clean up. 2010-11-11 15:47:43 +00:00
uebayasi e2e0c29553 Minor clean up. 2010-11-11 14:50:54 +00:00
uebayasi 04cf143fd6 Use more VM_PHYSMEM_*() accessors. No functional changes. 2010-11-10 09:27:21 +00:00
uebayasi e367a5a854 Prepare vm_physmem[] -> (*vm_physmem)[] migration, so that physical
segments can be changed at run-time.  Pointers are easier to update.
2010-11-10 01:24:46 +00:00
uebayasi 40a5185389 Provide a forward declaration of "struct vm_page", whose internal
is opaque to uvm_pglist.h users.  Users don't need to pull in
uvm_page.h.
2010-11-06 15:48:00 +00:00
uebayasi 41e5df6d3e Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)).  This functionality will be re-added later.
2010-11-06 15:42:43 +00:00
uebayasi b73ba829c6 Include uvm/uvm_pglist.h for struct pglist. 2010-11-06 12:19:14 +00:00
uebayasi 8e3c57e6cc Include uvm/uvm.h because this is part of UVM. 2010-11-06 12:18:17 +00:00
skrll 162991256a Spell immediately correctly. 2010-11-02 20:49:47 +00:00
tsutsui 8e16588b0b Make common kernel module binaries work on both sun3 and sun3x.
Tested on 3/160 (on TME) and (real) 3/80.

XXX: module files can be loaded only on single user?
2010-10-15 15:55:52 +00:00
matt 19e6c76b2d Rename rb.h to rbtree.h, as it is more appropriate (c.f. ptree.h). Also
helps find code that hasn't been updated to use the new rbtree API.
2010-09-25 01:42:38 +00:00
rmind 879d5dfb5e Fixes/improvements to RB-tree implementation:
1. Fix inverted node order, so that negative value from comparison operator
   would represent lower (left) node, and positive - higher (right) node.
2. Add an argument (i.e. "context"), passed to comparison operators.
3. Change rb_tree_insert_node() to return a node - either inserted one or
   already existing one.
4. Amend the interface to manipulate the actual object, instead of the
   rb_node (in a similar way as Patricia-tree interface does).
5. Update all RB-tree users accordingly.

XXX: Perhaps rename rb.h to rbtree.h, since cleaning-up..

1-3 address the PR/43488 by Jeremy Huddleston.

Passes RB-tree regression tests.
Reviewed by: matt@, christos@
2010-09-24 22:51:50 +00:00
pooka 04d191ff71 Make "no options VMSWAP" kernels compile again. 2010-09-07 04:45:22 +00:00
chs fca58884f4 replace the earlier workaround for PR 40389 with a better fix.
the earlier change caused data corruption by freeing pages
without invaliding their mappings.  instead of the trylock/retry,
just take the genfs-node lock before calling VOP_GETPAGES()
and pass a new flag to tell it that we're already holding this lock.
2010-09-01 16:56:19 +00:00
yamt 86b3a16608 sys_mremap: unwrap a short line 2010-08-16 01:21:10 +00:00
hannken c84e81cad1 Add vm page flag PG_MARKER and use it to tag dummy marker pages
in genfs_do_putpages() and uao_put().
Use 'v_uobj.uo_npages' to check for an empty memq.
Put some assertions where these marker pages may not appear.

Ok: YAMAMOTO Takashi <yamt@netbsd.org>
2010-07-29 10:54:50 +00:00
hannken 7296ba383a Replace vget() with vref()/vn_lock(), this node already has a reference. 2010-07-09 08:10:50 +00:00
chs 4c14d1923f switch the UVMHIST counters from mutexes to atomic ops
to avoid a bad interaction with DIAGNOSTIC.
2010-07-07 01:08:51 +00:00
cegger 71e8cdce36 Turn PMAP_NOCACHE into MI flag.
Add MI flags PMAP_WRITE_COMBINE, PMAP_WRITE_BACK, PMAP_NOCACHE_OVR.
Update pmap(9) manpage.

hppa: Remove MD PMAP_NOCACHE flag as it exists as MI flag
mips: Rename MD PMAP_NOCACHE to PGC_NOCACHE.

x86: Implement new MI flags using Page-Attribute Tables.
x86: Implement BUS_SPACE_MAP_PREFETCHABLE.

Patch presented on tech-kern@:
http://mail-index.netbsd.org/tech-kern/2010/06/30/msg008458.html

No comments on this last version.
Forgot to commit this in previous.
2010-07-06 21:11:22 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
rmind 3e68c94985 Keep the lock around pmap_update() where required. While fixing this
in ubc_fault(), rework logic to "remember" the last object of page and
reduce locking overhead, since in common case pages belong to one and
the same UVM object (but not always, therefore add a comment).

Unlocks before pmap_update(), on removal of mappings, might cause TLB
coherency issues, since on architectures like x86 and mips64 invalidation
IPIs are deferred to pmap_update().  Hence, VA space might be globally
visible before IPIs are sent or while they are still in-flight.

OK ad@.
2010-06-22 18:34:50 +00:00
mrg 72ceb9b885 disable some DEBUG code uvm_pglist_add() that has severe performance
problems with large mappings.  i've seen my system hang for a total
of 45 seconds when radeondrm is opened by X11, and it is the checks
in this function that take so long.
2010-06-17 03:13:58 +00:00
pooka cbed8ae4b7 it's a wonderful static 2010-06-02 15:48:49 +00:00
rmind 7bf5bfa1e6 ubc_fault: split-off code part handling a single page into ubc_fault_page(). 2010-05-29 23:17:53 +00:00
rmind 22d67cdea8 uvm_fault_{upper,lower}_done: move drop-swap outside the page-queues lock.
Assert for object lock being held (or ref count 0) in uao_set_swslot().
2010-05-28 23:41:14 +00:00
cegger 07ebeefdd8 Move PMAP_KMPAGE to be used in pmap_kenter_pa flags argument.
'Looks good to me' gimpy@

Forgot to commit this piece in previous commit
2010-05-14 05:32:06 +00:00
cegger dfa8eb2f81 Move PMAP_KMPAGE to be used in pmap_kenter_pa flags argument.
'Looks good to me' gimpy@
2010-05-14 05:02:05 +00:00
ad b746352090 Reduce memory spent on bookkeeping for large values of MAXCPUS. 2010-04-25 15:54:14 +00:00
rmind 5f0ac9a4fa - Merge sched_pstats() and uvm_meter()/uvm_loadav(). Avoids double loop
through all LWPs and duplicate locking overhead.

- Move sched_pstats() from soft-interrupt context to process 0 main loop.
  Avoids blocking effect on real-time threads.  Mostly fixes PR/38792.

Note: it might be worth to move the loop above PRI_PGDAEMON.  Also,
sched_pstats() might be cleaned-up slightly.
2010-04-16 03:21:49 +00:00
mrg 665bf35b1e now that CTLTYPE_BOOL actually works, use it to export vm_page_zero_enable
as vm.idlezero in a way that actually works on big endian systems.
2010-04-11 01:53:03 +00:00
pooka b6d93fa026 For the nfs throttling kludge, test against v_tag == VT_NFS instead
of v_op (the latter imposes linkage).
2010-03-02 21:32:29 +00:00
jym 2c546c52cc Change RSS (resident set size) limit. Instead of setting it arbitrarily
to the total free memory available to the system, use the smallest value
between VM_MAXUSER_ADDRESS and total free memory (having a RSS limit
bigger than VM_MAXUSER_ADDRESS has no real meaning).

Fix a possible int overflow when ptoa(uvmexp.free) is bigger than 4GB
with a 32 bits vaddr_t.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/24/msg007395.html
2010-02-25 23:10:49 +00:00
uebayasi af0ced746a Merge more indirect functions. Some comments. 2010-02-24 15:58:26 +00:00
uebayasi f736e76fa5 uvm_fault_upper_lookup, uvm_fault_upper_neighbor: There is no point to call
pmap_update() without calling pmap_enter().

(Probably calling only once after loop (as done in uvm_fault_lower_lookup())
is enough.  If done so, other threads see entered neighbor pages as reflected
a little latter.)
2010-02-24 06:18:19 +00:00
uebayasi efa838c11f Minor clean up. 2010-02-24 05:26:28 +00:00
uebayasi a9659a6dfb Revert a thinko. 2010-02-24 05:00:55 +00:00
uebayasi 3bf5a87956 Slightly clean up uvm_fault() code path after pmap_enter(). Now tasks
needed for page cache are concentrated in own functions (uvm_fault_*_done()).
2010-02-24 04:32:58 +00:00
uebayasi 79440fb3fd Record if "promote" is done in UVMHIST. Do it for "upper" fault too. 2010-02-24 04:20:45 +00:00
uebayasi b8168569e9 Merge some indirect "lower" fault handlers back. Prompted by rmind@. 2010-02-24 04:18:09 +00:00
jym 7bf36164a7 - Use ctob() instead of ptoa() to obtain physical addresses from frame
numbers. Using ptoa() will cast to vaddr_t, which might no be adequate
for architectures where sizeof(paddr_t) > sizeof(vaddr_t) (like i386 PAE).

- small fix inside AGP heuristics to avoid masking high order bits for
systems with more than 4GB.

Reviewed by bouyer@.

See also http://mail-index.netbsd.org/tech-kern/2010/02/22/msg007373.html
2010-02-24 00:01:11 +00:00
drochner 9783f258ba rename the va0_disabled option and cpp conditional to "disable" as well,
for consistency, and document option and sysctl flag
2010-02-21 13:17:50 +00:00
drochner 1a101ef360 rename the new sysctl to "vm.user_va0_disable", for consistency
with the majority of existing sysctl flags, suggested by yamt
2010-02-20 13:21:58 +00:00
drochner dda500d0d8 Disable mapping of virtual address 0 by user programs per default.
This blocks an easy exploit of kernel bugs leading to dereference
of a NULL pointer on some architectures (eg i386).
The check can be disabled in various ways:
-by CPP definitions in machine/types.h (portmaster's choice)
-by a kernel config option USER_VA0_DISABLED_DEFAULT=0
-at runtime by sysctl vm.user_va0_disabled (cannot be cleared
 at securelevel>0)
2010-02-18 14:57:01 +00:00
joerg d621e29eca Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
2010-02-08 19:02:25 +00:00
mlelstv 3e39181b49 pgo_get needs the page array to be initialized. 2010-02-08 00:02:50 +00:00
mlelstv 5158187dbc Move assertion to make check more clear. 2010-02-08 00:01:39 +00:00
mlelstv 676d68d9ae Make UVMHIST build again. 2010-02-07 23:25:07 +00:00
mlelstv dfd86ea3a8 Use filesystem blocks to address filesystem objects. f_iosize just
happens to be the same for current filesystems.
2010-02-07 15:51:28 +00:00
uebayasi 2903e6d834 __inline -> inline 2010-02-06 12:10:59 +00:00
uebayasi 6f78b42add Make vm_physseg lookup routines take the target vm_physseg. This is for the
coming "managed" device segments.
2010-02-06 02:56:17 +00:00
uebayasi f0cafea3a4 vnode.h is not used here. 2010-02-05 03:49:11 +00:00
uebayasi 31973b36e6 Cosmetic. Shorten some long names. 2010-02-05 02:27:15 +00:00
uebayasi 2b1c626381 Fix !DIAGNOSTIC build. Reported by Geoff Wing. 2010-02-05 00:55:31 +00:00
uebayasi e1b26edd82 Reduce diff between upper/lower neighbor handlers. 2010-02-04 05:48:26 +00:00
uebayasi 58625d0ac1 Merge "obfuscating layers" for readability. Inline some functions.
Requested by rmind@.
2010-02-04 03:32:21 +00:00
uebayasi c0d0f35c5f Move uvm_fault_* static func decls in one place. 2010-02-04 03:19:08 +00:00
uebayasi d0c590668f A few assertions & comments. 2010-02-03 14:02:49 +00:00
uebayasi cfde757678 uvm_fault_lower_generic_io: Reduce diff from uvm_loanuobj(). 2010-02-03 12:40:39 +00:00
uebayasi cd14256881 uvm_fault_lower_generic_io: One missing mutex_exit(vmobjlock). Found while
comparing this function with uvm_loanuobj().  (Part of) these should be
merged.
2010-02-03 07:48:18 +00:00
uebayasi 5f0a89783a uobj->pgops->pgo_get doing PGO_SYNCIO returns a uobjpage whose uobj backpointer
refers to another "uobj" used to call pgo_get.  Revert the wrong assertion
I made.  My bad.

(This and pgo_get's possible ERESTART return value check is the only 2 behavioral
changes I made.)

Reported by drochner@, thanks.
2010-02-02 18:49:23 +00:00
uebayasi 0dceadd765 Don't pass an unnecessary reference to uvm_loanbreak_anon().
Requested by rmind@.
2010-02-02 17:40:43 +00:00
wiz 27b261aabe Missing 'if defined COMPAT13 or COMPAT50' in uvm_swap.c found by cppcheck
and reported by Henning Petersen in PR 42721.
2010-02-02 15:00:34 +00:00
uebayasi 5526267c10 Be consistent to decide if PMAP_WIRED or not. 2010-02-02 06:52:59 +00:00
uebayasi 19fbe1698d Move A->K loan break code to uvm_loan.c. 2010-02-02 06:06:02 +00:00
uebayasi be06afbe24 Indent. 2010-02-02 05:58:16 +00:00
uebayasi a79520c14e uvm_fault: Split "neighbor" fault and loan handling into functions. 2010-02-02 04:35:35 +00:00
uebayasi 49bcc1198b Sort struct uvm_faultctx members for better alignment. 2010-02-02 01:54:48 +00:00
uebayasi 689dab24ea Indent. 2010-02-01 16:12:36 +00:00
uebayasi d99dd23d72 More split. 2010-02-01 16:08:27 +00:00
uebayasi 49c8580e07 Fix build without DIAGNOSTIC. 2010-02-01 11:58:39 +00:00
uebayasi ef11535fc6 uvm_fault: Clarify when to wire what. 2010-02-01 10:22:40 +00:00
uebayasi 3e6fea088d uvm_fault_upper_lookup: This is totally my personal preference, but can't help
adding one goto to reduce one indent.
2010-02-01 09:18:41 +00:00
uebayasi c3f0715aa9 uvm_fault:
- Lower fault routines don't care the vm_anon array found in upper lookup.
  Don't pass the pointer down.
- The flag "shadowed" is known when we lookup upper layer.  Don't need to
  keep in the fault context struct.
2010-02-01 09:06:43 +00:00
uebayasi f7a6581cde Indent. 2010-02-01 08:23:13 +00:00
uebayasi 90da75f6f6 Rewrite uvm_fault() loop using while () than goto. 2010-02-01 08:19:17 +00:00
uebayasi 6ca4a2b7f1 Split uvm_fault() into 2 more functions, uvm_fault_check() and
uvm_fault_upper_lookup().  Omit unnecessary arguments passed around.
2010-02-01 08:16:32 +00:00
uebayasi 82f34a5f99 uvm_fault: Pack variables shared during fault / re-fault into a struct named
uvm_faultctx.  Unfortunately ~all of those values are overriden in various
ways.  Constification doesn't help much...
2010-02-01 06:56:22 +00:00
uebayasi 62e5fa15ec ERESTART is already negative. Give up negating error values to not override
the original values.  Pointed out by rmind@, thanks.

In the lower fault case, if (*pgo_get)() can return ERESTART and we should
re-fault for that remains a question.  The original code just returned the
error, so keep that behaviour for now.  In case (*pgo_get)() really returns
ERESTART, pass EIO to tell the uvm_fault caller that (*pgo_get)() failed.

(As far as I grep callers don't check if the return value is ERESTART or not.
So assuming (*pgo_get)() never returns ERESTART should be a safe bet.)
2010-02-01 05:48:19 +00:00
uebayasi 40b4d371a5 Ax uvm_fault_internal() & break it into functions. "Upper" fault and "lower"
fault routines are separated now.
2010-01-31 17:13:38 +00:00
uebayasi 2359fa84f6 uvm_fault_internal:
Move local variables around to isolate contexts.  Note that remaining variables
are global in that function, and some hold state across re-fault.

Slilently clean-up the "eoff" mess.

(Superfluous braces will go once things settle down.)
2010-01-31 09:20:31 +00:00
uebayasi fd3f38bda1 Indent. 2010-01-31 07:47:29 +00:00
uebayasi 3f944b46d0 uvm_fault_internal: In lower fault handling case, put another goto to clarify
that we don't care lower neighboring pages for the zero-fill object.
2010-01-31 07:46:03 +00:00
uebayasi 19311f603b uvm_fault_internal: Skip another long code segment (lower "neighbor" fault)
by a goto.
2010-01-31 07:37:24 +00:00
uebayasi 51af955674 uvm_fault_internal: Put a goto label "Case1" as well as "Case2". Clarify
that if the faulting page is shadowed, we don't care the lower layer at all.
2010-01-31 07:32:35 +00:00
uebayasi e93a6edc86 Correct previous; fix a miscalculation of offset-into-entry in MADV_SEQUENTIAL
case.  Pointed out by pooka@.
2010-01-31 01:40:12 +00:00
uebayasi 0ab71424a7 Calculate the offset from vm_map_entry's start to vm_page array's start once. 2010-01-30 15:13:25 +00:00
uebayasi 5620716c87 uvm_pageinsert, uvm_pageremove: Pass the uboj, to/from which a pg is
inserted/removed, as an argument, because looking up a back-reference from
pg is redundant.  No functional changes.
2010-01-27 03:56:33 +00:00
uebayasi 25d5583c0d Clean up an internal flag usage. No functional changes. 2010-01-24 15:03:02 +00:00
pooka c3183f3251 The VATTR_NULL/VREF/VHOLD/HOLDRELE() macros lost their will to live
years ago when the kernel was modified to not alter ABI based on
DIAGNOSTIC, and now just call the respective function interfaces
(in lowercase).  Plenty of mix'n match upper/lowercase has creeped
into the tree since then.  Nuke the macros and convert all callsites
to lowercase.

no functional change
2010-01-08 11:35:07 +00:00
rmind 1069745866 Replace few USER_TO_UAREA/UAREA_TO_USER uses, reduce sys/user.h inclusions. 2009-12-17 01:25:10 +00:00
matt 4a8d8a88f8 Use PRIxVADDR... (change a printf/panic -> panic) 2009-12-15 06:15:11 +00:00
matt 438b816270 Use PRIxVADDR ... 2009-12-14 21:19:47 +00:00
pooka faa8e1b3e3 Convert tsleep(&lbolt) to kpause(). Make ltsleep/mtsleep on lbolt
illegal.  I examined all places where lbolt is referenced to make
sure there were pointer aliases of it passed to tsleep, but put a
KASSERT in m/ltsleep() just to be sure.
2009-12-05 22:34:43 +00:00
njoly 6fe3678b7f Make break(2) reject high adresses that wrap to 0 after page rounding. 2009-11-27 12:25:10 +00:00
rmind 7255a0d9d4 Add uvm_lwp_getuarea() and uvm_lwp_setuarea(). OK matt@. 2009-11-21 17:45:02 +00:00
cegger 9480c51b04 Add a flags argument to pmap_kenter_pa(9).
Patch showed on tech-kern@ http://mail-index.netbsd.org/tech-kern/2009/11/04/msg006434.html
No objections.
2009-11-07 07:27:40 +00:00