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.
This commit is contained in:
parent
240590ab0a
commit
963497f06b
4 changed files with 20 additions and 53 deletions
|
@ -55,6 +55,16 @@ defn imagecache() {
|
|||
}
|
||||
}
|
||||
|
||||
defn qiostats() {
|
||||
print ("padblockcnt=", *padblockcnt\D, "\n");
|
||||
print ("concatblockcnt=", *concatblockcnt\D, "\n");
|
||||
print ("pullupblockcnt=", *pullupblockcnt\D, "\n");
|
||||
print ("copyblockcnt=", *copyblockcnt\D, "\n");
|
||||
print ("consumecnt=", *consumecnt\D, "\n");
|
||||
print ("producecnt=", *producecnt\D, "\n");
|
||||
print ("qcopycnt=", *qcopycnt\D, "\n");
|
||||
}
|
||||
|
||||
// dump channels
|
||||
defn chan(c) {
|
||||
local d, q;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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*);
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue