Commit Graph

597 Commits

Author SHA1 Message Date
chs 208b369512 add missing anon lock around call to uvm_anon_lockloanpg(). 2002-09-21 06:16:07 +00:00
chs 9672ac098f add a new km flag UVM_KMF_CANFAIL, which causes uvm_km_kmemalloc() to
return failure if swap is full and there are no free physical pages.
have malloc() use this flag if M_CANFAIL is passed to it.
use M_CANFAIL to allow amap_extend() to fail when memory is scarce.
this should prevent most of the remaining hangs in low-memory situations.
2002-09-15 16:54:26 +00:00
thorpej 3479cf6ba9 Protect "struct uvm" with _KERNEL. 2002-09-15 01:01:32 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
thorpej ae8d1b60df When breaking an loan due to a page fault, check to see if the other
kind of reference-holder (anon or object) is referencing the page.  If
not, then the page must be removed from the pageq's.

Reviewed by Chuck Silvers.
2002-09-02 21:09:50 +00:00
drochner 77944bfa08 call cpu_dumpconf() after dumpdev change, so that
the global dumpsize/dumplo get updated
2002-08-31 17:07:59 +00:00
chs d510857ed4 be sure that the page we allocate to break a loan is put on a paging queue.
fixes PR 18037.
2002-08-29 05:03:30 +00:00
matt 78581fe411 In amap_ref, only increment the amap's refcnt after we have established
the ppref array.  Otherwise, the newly ref'ed pages will be doubly
counted and thus never freed because the pprefcnt can't fall to 0.
2002-08-22 23:39:37 +00:00
thorpej 95cb683cfb Don't pass VM_PROT_EXEC to pmap_kenter_pa(). 2002-08-14 15:21:31 +00:00
chs ebe4c850ef allocate the bufq after zeroing the swapdev structure, not before. 2002-07-27 14:37:00 +00:00
hannken 7de36862a8 Rename bufq_init() to bufq_alloc().
Add bufq_free() to remove a buffer queue.
Avoid MALLOC while holding a spinlock.

From Chuck Silvers.
2002-07-21 15:32:17 +00:00
hannken d4c062b4cc Convert to new device buffer queue interface. 2002-07-19 16:26:01 +00:00
chs b1b5af79c2 when dropping a kernel loan, if this was the last loan-to-kernel but
the page is still loaned to an anon, we should put the page back on a
paging queue.  this is because while pages loaned to the kernel really
do need to stay resident (since the kernel is accessing the physical
memory directly), pages loaned to anons can be paged out just fine.
(the page will be paged out twice, first to the object and then again
to the anon, but after that the page can be reused.)
2002-07-14 23:53:41 +00:00
yamt d96bff0e27 add KSTACK_CHECK_MAGIC. discussed on tech-kern. 2002-07-02 20:27:44 +00:00
chs cfefc92864 rearrange a few lines to appease an assertion. 2002-06-29 18:27:30 +00:00
drochner e14af78731 Big cleanup and speed improvements to pglist_alloc code:
-pass vm_physseg* instead of physseg index, and PFN (int) instead
 of physical address (could be done even more)
-simplify detection of boundary crossing and behave more intelligently
 in this case
-take stuff out of the inner loops, or put into "#ifdef DEBUG"
 (because we move along physsegs we don't need to check that the
  pages are physically contigous)
-make the "simple" and "contigous" branches look more uniform; at
 least the outer loops might coalesce one day
2002-06-27 18:05:29 +00:00
chs faab7dbb46 count aobj pages (most notably kernel stack pages) as anon pages
for memory usage-balancing purposes.
2002-06-20 15:05:29 +00:00
enami d76e8e25bc Shift by PAGE_SHIFT instead of dividing by PAGE_SIZE. 2002-06-20 08:24:22 +00:00
wrstuden 2eb3dc82d8 Fix recent bugs seen on Performa 4400 macppc's by
Makoto Fujiwara <makoto@ki.nu> and Manuel Bouyer <bouyer@netbsd.org>.
Help from Allen Briggs, Jason Thorpe, and Matt Thomas.

We need to call cpu_cache_probe() early in boot (machdep.c).
Add 603 info for completeness, and use NBPG not PAGESIZE, as the
latter relies on uvm being setup (cpu_subr.c).
Let uvm_page_recolor() be called before uvm has been set up; just
note the page coloring value (uvm_page.c).
2002-06-19 17:01:18 +00:00
drochner cb01228cf4 Make the DMA memory allocators (uvm_pglistalloc())
obey the preferences expressed by freelist assignment,
to avoid wasting valuable "low memory" to devices which
don't really need it.
comments:
-I'm not sure searching the physsegs within a freelist
 beginning with the biggest is the right thing. This is
 what the "memory steal" code in uvm_page.c does, so
 keep it consistent.
-There seems to be some confusion whether the upper
 address limit passed is inclusive or not. Stays on
 the save side, possibly leaving one page out.
-The boundary/pagemask check can be simplified, also some
 arguments passed are only used for diagnostic checks.
-Integration with UVM_PAGE_TRKOWN???
2002-06-18 15:49:48 +00:00
drochner d2b9876081 move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
2002-06-02 14:44:35 +00:00
atatat 6c03c181d2 "offest" -> "offset" in a comment 2002-05-31 16:49:50 +00:00
drochner f452b252a8 Add another allocator to uvm_pglistalloc() which is used in the case where
no alignment / boundary / nsegs restrictions apply.
This one doesn't insist in a contigous range, and it honours the "waitok"
flag, thus succeeds in situations which were hopeless with the existing one.

(A solution which searches for a minimum number of contiguous ranges using
some best-fit or so algorithm would be expensive to implement; I believe the
"either-or" done here does reflect the current use by bus_dma quite well.)

Now agp memory allocation is robust for me. (tested on i810)
2002-05-29 19:20:11 +00:00
enami 9e1deeab34 Add missing pageq lock while uvm_pagefree() is called (either directly
or indirectly).  Reviewed by chuq.
2002-05-29 11:04:39 +00:00
enami 2afb4efc4c Make uvn_findpages to return number of pages found so that caller can
easily check if all requested pages are found or not.
2002-05-17 22:00:50 +00:00
matt 357945ce6f When core dumping a process, don't dump maps backed up by the device pager.
(move the pagerops externs to uvm_object.h and out the C files).
2002-05-15 06:57:49 +00:00
enami 694a0fec54 When loaned page become ownerless as a result of freeing, it should be
dequeue'ed from pageq.  Fix provided by chuq.
2002-05-15 00:19:12 +00:00
fredette c857df5775 When preparing to swap to a miniroot partition, add a little
padding to our estimate of the miniroot's size, to avoid
overwriting it.
2002-05-09 21:43:44 +00:00
enami fabaf9a730 - In genfs_putpages(), no need to restrict the cluster within the given
region.
- In uvm_aio_aiodone(), remove assertions no longer true.
2002-05-09 07:14:37 +00:00
enami 6ceef3fc14 In uao_put(), if we wait for the busy page owned by someone else,
we can't simply reuse the pointor to the page.  Instead, we need to
acquire it again.  So, rearrange the loop like genfs_putpages() does.
Reviewed by chuq.
2002-05-09 07:04:23 +00:00
enami c4e1385f55 Fetch the right page from a file even if it is mapped from middle of it.
This makes `tail -<N> <FILE> | cat > file' correctly, where <FILE> is
a regular file larger than 10Mbytes (makes tail to map part of file)
and <N> is big enough to produce output larger than 8kbytes (makes pipe
to use page loan facility).  Problem reported by FUKAUMI Naoki on japanese
local mailing list.
2002-05-07 02:29:52 +00:00
chs 988df8394c look in the right flags field for PQ_INACTIVE.
make uvmpd_scan_inactive() return void since its return value is ignored.
2002-05-05 16:26:17 +00:00
thorpej 338e636672 Allow pmap_copy_page() and pmap_zero_page() to be #define'd
in <machine/pmap.h>.
2002-04-10 00:40:45 +00:00
manu 8645636b04 Updated comment to reflect the creation of uvm_swap_stats() 2002-04-01 12:24:11 +00:00
nathanw a1be32226e In amap_pp_adjref(), avoid incorrectly merging the first two chunks in
a ppref array when the range being adjusted includes the beginning of
the array.
2002-03-28 06:06:29 +00:00
manu da6e8ccbe8 Don't allocate struct swapent when we only need a struct oswapent. 2002-03-26 11:50:26 +00:00
chs f80ed5892c remove PGO_WEAK, it isn't needed anymore. 2002-03-25 02:08:09 +00:00
chs 76cacb8710 when processing PG_RDONLY, mask off VM_PROT_WRITE instead of hard-wiring
VM_PROT_READ (since we might have VM_PROT_EXEC too).  this fixes problems
running binaries out of NFS on macppc.  yet another fix courtesy of enami.
2002-03-25 01:56:48 +00:00
darrenr 256089809f Return EFBIG from mmap() if we try to map too much data and in the fixed
address allocation, return EOVERFLOW to match with the non-fixed error.
2002-03-22 11:06:33 +00:00
manu 2debbde786 Move swapctl(SWAP_STATS) implementation to a separate function called
uvm_swap_stats(). This is done in order to allow COMPAT_* swapctl()
emulation to use it directly without going through sys_swapctl().

The problem with using sys_swapctl() there is that it involves
copying the swapent array to the stackgap, and this array's size
is not known at build time. Hence it would not be possible to
 ensure it would fit in the stackgap in any case.
2002-03-18 11:43:01 +00:00
thorpej 1f6482dd1e Remove PR_MALLOCOK. 2002-03-09 07:28:20 +00:00
chs 87185156fd a vm_prot_t is a bit-mask, fix an assertion which was treating one
more like an enumerated type.
2002-03-09 04:29:03 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
thorpej 26b2d2217b If the bootstrapping process didn't actually use any KVA space, don't
reserve size of 0 in kernel_map.

From OpenBSD.
2002-03-07 20:15:32 +00:00
simonb c7339f8919 Include <sys/kernel.h> if UVMHIST is defined - the "cold" variable is
used in the UVMHIST_LOG macro.
Breakage reported by Chuck Silvers in private mail.
2002-03-05 05:45:54 +00:00
simonb 64c7743a05 Don't "extern int cold;" - this is in <sys/kernel.h>. 2002-03-04 02:19:07 +00:00
christos 894ca870b3 use the <sys/conf.h> macro to get the mmap footprint. 2002-02-28 21:00:23 +00:00
chs 2cce3ebcba honor the PG_RDONLY flag (so that NFS can clear the PG_NEEDCOMMIT flag
when page with it set is modified again).  fixes PR 15733.
2002-02-27 16:02:03 +00:00
chs 811c8fad2b in amap_pp_adjref(), avoid unnecessary fragmentation of the am_ppref array
by merging the first changed chunk with the last unchanged chunk if possible.
2002-02-25 00:39:16 +00:00
enami bb41d19bca In the function uvm_page_own(), clear owner_tag after assertion so that
we can see the owner when assertion failed.  Some indentation fix while
I'm here.
2002-02-20 07:06:56 +00:00