From dbb7c8f0f7a2a754b6dc600918e7ea71f2da7d98 Mon Sep 17 00:00:00 2001 From: CY Fan Date: Wed, 1 Jun 2022 17:33:01 +0800 Subject: [PATCH] reclaim_acct: fix compile warnings ohos inclusion category: bugfix issue: #I5AF2H CVE: NA Signed-off-by: CY Fan --- include/linux/reclaim_acct.h | 2 ++ mm/internal.h | 2 ++ mm/page_alloc.c | 2 ++ mm/reclaimacct_show.c | 4 ++-- mm/vmscan.c | 2 ++ mm/zswapd.c | 2 ++ 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/reclaim_acct.h b/include/linux/reclaim_acct.h index f6c10a5bacac..5cf26f3267d1 100644 --- a/include/linux/reclaim_acct.h +++ b/include/linux/reclaim_acct.h @@ -28,6 +28,7 @@ enum reclaim_type { RECLAIM_TYPES }; +#ifdef CONFIG_RECLAIM_ACCT static inline bool is_system_reclaim(enum reclaim_type type) { return (type == KSWAPD_RECLAIM || type == ZSWAPD_RECLAIM); @@ -42,5 +43,6 @@ void reclaimacct_end(enum reclaim_type type); void reclaimacct_substage_start(enum reclaimacct_stubs stub); void reclaimacct_substage_end(enum reclaimacct_stubs stub, unsigned long freed, const struct shrinker *shrinker); +#endif #endif /* _RECLAIM_ACCT_H */ diff --git a/mm/internal.h b/mm/internal.h index 708a18c63bff..5b02066f7186 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -773,6 +773,7 @@ struct migration_target_control { gfp_t gfp_mask; }; +#ifdef CONFIG_RECLAIM_ACCT #define DELAY_LV0 5000000 /* 5ms */ #define DELAY_LV1 10000000 /* 10ms */ #define DELAY_LV2 50000000 /* 50ms */ @@ -794,5 +795,6 @@ void reclaimacct_destroy_show_data(void); void reclaimacct_collect_data(void); void reclaimacct_collect_reclaim_efficiency(void); +#endif #endif /* __MM_INTERNAL_H */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 125e8f9f9111..6842f539c0cf 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4662,7 +4662,9 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, int no_progress_loops; unsigned int cpuset_mems_cookie; int reserve_flags; +#ifdef CONFIG_RECLAIM_ACCT struct reclaim_acct ra = {0}; +#endif /* * We also sanity check to catch abuse of atomic reserves being used by diff --git a/mm/reclaimacct_show.c b/mm/reclaimacct_show.c index db2354d7473c..18b073db48ba 100644 --- a/mm/reclaimacct_show.c +++ b/mm/reclaimacct_show.c @@ -115,7 +115,7 @@ static int reclaimacct_proc_show(struct seq_file *m, void *v) for (i = 0; i < NR_RA_STUBS; i++) { seq_printf(m, "%s_delay\t\t", stub_name[i]); for (j = 0; j < NR_DELAY_LV; j++) - seq_printf(m, "%-15llu ", show.delay[j][i] / NSEC_PER_MSEC); + seq_printf(m, "%-15llu ", div_u64(show.delay[j][i], NSEC_PER_MSEC)); seq_puts(m, "\n"); seq_printf(m, "%s_count\t\t", stub_name[i]); @@ -197,7 +197,7 @@ static int reclaim_efficiency_proc_show(struct seq_file *m, void *v) seq_printf(m, "%s time(ms) freed(page/obj)\n", type[i]); for (j = 0; j < NR_RA_STUBS; j++) seq_printf(m, "%s %-15llu %-15llu\n", stage[j], - eff[i].time[j] / NSEC_PER_MSEC, + div_u64(eff[i].time[j], NSEC_PER_MSEC), eff[i].freed[j]); } diff --git a/mm/vmscan.c b/mm/vmscan.c index 5371b75ff477..5f412c857d94 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3878,7 +3878,9 @@ static int kswapd(void *p) pg_data_t *pgdat = (pg_data_t*)p; struct task_struct *tsk = current; const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); +#ifdef CONFIG_RECLAIM_ACCT struct reclaim_acct ra = {0}; +#endif if (!cpumask_empty(cpumask)) set_cpus_allowed_ptr(tsk, cpumask); diff --git a/mm/zswapd.c b/mm/zswapd.c index 547bcf94bc5b..0eea65a4bb7f 100644 --- a/mm/zswapd.c +++ b/mm/zswapd.c @@ -763,7 +763,9 @@ static int zswapd(void *p) struct task_struct *tsk = current; pg_data_t *pgdat = (pg_data_t *)p; const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id); +#ifdef CONFIG_RECLAIM_ACCT struct reclaim_acct ra = {0}; +#endif /* save zswapd pid for schedule strategy */ zswapd_pid = tsk->pid; -- Gitee