From 9d12d29a2d4931c84555ed2e072a33195404dc2d Mon Sep 17 00:00:00 2001 From: Prakash Gupta Date: Thu, 18 Jun 2020 12:41:59 +0530 Subject: [PATCH] taskstats: remove redundant MM_STAT config check Userspace does not have access to MM_STAT configs, so remove redundant config checks. Change-Id: I0ec0807a1e62bd5932f01ed285f2175f27900e37 Signed-off-by: Prakash Gupta --- include/uapi/linux/sysstats.h | 4 +--- include/uapi/linux/taskstats.h | 2 -- kernel/taskstats.c | 4 ++++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/uapi/linux/sysstats.h b/include/uapi/linux/sysstats.h index 77a9599f2dec..1ab6ab895957 100644 --- a/include/uapi/linux/sysstats.h +++ b/include/uapi/linux/sysstats.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* - * Copyright (c) 2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020, The Linux Foundation. All rights reserved. */ #ifndef _LINUX_SYSSTATS_H @@ -25,9 +25,7 @@ struct sys_memstats { __u64 zram_compressed; __u64 swap_used; __u64 swap_total; -#ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES __u64 unreclaimable; -#endif __u64 buffer; __u64 slab_reclaimable; __u64 slab_unreclaimable; diff --git a/include/uapi/linux/taskstats.h b/include/uapi/linux/taskstats.h index 86f36b60d57e..125b5a9488a7 100644 --- a/include/uapi/linux/taskstats.h +++ b/include/uapi/linux/taskstats.h @@ -179,9 +179,7 @@ struct taskstats2 { __u64 file_rss; /* KB */ __u64 swap_rss; /* KB */ __u64 shmem_rss; /* KB */ -#ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES __u64 unreclaimable; /* KB */ -#endif /* version 1 ends here */ }; diff --git a/kernel/taskstats.c b/kernel/taskstats.c index d1f6ff77d7e0..fee055dbb868 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -489,6 +489,8 @@ static void sysstats_build(struct sys_memstats *stats) #ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES stats->unreclaimable = K(global_node_page_state(NR_UNRECLAIMABLE_PAGES)); +#else + stats->unreclaimable = 0; #endif stats->buffer = K(i.bufferram); stats->swapcache = K(total_swapcache_pages()); @@ -682,6 +684,8 @@ static int taskstats2_cmd_attr_pid(struct genl_info *info) #ifdef CONFIG_MM_STAT_UNRECLAIMABLE_PAGES stats->unreclaimable = K(get_mm_counter(p->mm, MM_UNRECLAIMABLE)); +#else + stats->unreclaimable = 0; #endif #undef K task_unlock(p);