9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@9fans.net
Subject: Re: [9fans] odd out-of-memory behavior
Date: Fri, 25 Jul 2008 14:25:57 -0400	[thread overview]
Message-ID: <cbcbfad8e6f2b28cfa1687706520823b@coraid.com> (raw)
In-Reply-To: <20080725180709.0B0441E8C1C@holo.morphisms.net>

unfortunately or fortunately this is a rare problem.
hopefully the caching upas will mature faster than
our mailboxes grow.

thanks for re-pointing out the acid tricks.  i shall
lay a trap.  but in the interest of covering the careful
thought bit ...

> /sys/src/9/port/proc.c:/^killbig marks the process
> to be killed, but if it can't acquire the lock on that
> process's segments, the memory is not actually
> freed immediately:
>
> 	kp->procctl = Proc_exitbig;
> 	for(i = 0; i < NSEG; i++) {
> 		s = kp->seg[i];
> 		if(s != 0 && canqlock(&s->lk)) {
> 			mfreeseg(s, s->base, (s->top - s->base)/BY2PG);
> 			qunlock(&s->lk);
> 		}
> 	}
>
> Perhaps another upas/fs proc sharing the same
> segment is holding the segment lock and
> blocking on something else.

how would that happen?  upas/fs -p doesn't fork.
(it's being run from imap4d.)

is there some other reason that segments would
be shared?

i originally thought someone else might be sitting
on the shared segments, but i couldn't explain how
that might be happening.  i also thought the purpose
of this loop was to hunt down relatives sharing memory
with killbig's vic:

	for(p = procalloc.arena; p < ep; p++) {
		if(p->state == Dead || p->kp)
			continue;
		if(p != kp && p->seg[BSEG] && p->seg[BSEG] == kp->seg[BSEG])
			p->procctl = Proc_exitbig;
	}

so much for the "careful" thought.  what am i missing?

- erik




  reply	other threads:[~2008-07-25 18:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-25 16:44 erik quanstrom
2008-07-25 18:09 ` Russ Cox
2008-07-25 18:25   ` erik quanstrom [this message]
2008-07-25 19:39     ` Russ Cox
2008-07-27  1:20   ` erik quanstrom
2008-07-27  2:20     ` Russ Cox
2008-07-27  2:21     ` Russ Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cbcbfad8e6f2b28cfa1687706520823b@coraid.com \
    --to=quanstro@coraid.com \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).