Commit graph

11 commits

Author SHA1 Message Date
cinap_lenrek 6c99d2f028 kernel: remove waserror() arround newpage() in mntcache
newpage() does not raise error().
2015-06-16 06:05:12 +02:00
cinap_lenrek 972cd5e3fc kernel: get rid of auxpage() and preserve cache index bits in Page.va in mount cache
the mount cache uses Page.va to store cached range offset and
limit, but mips kernel uses cache index bits from Page.va to
maintain page coloring. Page.va was not initialized by auxpage().

this change removes auxpage() which was primarily used only
by the mount cache and use newpage() with cache file offset
page as va so we will get a page of the right color.

mount cache keeps the index bits intact by only using the top
and buttom PGSHIFT bits of Page.va for the range offset/limit.
2015-03-16 05:46:08 +01:00
cinap_lenrek 5c29603f50 kernel: remove obsolete comment regarding Mntcache size in */main.c 2014-12-16 08:11:21 +01:00
cinap_lenrek 8309f15c36 kernel: new mount cache
this is a new more simple version of the mount cache
that does not require dynamic allocations for extends.

the Mntcache structure now contains a page bitmap
that is used for quick page invalidation. the size
of the bitmap is proportional to MAXCACHE.

instead of keeping track of cached range in the
Extend data structure, we keep all the information
in the Page itself. the offset from the page where
the cache range starts is in the low PGSHIT bits and
the end in the top bits of Page.va.

we choose Page.daddr to map 1:1 the Mountcache number
and page number (pn) in the Mountcache. to find a page,
we first check the bitmap if the page is there and then
do a pagelookup() with the daddr key.
2014-12-16 05:41:20 +01:00
cinap_lenrek 523c33bb6f kernel: minor changes to mount cache
change page cache ids (bid) to uintptr so we use the full
address space of Page.daddr.

make maxcache offset check consistent in cread().

use consistent types in cupdate() and simplify with goto.

make internal functions static.

use nil instead of 0 for pointers.
2014-12-15 06:28:27 +01:00
cinap_lenrek d4d86df2ab kernel: new pagecache, remove Lock from page, use cmpswap for Ref instead of Lock
make the Page stucture less than half its original size by getting rid of
the Lock and the lru.

The Lock was required to coordinate the unchaining of pages that where
both cached and on the lru freelist.

now pages have a single next pointer that is used for palloc.head
freelist xor for page cache hash chains in Image.pghash[].

cached pages are not on the freelist anymore, but will be reclaimed
from images by the pager when the freelist runs out of pages.

each Image has its own 512 hash chains for cached page lookup. That is
2MB worth of pages and there should be no collisions for most text images.

page reclaiming can be done without holding palloc.lock as the Image is
the owner of the page hash chains protected by the Image's lock.

reclaiming Image structures can be done quickly by only reclaiming pages from
inactive images, that is images which are not currently in use by segments.

the Ref structure has no Lock anymore. Only a single long that is atomically
incremented or decremnted using cmpswap().

there are various other changes as a consequence code. and lots of pikeshedding,
sorry.
2014-06-22 15:12:45 +02:00
cinap_lenrek 4c8cfe7284 kernel: remove unused debug cprint() function from port/cache.c
the cache can be inspected more easily with acid kernel library.
2013-12-29 07:50:58 +01:00
cinap_lenrek 1ee5cd7425 kernel: mnt cache rework
avoid double entries in the cache for copen() and properly handle
locking so we wont just give up if we cant lock the Mntcache entry,
but drop the cache lock, qlock the Mntcache entry, and then recheck
the cache.

general cleanup (cdev -> ccache, use eqchantdqid())
2012-10-17 15:48:30 +02:00
cinap_lenrek ea5a23d39a kernel: make mntcache effective, be carefull 2011-12-22 02:17:29 +01:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00