#include <rx/rx_queue.h>
#include <lwp.h>
#include <opr/lock.h>
+#include <opr/proc.h>
#include <afs/cmd.h>
#include <afs/ptclient.h>
#include <afs/afsint.h>
* already implied */
afs_int32 readonlyServer = 0;
-int stack = 24;
int stackSize = 24000;
int fiveminutes = 300; /* 5 minutes. Change this for debugging only */
int CurrentConnections = 0;
static int panic_timeout = 30 * 60;
#endif
+static int host_thread_quota;
int rxpackets = 150; /* 100 */
int nSmallVns = 400; /* 200 */
int large = 400; /* 200 */
audit_PrintStats(stderr);
h_PrintStats();
PrintCallBackStats();
-#ifdef AFS_NT40_ENV
- processSize = -1; /* TODO: */
-#else
- processSize = (int)((long)sbrk(0) >> 10);
-#endif
+ processSize = opr_procsize();
ViceLog(0,
("There are %d connections, process size %d\n",
CurrentConnections, processSize));
OPT_vlruinterval,
OPT_vlrumax,
OPT_unsafe_nosalvage,
- OPT_stack,
OPT_cbwait,
OPT_novbc,
OPT_auditlog,
#endif
/* unrecommend options - should perhaps be CMD_HIDE */
- cmd_AddParmAtOffset(opts, OPT_stack, "-k", CMD_SINGLE, CMD_OPTIONAL,
- "stack size");
cmd_AddParmAtOffset(opts, OPT_cbwait, "-w", CMD_SINGLE, CMD_OPTIONAL,
"callback wait interval");
cmd_AddParmAtOffset(opts, OPT_novbc, "-novbc", CMD_SINGLE, CMD_FLAG,
CMD_OPTIONAL, "configuration location");
code = cmd_Parse(argc, argv, &opts);
+ if (code == CMD_HELP) {
+ exit(0);
+ }
if (code)
return -1;
cmd_OptionAsFlag(opts, OPT_unsafe_nosalvage, &unsafe_attach);
#endif /* AFS_DEMAND_ATTACH_FS */
- cmd_OptionAsInt(opts, OPT_stack, &stack);
cmd_OptionAsInt(opts, OPT_cbwait, &fiveminutes);
cmd_OptionAsFlag(opts, OPT_novbc, &novbc);
if (auditFileName)
osi_audit_file(auditFileName);
+ if (lwps > 64) {
+ host_thread_quota = 5;
+ } else if (lwps > 32) {
+ host_thread_quota = 4;
+ } else if (lwps > 16) {
+ host_thread_quota = 3;
+ } else {
+ host_thread_quota = 2;
+ }
+
return (0);
} /*ParseArgs */
rx_SetMinProcs(tservice, 2);
rx_SetMaxProcs(tservice, 4);
- /*
- * Enable RX hot threads, which allows the listener thread to trade
- * places with an idle thread and moves the context switch from listener
- * to worker out of the critical path.
- */
- rx_EnableHotThread();
-
/* Some rx debugging */
if (rxlog || eventlog) {
debugFile = afs_fopen("rx_dbg", "w");
}
init_sys_error_to_et(); /* Set up error table translation */
- h_InitHostPackage(); /* set up local cellname and realmname */
+ h_InitHostPackage(host_thread_quota); /* set up local cellname and realmname */
InitCallBack(numberofcbs);
ClearXStatValues();