提交 256f9764 编写于 作者: M Ma Wupeng 提交者: Zheng Zengkai

mm: Show debug info about memory reliable if oom occurs

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S
CVE: NA

--------------------------------

Show debug info about memory reliable if oom occurs.
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
上级 8347b3f0
...@@ -38,6 +38,7 @@ extern void reliable_lru_add_batch(int zid, enum lru_list lru, ...@@ -38,6 +38,7 @@ extern void reliable_lru_add_batch(int zid, enum lru_list lru,
extern bool mem_reliable_counter_initialized(void); extern bool mem_reliable_counter_initialized(void);
extern void mem_reliable_out_of_memory(gfp_t gfp_mask, unsigned int order, extern void mem_reliable_out_of_memory(gfp_t gfp_mask, unsigned int order,
int preferred_nid, nodemask_t *nodemask); int preferred_nid, nodemask_t *nodemask);
extern void reliable_show_mem_info(void);
static inline bool mem_reliable_is_enabled(void) static inline bool mem_reliable_is_enabled(void)
{ {
...@@ -162,6 +163,7 @@ static inline void mem_reliable_out_of_memory(gfp_t gfp_mask, ...@@ -162,6 +163,7 @@ static inline void mem_reliable_out_of_memory(gfp_t gfp_mask,
int preferred_nid, int preferred_nid,
nodemask_t *nodemask) {} nodemask_t *nodemask) {}
static inline bool reliable_allow_fb_enabled(void) { return false; } static inline bool reliable_allow_fb_enabled(void) { return false; }
static inline void reliable_show_mem_info(void) {}
#endif #endif
#endif #endif
...@@ -41,4 +41,5 @@ void show_mem(unsigned int filter, nodemask_t *nodemask) ...@@ -41,4 +41,5 @@ void show_mem(unsigned int filter, nodemask_t *nodemask)
#ifdef CONFIG_MEMORY_FAILURE #ifdef CONFIG_MEMORY_FAILURE
printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages)); printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
#endif #endif
reliable_show_mem_info();
} }
...@@ -427,6 +427,44 @@ static void mem_reliable_feature_disable(int idx) ...@@ -427,6 +427,44 @@ static void mem_reliable_feature_disable(int idx)
pr_info("%s is disabled\n", str); pr_info("%s is disabled\n", str);
} }
void reliable_show_mem_info(void)
{
if (!mem_reliable_is_enabled())
return;
pr_info("ReliableTotal: %lu kB\n", total_reliable_pages()
<< (PAGE_SHIFT - 10));
pr_info("ReliableUsed: %lu kB\n", used_reliable_pages()
<< (PAGE_SHIFT - 10));
pr_info("ReliableTaskLimit: %lu kB\n", task_reliable_limit >> 10);
pr_info("ReliableTaskUsed: %lld kB\n", task_reliable_used_pages()
<< (PAGE_SHIFT - 10));
if (shmem_reliable_is_enabled()) {
pr_info("ReliableShmemPagesLimit: %ld\n",
shmem_reliable_nr_page);
pr_info("ReliableShmem: %llu kB\n",
percpu_counter_sum(&reliable_shmem_used_nr_page)
<< (PAGE_SHIFT - 10));
}
if (pagecache_reliable_is_enabled()) {
s64 nr_pagecache_pages = 0;
unsigned long num = 0;
num += global_node_page_state(NR_LRU_BASE + LRU_ACTIVE_FILE);
num += global_node_page_state(NR_LRU_BASE + LRU_INACTIVE_FILE);
pr_info("ReliableFileCacheLimit: %lu kB\n",
reliable_pagecache_max_bytes >> 10);
pr_info("FileCache: %lu kB\n", num << (PAGE_SHIFT - 10));
nr_pagecache_pages =
percpu_counter_sum_positive(&pagecache_reliable_pages);
pr_info("ReliableFileCache: %llu kB\n",
nr_pagecache_pages << (PAGE_SHIFT - 10));
}
}
void mem_reliable_out_of_memory(gfp_t gfp, unsigned int order, void mem_reliable_out_of_memory(gfp_t gfp, unsigned int order,
int preferred_nid, nodemask_t *nodemask) int preferred_nid, nodemask_t *nodemask)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册