Commit Graph

1364 Commits

Author SHA1 Message Date
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
uebayasi
55c6ab5c75 Consistently call amap / uobj layers as upper / lower, because UVM has only
those two layers by design.  Approved by Chuck Cranor some time ago.
2009-11-01 11:16:32 +00:00
rmind
40cf6f3659 Remove uarea swap-out functionality:
- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code.  Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
2009-10-21 21:11:57 +00:00
pooka
fbd53556dc Wipe out the last vestiges of POOL_INIT with one swift stroke. In
most cases, use a proper constructor.  For proplib, give a local
equivalent of POOL_INIT for the kernel object implementation.  This
way the code structure can be preserved, and a local link set is
not hazardous anyway (unless proplib is split to several modules,
but that'll be the day).

tested by booting a kernel in qemu and compile-testing i386/ALL
2009-09-13 18:45:10 +00:00
rmind
34c783b631 uvmspace_unshare: #if 0-out this function. Q: perhaps remove?
AFAIK it was not used for 11 years.
2009-09-06 23:14:19 +00:00
rmind
924c9047ea - Re-enable direct I/O with emap for pipe.
- While not used, #ifdef KVA allocation in emap (so it wont burn the space).
2009-08-29 00:06:43 +00:00
thorpej
071708f29f Use PMAP_ENABLE_PMAP_KMPAGE to enable PMAP_KMPAGE. We still want the bit
defined in the MI space, not in an MD header.
2009-08-19 23:54:33 +00:00
thorpej
1ed65faa16 Rationalize the definition of PMAP_KMPAGE. 2009-08-19 14:58:48 +00:00
matt
01bf4c69be In uvm_kmapent_alloc, Make sure entry is initialized.
Spotted by msaitoh.
2009-08-19 04:53:20 +00:00
thorpej
b4e5923fa5 Move uvm_object-related DDB hooks into uvm_object.c. Put all of the
uvm_map-related DDB stuff in one spot in the file.
2009-08-18 19:16:09 +00:00
thorpej
0d30b9a815 Back-out accidental check-in. 2009-08-18 19:09:18 +00:00
thorpej
21d14bd56b Move uvm_page-related DDB hooks into uvm_page.c. 2009-08-18 19:08:39 +00:00
thorpej
97a2657a66 Add a real API for testing if a page is a managed page, and adjust callers
to stop relying on vm_physseg_find() for this purpose.
2009-08-18 18:06:53 +00:00
yamt
f97310f398 whitespace fixes. no functional changes. 2009-08-18 02:43:49 +00:00
yamt
9373b602f6 uvm_mmap: remove a dead conditional. 2009-08-18 02:41:31 +00:00
yamt
6f5397de19 assertions 2009-08-16 11:06:37 +00:00
matt
a15cb55d9e Fix KASSERT() failure reported by Geoff Wing. 2009-08-13 03:21:03 +00:00
matt
4efef68d70 Fix brain fart. physmem was int not long. 2009-08-11 16:27:08 +00:00
matt
6328246ec5 Add back declaration of physmem but use the existing type (long). 2009-08-11 16:07:24 +00:00
haad
ced21e5799 Remove physmem definition to uintptr_t from another patch. 2009-08-11 09:16:53 +00:00
haad
b760fc6e71 Add uvm_reclaim_hooks support for reclaiming kernel KVA space and memory.
This is used only by zfs where uvm_reclaim hook is added from arc cache.

Oked ad@.
2009-08-10 23:17:29 +00:00
matt
0ad7ebe8ea Revent change to printf. (why can't __func__ concat with other string?) 2009-08-10 16:50:18 +00:00
matt
e1bf8f4b35 Compare vaddr_t against 0, not NULL. 2009-08-10 16:49:30 +00:00
matt
8e96f9bb1a Only swapout uareas if VMSWAP_UAREA is defined (which is should be by default).
If it's not defined and PMAP_MAP_POOLPAGE is defined and USPACE == PAGE_SIZE,
then allocate/map USPACE via uvm_pagealloc/PMAP_MAP_POOLPAGE.

On platforms like MIPS with 16KB pages, this means that uareas (and hence lwp
kernel stacks) will be always be accessible since they will be KSEG0.
2009-08-09 22:19:09 +00:00
matt
3950714196 If PMAP_MAP_POOLPAGE is defined, use it to map kernel map entries. This
avoids TLB pollution on those platforms that define it.
2009-08-09 22:13:07 +00:00
matt
0dee8e59c9 Add [default] option to make UAREAs swappable. Disabling the option makes
them unswappable and therefore allocatable using KSEG/BAT/etc.
2009-08-09 21:58:03 +00:00
pooka
1252aada83 kill uvm_aio_biodone1(). only user was lfs and that uses nestiobuf now. 2009-08-05 14:11:32 +00:00
pooka
5bd015d57e add some advice symbols we'll eventually need 2009-08-05 14:10:33 +00:00
pooka
e0fc658a3c uvm_vnp_zerorange() logically and by implementation more a part of
ubc than uvm_vnode, so move it over.
2009-08-04 23:31:57 +00:00
pooka
c4e6a098a1 kernel opt polish: g/c unnecessary fs_nfs.h and opt_ddb.h 2009-08-04 23:03:01 +00:00
yamt
fac82a77c9 - don't reuse a variable for different purposes.
- KNF a bit.
2009-08-02 16:07:34 +00:00
yamt
010a609f17 - fix extend of unexistent mapping. the problem reported by
Nicolas Joly on current-users@.
- check our reserved entry a little more strictly.
- comments.
2009-08-02 16:03:47 +00:00
yamt
5e1c2c932d - uvm_map_extract: update map->size correctly for !UVM_EXTRACT_CONTIG.
- uvm_map_extract: panic on zero-sized entries.
- make uvm_map_replace static.
2009-08-01 16:35:51 +00:00
yamt
7d4ddb70a2 don't call uvm_map_check with map unlocked. 2009-08-01 15:36:07 +00:00
yamt
61a9b51f82 _uvm_tree_sanity: fix an assertion. 2009-08-01 15:32:02 +00:00
yamt
e4ef86317e _uvm_map_sanity: fix a race which causes "stale hint". 2009-08-01 15:30:33 +00:00
kiyohara
142809ac35 Globalize uvm_emap_size. It use to calculate size of kernel page table.
http://mail-index.netbsd.org/current-users/2009/07/13/msg009983.html
2009-07-20 03:51:42 +00:00
rmind
1be5c7a891 pmap_emap_sync: add an argument, and do not perform pmap_load() during
context switch (pmap_destroy() path seems to be unsafe), instead just
perform tlbflush().  Slightly inefficient, but good enough for now.
2009-07-19 15:17:29 +00:00
rmind
3cee4be877 - Fix rare crashe in the intr_lapic_tlb_bcast() handler: save and setup
%fs on i386, %gs on amd64 registers, before using them.  Otherwise, it
  might be invalid/garbage, eg. IPI can interrupt userspace.

- Explicitly initialize per-CPU emap generation number.

Thanks <drochner> for reporting and testing of patch.
2009-07-09 21:43:16 +00:00
rmind
5c68e5d0ee Ephemeral mapping (emap) implementation. Concept is based on the idea that
activity of other threads will perform the TLB flush for the processes using
emap as a side effect.  To track that, global and per-CPU generation numbers
are used.  This idea was suggested by Andrew Doran; various improvements to
it by me.  Notes:

- For now, zero-copy on pipe is not yet enabled.
- TCP socket code would likely need more work.
- Additional UVM loaning improvements are needed.

Proposed on <tech-kern>, silence there.
Quickly reviewed by <ad>.
2009-06-28 15:18:50 +00:00
mrg
162717ffd2 add a workaround for drm:
for device mmap()'s, if the D_NEGOFFSAFE flag is set, do not check
if the offset is negative.

this should go away with the test itself when all drivers are audited
and checked to not fail with negative offsets.
2009-06-20 19:24:27 +00:00
yamt
3685fcc8e8 change the order of members of vm_anon for better packing. 2009-06-14 21:36:03 +00:00
yamt
16babfa6fb on MADV_WILLNEED, start prefetching backing object's pages. 2009-06-10 01:55:33 +00:00
yamt
c87ccfd341 - add a function to perform explicit read-ahead.
- ra_startio: tweak locking a bit.
2009-06-10 01:54:08 +00:00
yamt
5ebfa691fe wrap long lines. 2009-05-30 04:26:16 +00:00
pooka
ec3ee0abf9 Include some debug print routines if DEBUGPRINT is defined. This
way they can be included without having to include DDB.
(arguably all print routines should be behind #ifdef DEBUGPRINT
and options DDB should define that macro, but I'll tackle that later)
2009-05-03 16:52:54 +00:00
cegger
e3735e2a6b use top-most bits for PMAP_MD_MASK instead something in the middle.
per request from christos@
2009-04-23 06:22:00 +00:00
cegger
1d89a182fb change pmap flags argument from int to u_int.
discussed with christos@ on source-changes-d@
2009-04-21 21:29:58 +00:00
cegger
c275296727 Introduce PMAP_MD_MASK. Reserves PMAP bits for use in MD code.
Presented on tech-kern@, port-i386@ and port-amd64@
ok ad@
2009-04-18 08:48:47 +00:00
rmind
523acc7d68 Avoid few #ifdef KSTACK_CHECK_MAGIC. 2009-04-16 00:17:19 +00:00
yamt
cccbca027b g/c uvm_aiobuf_pool. 2009-03-30 16:36:36 +00:00
ad
f51a17bccf kernel memory guard for DEBUG kernels, proposed on tech-kern.
See kmem_alloc(9) for details.
2009-03-29 10:51:53 +00:00
mrg
fcc023545e - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes.  this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS.  (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information.  (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897.  it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
2009-03-29 01:02:48 +00:00
rmind
9a2646038e Convert some panic() checks to KASSERT()s.
This code is stable and there is no reason to enforce checks.
2009-03-28 21:45:55 +00:00
yamt
ba2f392cdc sys_mremap: whitespace 2009-03-23 02:12:54 +00:00
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
abs
fbcfe9c7af Clarify free_list usage in uvm_page_physload() regarding faster/slower RAM.
Slower RAM should be assigned a higher free_list id.
No functional change to code, just comments and manpage
2009-03-12 12:55:16 +00:00
nonaka
9e67917078 remove "#define PGALLOC_VERBOSE". 2009-03-10 03:27:24 +00:00
reinoud
00f4c1707e For this physical address printing use uintmax_t since on Xen PAE this length
(64) is not the same as the base architecture (32).
2009-03-09 09:53:55 +00:00
nonaka
89a2df757d fix compile failure when PGALLOC_VERBOSE is defined. 2009-03-09 07:00:26 +00:00
christos
fe2579cc6a don't uprintf in non-debug kernels. 2009-03-04 21:52:38 +00:00
mrg
0dd487a2d5 fix some messages function names that are wrong by using __func__. 2009-03-01 01:13:14 +00:00
drochner
605d3094c4 oops - missed a case with PMAP_PAGEIDLEZERO if md code aborts the
zeroing process, from Nicolas Joly
2009-02-27 23:29:08 +00:00
drochner
e66cf328ab -fix two conditions where PQ_FREE was still/already set while the page
was not anymore/yet on the freelist and uvm_fpageqlock was not held
-clear PQ_FREE while the page is in the works of pageidlezero
This avoids that the DMA memory allocator (pglistalloc) grabs a page
which is not on the freelist, leading to a diagnostic panic (with DEBUG)
or freelist corruption. (mostly on X server activation after a VT
switch or suspend/resume because this can allocate megabytes of AGP
memory)
This might fix PR port-i386/38989 by Alan Barrett (in case this was
a multiprocessor).
2009-02-26 18:18:14 +00:00
ad
59fcf21389 PR kern/26878 FFSv2 + softdep = livelock (no free ram)
PR kern/16942 panic with softdep and quotas
PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch
PR kern/26274 softdep panic: allocdirect_merge: ...
PR kern/26374 Long delay before non-root users can write to softdep partitions
PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem
PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption
PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk
PR kern/31981 stopping scsi disk can cause panic (softdep)
PR kern/32116 kernel panic in softdep (assertion failure)
PR kern/32532 softdep_trackbufs deadlock
PR kern/37191 softdep: locking against myself
PR kern/40474 Kernel panic after remounting raid root with softdep

Retire softdep, pass 2. As discussed and later formally announced on the
mailing lists.
2009-02-22 20:28:05 +00:00
yamt
62abd426b4 make some functions static. 2009-02-18 13:16:58 +00:00
skrll
07a88e53a6 Fix printing of tv_sec,tv_usec in UVMHIST. 2009-02-01 14:25:11 +00:00
yamt
cec5254ed7 uvm_swapin: uncomment an assertion which is now ok. 2009-01-31 09:13:09 +00:00
yamt
20c094eb67 uvm_page_unbusy: add an assertion 2009-01-16 07:01:28 +00:00
yamt
09ff411cf6 - g/c stale function prototypes.
- rename UVM_PAGE_HASH_PENALTY to UVM_PAGE_TREE_PENALTY.
2009-01-16 02:33:14 +00:00
mrg
3dfebf9679 catch up with dev_t becoming 64 bit:
- move struct oswapent into uvm_swap.c proper, calling it swapent13
- introduce a new struct swapent50, also only in uvm_swap.c
- stop using struct oswapent inside struct swapent, or struct swapdev
- rename SWAP_OSTATS SWAP_STATS13
- rename SWAP_STATS SWAP_STATS50
- add new SWAP_STATS
- rewrite the handling for SWAP_STATS13, SWAP_STATS50 and SWAP_STATS
2009-01-14 02:20:45 +00:00
yamt
ac54aa2f64 vm_map_locked_p: add comments 2009-01-13 14:04:35 +00:00
yamt
70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
ad
ae6c4143ce Move a couple of calls to pmap_update(). 2008-12-20 11:33:38 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
christos
9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
ad
b5413f0358 It's easier for kernel reserve pages to be consumed because the pagedaemon
serves as less of a barrier these days. Restrict provision of kernel reserve
pages to kmem and one of these cases:

- doing a NOWAIT allocation
- caller is a realtime thread
- caller is a kernel thread
- explicitly requested, for example by the pmap
2008-12-13 11:34:43 +00:00
ad
9d315c5bc9 PR 40027/pagedaemon loops on memory shortage
uvmpd_scan_queue:

- Fix a bug that prevented the pagedaemon from making forward progress
  if (a) swap was full (b) the first 16 pages on the inactive list were
  unbusy anons not already backed by swap.

- Remove redundant uvm_swapisfull() check and just try to allocate a slot.
  If it fails we know swap is full.
2008-12-13 11:26:57 +00:00
ad
f9a4aaf41f PR kern/40027 pagedaemon loops on memory shortage
uvm_swapisfull: don't count some small portion as it may be inaccessible to
us at any given moment, for example if there is lock contention or if pages
are busy.
2008-12-13 11:22:09 +00:00
pooka
ee352f3d33 Make kernel_pmap_ptr a const. Requested by steve_martin. 2008-12-10 11:10:17 +00:00
pooka
29d439f898 Make pmap_kernel() a MI macro for struct pmap *kernel_pmap_ptr,
which is now the "API" provided by the pmap module.  pmap_kernel()
remains as the syntactic sugar.

Bonus cosmetics round: move all the pmap_t pointer typedefs into
uvm_pmap.h.

Thanks to Greg Oster for providing cpu muscle for doing test builds.
2008-12-09 20:45:44 +00:00
pooka
807cdbb61f uvm_loanuobjpages(): "nfsread" -> "loanuopg" in tsleep wmesg 2008-12-03 14:46:24 +00:00
ad
7a2060a7f5 Make adjustment of uvm_extrapages atomic since it's done without a lock.
XXX This is still a hack.
2008-12-03 11:43:51 +00:00
ad
04b3e89c3f uvmpd_tune: make the adjustments to individual variables atomic. 2008-12-02 10:46:43 +00:00
ad
a371a02d26 PR port-amd64/32816 amd64 can not load lkms
Change some assertions to partially allow for VM_MAP_IS_KERNEL(map) where
map is outside the range of kernel_map.
2008-12-01 10:54:57 +00:00
pooka
8fc8f3a7a3 g/c #if 0'd ubc_flush() 2008-11-27 08:46:09 +00:00
pooka
b4099c3e1d Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
2008-11-26 20:17:33 +00:00