ref: c94d0673eecae4032a3fee6e218bac4dcc2f1bf8
parent: 7cb2db12f85c6dbc6a7f36bbfb655e6b7c19a28c
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Oct 6 12:02:13 EDT 2024
kernel: remove unused lockstats and make lock() return type void remove the global statistics counters from taslock.c as they'r not particularily usefull nor precise and just cause unneccessary cache traffic. if we want them back, we should place them into the Mach structure. also change the lock() function prototype to return void.
--- a/sys/src/9/port/portfns.h
+++ b/sys/src/9/port/portfns.h
@@ -166,7 +166,7 @@
void ksetenv(char*, char*, int);
void kstrcpy(char*, char*, int);
void kstrdup(char**, char*);
-int lock(Lock*);
+void lock(Lock*);
void logopen(Log*);
void logclose(Log*);
char* logctl(Log*, int, char**, Logflag*);
--- a/sys/src/9/port/taslock.c
+++ b/sys/src/9/port/taslock.c
@@ -16,13 +16,6 @@
uintptr ilockpcs[0x100] = { [0xff] = 1 };
#endif
-struct
-{
- ulong locks;
- ulong glare;
- ulong inglare;
-} lockstats;
-
void
lockloop(Lock *l, uintptr pc)
{
@@ -39,7 +32,7 @@
dumpaproc(p);
}
-int
+void
lock(Lock *l)
{
int i;
@@ -47,7 +40,6 @@
pc = getcallerpc(&l);
- lockstats.locks++;
if(up)
up->nlocks++; /* prevent being scheded */
if(tas(&l->key) == 0){
@@ -60,14 +52,12 @@
#ifdef LOCKCYCLES
l->lockcycles = -lcycles();
#endif
- return 0;
+ return;
}
if(up)
up->nlocks--;
- lockstats.glare++;
for(;;){
- lockstats.inglare++;
i = 0;
while(l->key){
if(conf.nmach < 2 && up && up->edf && (up->edf->flags & Admitted)){
@@ -96,7 +86,7 @@
#ifdef LOCKCYCLES
l->lockcycles = -lcycles();
#endif
- return 1;
+ return;
}
if(up)
up->nlocks--;
@@ -110,11 +100,9 @@
uintptr pc;
pc = getcallerpc(&l);
- lockstats.locks++;
x = splhi();
if(tas(&l->key) != 0){
- lockstats.glare++;
/*
* Cannot also check l->pc, l->m, or l->isilock here
* because they might just not be set yet, or
@@ -121,7 +109,6 @@
* (for pc and m) the lock might have just been unlocked.
*/
for(;;){
- lockstats.inglare++;
splx(x);
while(l->key)
;
--
⑨