rusage and ihklib: Fix out-of-memory reporting and cleanup
1. Fix OOM: Count memory usage only when allocation succeeded 2. Fix OOM: Make user allocation fail when memory is running out 3. Fix OOM: Move rusage_init() before numa_init() 4. Cleanup: Rename ihkconfig/ihkosctl functions 5. Cleanup: Pass event type to eventfd() 6. Cleanup: arch/.../rusage.h --> arch/.../arch_rusage.h
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#ifndef __RUSAGE_H
|
||||
#define __RUSAGE_H
|
||||
|
||||
//#define RUSAGE_DEBUG
|
||||
|
||||
#define IHK_MAX_NUM_PGSIZES 4
|
||||
#define IHK_MAX_NUM_NUMA_NODES 1024
|
||||
#define IHK_MAX_NUM_CPUS 1024
|
||||
@@ -13,21 +15,28 @@ struct rusage_percpu {
|
||||
};
|
||||
|
||||
struct rusage_global {
|
||||
/* Memory usage accounting */
|
||||
long memory_stat_rss[IHK_MAX_NUM_PGSIZES];
|
||||
long memory_stat_mapped_file[IHK_MAX_NUM_PGSIZES];
|
||||
long rss_current; /* anon && user, used only for memory_max_usage */
|
||||
unsigned long memory_max_usage;
|
||||
unsigned long max_num_threads;
|
||||
unsigned long num_threads;
|
||||
long rss_current;
|
||||
unsigned long memory_kmem_usage;
|
||||
unsigned long memory_kmem_max_usage;
|
||||
unsigned long memory_numa_stat[IHK_MAX_NUM_NUMA_NODES];
|
||||
|
||||
/* CPU usage accounting */
|
||||
struct rusage_percpu cpu[IHK_MAX_NUM_CPUS]; /* clv[i].monitor = &cpu[i] */
|
||||
|
||||
/* OOM monitoring */
|
||||
unsigned long total_memory;
|
||||
unsigned long total_memory_usage;
|
||||
unsigned long total_memory_max_usage;
|
||||
|
||||
#ifdef RUSAGE_DEBUG
|
||||
unsigned long total_memory_max_usage_old; /* debug */
|
||||
#endif
|
||||
/* Used for translating results into struct mckernel_rusage */
|
||||
unsigned long num_numa_nodes;
|
||||
unsigned long num_processors;
|
||||
unsigned long ns_per_tsc;
|
||||
|
||||
Reference in New Issue
Block a user