summaryrefslogtreecommitdiff
path: root/sys/src/9/port
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-11-05 20:05:40 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-11-05 20:05:40 +0100
commit963497f06b39a4fd9d80476fab732682122479e9 (patch)
tree23a0ef26d37861d99a451861769b2018ceffd540 /sys/src/9/port
parent240590ab0a2f22011cd36f87220cde7136b18b83 (diff)
kernel: avoid padblock copying for devtls/devssl/esp, cleanup debugging
to avoid copying in padblock() when adding cryptographics macs to a block in devtls/devssl/esp we reserve 16 extra bytes to the allocation. remove qio ixsummary() function and add acid function qiostats() to /sys/lib/acid/kernel simplify iallocb(), remove iallocsummary() statitics.
Diffstat (limited to 'sys/src/9/port')
-rw-r--r--sys/src/9/port/allocb.c48
-rw-r--r--sys/src/9/port/portfns.h2
-rw-r--r--sys/src/9/port/qio.c13
3 files changed, 10 insertions, 53 deletions
diff --git a/sys/src/9/port/allocb.c b/sys/src/9/port/allocb.c
index 3949680cc..8ce8a73fb 100644
--- a/sys/src/9/port/allocb.c
+++ b/sys/src/9/port/allocb.c
@@ -8,21 +8,17 @@
enum
{
Hdrspc = 64, /* leave room for high-level headers */
+ Tlrspc = 16, /* extra room at the end for pad/crc/mac */
Bdead = 0x51494F42, /* "QIOB" */
};
-struct
-{
- Lock;
- ulong bytes;
-} ialloc;
-
static Block*
_allocb(int size)
{
Block *b;
uintptr addr;
+ size += Tlrspc;
if((b = mallocz(sizeof(Block)+size+Hdrspc, 0)) == nil)
return nil;
@@ -58,7 +54,6 @@ allocb(int size)
/*
* Check in a process and wait until successful.
- * Can still error out of here, though.
*/
if(up == nil)
panic("allocb without up: %#p", getcallerpc(&size));
@@ -82,34 +77,22 @@ Block*
iallocb(int size)
{
Block *b;
- static int m1, m2, mp;
-
- if(ialloc.bytes > conf.ialloc){
- if((m1++%10000)==0){
- if(mp++ > 1000)
- panic("iallocb: out of memory");
- iprint("iallocb: limited %lud/%lud\n",
- ialloc.bytes, conf.ialloc);
- }
- return nil;
- }
if((b = _allocb(size)) == nil){
- if((m2++%10000)==0){
- if(mp++ > 1000)
- panic("iallocb: out of memory");
- iprint("iallocb: no memory %lud/%lud\n",
- ialloc.bytes, conf.ialloc);
+ static ulong nerr;
+ if((nerr++%10000)==0){
+ if(nerr > 10000000){
+ xsummary();
+ mallocsummary();
+ panic("iallocb: out of memory")
+ }
+ iprint("iallocb: no memory for %d bytes\n", size);
}
return nil;
}
setmalloctag(b, getcallerpc(&size));
b->flag = BINTR;
- ilock(&ialloc);
- ialloc.bytes += b->lim - b->base;
- iunlock(&ialloc);
-
return b;
}
@@ -129,11 +112,6 @@ freeb(Block *b)
b->free(b);
return;
}
- if(b->flag & BINTR) {
- ilock(&ialloc);
- ialloc.bytes -= b->lim - b->base;
- iunlock(&ialloc);
- }
/* poison the block in case someone is still holding onto it */
b->next = dead;
@@ -171,9 +149,3 @@ checkb(Block *b, char *msg)
if(b->wp > b->lim)
panic("checkb 4 %s %#p %#p", msg, b->wp, b->lim);
}
-
-void
-iallocsummary(void)
-{
- print("ialloc %lud/%lud\n", ialloc.bytes, conf.ialloc);
-}
diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h
index eb34dc2dd..cb69c24bb 100644
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -129,7 +129,6 @@ long hostownerwrite(char*, int);
void (*hwrandbuf)(void*, ulong);
void hzsched(void);
Block* iallocb(int);
-void iallocsummary(void);
uintptr ibrk(uintptr, int);
void ilock(Lock*);
void interrupted(void);
@@ -143,7 +142,6 @@ int iseve(void);
int islo(void);
Segment* isoverlap(uintptr, uintptr);
Physseg* findphysseg(char*);
-void ixsummary(void);
void kickpager(void);
void killbig(char*);
void kproc(char*, void(*)(void*), void*);
diff --git a/sys/src/9/port/qio.c b/sys/src/9/port/qio.c
index 4cf1eea6c..6e9525b8e 100644
--- a/sys/src/9/port/qio.c
+++ b/sys/src/9/port/qio.c
@@ -13,8 +13,6 @@ static ulong consumecnt;
static ulong producecnt;
static ulong qcopycnt;
-static int debugging;
-
#define QDEBUG if(0)
/*
@@ -56,17 +54,6 @@ enum
uint qiomaxatomic = Maxatomic;
-void
-ixsummary(void)
-{
- debugging ^= 1;
- iallocsummary();
- print("pad %lud, concat %lud, pullup %lud, copy %lud\n",
- padblockcnt, concatblockcnt, pullupblockcnt, copyblockcnt);
- print("consume %lud, produce %lud, qcopy %lud\n",
- consumecnt, producecnt, qcopycnt);
-}
-
/*
* free a list of blocks
*/