Skip to content

Commit 60b62ff

Browse files
laoartorvalds
authored andcommitted
mm/vmscan: simplify trace_reclaim_flags and trace_shrink_flags
trace_reclaim_flags and trace_shrink_flags are almost the same. We can simplify them to avoid redundant code. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Yafang Shao <[email protected]> Reviewed-by: Andrew Morton <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent d66d109 commit 60b62ff

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

include/trace/events/vmscan.h

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,11 @@
2727
{RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \
2828
) : "RECLAIM_WB_NONE"
2929

30-
#define trace_reclaim_flags(page) ( \
31-
(page_is_file_cache(page) ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
30+
#define trace_reclaim_flags(file) ( \
31+
(file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
3232
(RECLAIM_WB_ASYNC) \
3333
)
3434

35-
#define trace_shrink_flags(file) \
36-
( \
37-
(file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \
38-
(RECLAIM_WB_ASYNC) \
39-
)
40-
4135
TRACE_EVENT(mm_vmscan_kswapd_sleep,
4236

4337
TP_PROTO(int nid),
@@ -328,7 +322,8 @@ TRACE_EVENT(mm_vmscan_writepage,
328322

329323
TP_fast_assign(
330324
__entry->pfn = page_to_pfn(page);
331-
__entry->reclaim_flags = trace_reclaim_flags(page);
325+
__entry->reclaim_flags = trace_reclaim_flags(
326+
page_is_file_cache(page));
332327
),
333328

334329
TP_printk("page=%p pfn=%lu flags=%s",
@@ -374,7 +369,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_inactive,
374369
__entry->nr_ref_keep = stat->nr_ref_keep;
375370
__entry->nr_unmap_fail = stat->nr_unmap_fail;
376371
__entry->priority = priority;
377-
__entry->reclaim_flags = trace_shrink_flags(file);
372+
__entry->reclaim_flags = trace_reclaim_flags(file);
378373
),
379374

380375
TP_printk("nid=%d nr_scanned=%ld nr_reclaimed=%ld nr_dirty=%ld nr_writeback=%ld nr_congested=%ld nr_immediate=%ld nr_activate_anon=%d nr_activate_file=%d nr_ref_keep=%ld nr_unmap_fail=%ld priority=%d flags=%s",
@@ -413,7 +408,7 @@ TRACE_EVENT(mm_vmscan_lru_shrink_active,
413408
__entry->nr_deactivated = nr_deactivated;
414409
__entry->nr_referenced = nr_referenced;
415410
__entry->priority = priority;
416-
__entry->reclaim_flags = trace_shrink_flags(file);
411+
__entry->reclaim_flags = trace_reclaim_flags(file);
417412
),
418413

419414
TP_printk("nid=%d nr_taken=%ld nr_active=%ld nr_deactivated=%ld nr_referenced=%ld priority=%d flags=%s",
@@ -452,7 +447,8 @@ TRACE_EVENT(mm_vmscan_inactive_list_is_low,
452447
__entry->total_active = total_active;
453448
__entry->active = active;
454449
__entry->ratio = ratio;
455-
__entry->reclaim_flags = trace_shrink_flags(file) & RECLAIM_WB_LRU;
450+
__entry->reclaim_flags = trace_reclaim_flags(file) &
451+
RECLAIM_WB_LRU;
456452
),
457453

458454
TP_printk("nid=%d reclaim_idx=%d total_inactive=%ld inactive=%ld total_active=%ld active=%ld ratio=%ld flags=%s",

0 commit comments

Comments
 (0)