Commit Graph

1265 Commits

Author SHA1 Message Date
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