proc: show actual mem usage in /proc/sys/mars/

This commit is contained in:
Thomas Schoebel-Theuer 2012-09-26 11:22:36 +02:00 committed by Thomas Schoebel-Theuer
parent 08a19dae8f
commit 23c8af994c
3 changed files with 15 additions and 0 deletions

View File

@ -39,6 +39,8 @@
#define MARS_RPL(_args...) /*empty*/
#endif
int trans_logger_mem_usage; // in KB
EXPORT_SYMBOL_GPL(trans_logger_mem_usage);
///////////////////////// own type definitions ////////////////////////
@ -1978,6 +1980,7 @@ int _do_ranking(struct trans_logger_brick *brick, struct rank_data rkd[])
{ brick_global_memlimit, -1000 },
};
int global_mem_used = atomic64_read(&global_mshadow_used) / 1024;
trans_logger_mem_usage = global_mem_used;
if (global_mem_used >= brick_global_memlimit)
delay_callers = true;

View File

@ -14,6 +14,8 @@
#include "lib_pairing_heap.h"
#include "lib_queue.h"
extern int trans_logger_mem_usage; // in KB
////////////////////////////////////////////////////////////////////
_PAIRING_HEAP_TYPEDEF(logger,)

View File

@ -15,6 +15,7 @@
#include "mars_proc.h"
#include "../mars_client.h"
#include "../mars_server.h"
#include "../mars_trans_logger.h"
mars_info_fn mars_info = NULL;
@ -189,6 +190,15 @@ ctl_table mars_table[] = {
.proc_handler = &proc_dointvec,
_CTL_STRATEGY(sysctl_intvec)
},
{
_CTL_NAME
.procname = "mem_used_kb",
.data = &trans_logger_mem_usage,
.maxlen = sizeof(int),
.mode = 0400,
.proc_handler = &proc_dointvec,
_CTL_STRATEGY(sysctl_intvec)
},
{
_CTL_NAME
.procname = "logrot_auto_gb",