9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: G. David Butler gdb@dbSystems.com
Subject: Kernel <-> bitmapped memory fragmentation
Date: Mon,  5 Feb 1996 02:58:04 -0500	[thread overview]
Message-ID: <19960205075804.dEqnhWGaBPTnN2iz7Y3QUUEuhR-sD_he_SNni6rTL3Q@z> (raw)

Hello All!

Ever notice (especially on small memory machines) how after a while
you can't make those 8 1/2 window as big as you used to?  Or how
you were able to display that graphic before you did a move or resize
on a window?  Even after you delete all the windows and re-create them
you just can't get it back unless you reboot?

Well here is a quick fix.  I changed the "first" fit xalloc into a "better"
fit xalloc.  In this way the xalloc memory will not become as fragmented
so when that bit device wants his "3 screens full", he can still get it
after he let it go.

David Butler
gdb@dbSystems.com

======================= alloc.c boddle =======================
#!/bin/rc
#
# command: /bin/boddle /sys/src/9/port/alloc.c alloc.c
# srcdir: /sys/src/9/port
# version: 823506923
# date: Mon Feb 5 01:55:23 CST 1996
#
myname=$0
doextract=no

fn usage{
	echo $myname: usage: $myname '[-X] [src-directory]' >[1=2]
	exit usage
}

fn sigint{
	rm -rf 823506923
	exit interrupt
}

while(~ $1 -*){
	switch($1){
	case -X
		doextract=yes
	case -*
		usage
	}
	shift
}

switch($#*){
case 0
	srcdir=/sys/src/9/port
case 1
	srcdir=$1
case *
	usage
}

if(! ~ $doextract yes){
	echo This shell file contains a bundle of diffs representing changes
	echo to original source files in the Plan 9 distribution. It will run
	echo against the files in
	echo ' ' $srcdir
	echo '(unless overridden by the optional source directory argument)'
	echo and create a directory 823506923 containing the updated files.
	echo It will NOT automatically update the original files.
	echo
	echo Invoke with argument -X to perform the actual extraction.
	exit 0
}

rm -rf 823506923
mkdir 823506923

target=823506923/alloc.c
echo -n '823506923/alloc.c: '
if(! test -f $srcdir/alloc.c || ! test -r $srcdir/alloc.c){
	echo $srcdir/alloc.c unreadable
	exit unreadable
}
sum=`{sum < $srcdir/alloc.c}
if(! ~ 8e1aa10a7934  $sum(1)^$sum(2)){
	echo $srcdir/alloc.c is not the original distribution file
	exit original
}
cp $srcdir/alloc.c 823506923/alloc.c
ed 823506923/alloc.c >/dev/null >[2=1] <<'//GO.SYSIN DD VADIM alloc.c'
193c
	}

	if (sh) {
		p = (Xhdr*)sh->addr;
		sh->addr += size;
		sh->size -= size;
		if(sh->size == 0) {
			*sl = sh->link;
			sh->link = xlists.flist;
			xlists.flist = sh;
		}
		unlock(&xlists);
		p = KADDR(p);
		memset(p, 0, size);
		p->magix = Magichole;
		p->size = size;
		return p->data;
.
176,191c
	sh = (Hole *)nil;
	SET(sl);
	SET(smallest);
	for(h = *l; h; l = &h->link, h = h->link) {
		if (h->size >= size && (!sh || h->size < smallest)) {
			smallest = h->size;
			sh = h;
			sl = l;
.
169c
	Hole *h, **l, *sh, **sl;
	ulong smallest;
.
10c
 * Plan 9 has two kernel allocators, the x... routines provide a best
.
wq
//GO.SYSIN DD VADIM alloc.c
sum=`{sum < 823506923/alloc.c}
if(~ 44c9fb008090  $sum(1)^$sum(2))
	echo
if not{
	echo 823506923/alloc.c checksum error creating updated file
	exit checksum
}






                 reply	other threads:[~1996-02-05  7:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=19960205075804.dEqnhWGaBPTnN2iz7Y3QUUEuhR-sD_he_SNni6rTL3Q@z \
    --to=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).