9front - general discussion about 9front
 help / color / mirror / Atom feed
* no image after reclaim
@ 2014-02-24  5:58 sl
  2014-02-24  7:18 ` [9front] " cinap_lenrek
  0 siblings, 1 reply; 3+ messages in thread
From: sl @ 2014-02-24  5:58 UTC (permalink / raw)
  To: 9front

A while back I wrote an rss feed reader in go (the
parser is a pre-existing library, which is the reason
I chose to write the program in go)[0]. This runs twice
an hour on my cpu server, instigated by cron.

Result:

Every day or two my cpu server locks up. Remote sessions
stall. The console stops responding to keys being pressed on
the keyboard. The console screen fills up with this message,
repeated over and over:

no image after reclaim

The error message seems to be triggered in
/sys/src/9/port/segment.c.

I never had this problem before I started running my
go program. The problem first appeared around the
same time I started running my go program. I'm not sure
if I'm doing something stupid in my program, if something
is wrong with the go runtime, if something is wrong with
the 9front kernel, or some combination of the above.

sl

[0] http://code.google.com/p/rrss


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] no image after reclaim
  2014-02-24  5:58 no image after reclaim sl
@ 2014-02-24  7:18 ` cinap_lenrek
  2014-02-24 21:47   ` sl
  0 siblings, 1 reply; 3+ messages in thread
From: cinap_lenrek @ 2014-02-24  7:18 UTC (permalink / raw)
  To: 9front

for some reason, we are unable to reclaim program images.
this could happen when you run a shitload of differnet
binaries and keep them running. if the program is not
running anymore, we should be able to reclaim its image
unless theres some bug.

you can inspect the image cache with acid. run (pid doesnt
matter, litterally type $pid):

acid -k -lkernel $pid

kinit()

send the commands printed, then run:

imagecache()

this prints the image structures cached. ref is the overall
number of references to this structure. when that goes
to zero, the image structure is reclaimed. pgref is the
number of page references to the image. entries with
ref == pgrep should be reclaimable. the algorithm just
scans the page list and frees all the pages for images
that are not running anymore, decrementing ref by pgrep.

run this these acid commands from time to time so we
can see when stuff is piling up.

--
cinap


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9front] no image after reclaim
  2014-02-24  7:18 ` [9front] " cinap_lenrek
@ 2014-02-24 21:47   ` sl
  0 siblings, 0 replies; 3+ messages in thread
From: sl @ 2014-02-24 21:47 UTC (permalink / raw)
  To: 9front

Revision: 8d1b21036a59
Branch:   default
Author:   cinap_lenrek@felloff.net
Date:     Mon Feb 24 21:42:22 2014 UTC
Log:      kernel: keep cached pages continuous at the end of the page list  
on imagereclaim()

imagereclaim() sabotaged itself by breaking the invariant
that cached pages are kept at the end of the page list.

once we made a hole of uncached pages, we would stop
reclaiming cached pages before it as the loop breaks
once it hits a uncached page. (we iterate backwards from
the tail to the head of the pagelist until pages have been
reclaimed or we hit a uncached page).

the solution is to move pages to the head of the pagelist
after removing them from the image cache.
http://code.google.com/p/plan9front/source/detail?r=8d1b21036a59

Modified:
  /sys/src/9/port/page.c
  /sys/src/9/port/portfns.h
  /sys/src/9/port/segment.c


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-24 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24  5:58 no image after reclaim sl
2014-02-24  7:18 ` [9front] " cinap_lenrek
2014-02-24 21:47   ` sl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).