Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/1556169203-5858-1-git-send-email-laoar.shao@gmail.com
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Yafang Shao and committed by
Linus Torvalds
60b62ff7 d66d109d

+8 -12
+8 -12
include/trace/events/vmscan.h
··· 27 27 {RECLAIM_WB_ASYNC, "RECLAIM_WB_ASYNC"} \ 28 28 ) : "RECLAIM_WB_NONE" 29 29 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) | \ 32 32 (RECLAIM_WB_ASYNC) \ 33 - ) 34 - 35 - #define trace_shrink_flags(file) \ 36 - ( \ 37 - (file ? RECLAIM_WB_FILE : RECLAIM_WB_ANON) | \ 38 - (RECLAIM_WB_ASYNC) \ 39 33 ) 40 34 41 35 TRACE_EVENT(mm_vmscan_kswapd_sleep, ··· 322 328 323 329 TP_fast_assign( 324 330 __entry->pfn = page_to_pfn(page); 325 - __entry->reclaim_flags = trace_reclaim_flags(page); 331 + __entry->reclaim_flags = trace_reclaim_flags( 332 + page_is_file_cache(page)); 326 333 ), 327 334 328 335 TP_printk("page=%p pfn=%lu flags=%s", ··· 369 374 __entry->nr_ref_keep = stat->nr_ref_keep; 370 375 __entry->nr_unmap_fail = stat->nr_unmap_fail; 371 376 __entry->priority = priority; 372 - __entry->reclaim_flags = trace_shrink_flags(file); 377 + __entry->reclaim_flags = trace_reclaim_flags(file); 373 378 ), 374 379 375 380 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", ··· 408 413 __entry->nr_deactivated = nr_deactivated; 409 414 __entry->nr_referenced = nr_referenced; 410 415 __entry->priority = priority; 411 - __entry->reclaim_flags = trace_shrink_flags(file); 416 + __entry->reclaim_flags = trace_reclaim_flags(file); 412 417 ), 413 418 414 419 TP_printk("nid=%d nr_taken=%ld nr_active=%ld nr_deactivated=%ld nr_referenced=%ld priority=%d flags=%s", ··· 447 452 __entry->total_active = total_active; 448 453 __entry->active = active; 449 454 __entry->ratio = ratio; 450 - __entry->reclaim_flags = trace_shrink_flags(file) & RECLAIM_WB_LRU; 455 + __entry->reclaim_flags = trace_reclaim_flags(file) & 456 + RECLAIM_WB_LRU; 451 457 ), 452 458 453 459 TP_printk("nid=%d reclaim_idx=%d total_inactive=%ld inactive=%ld total_active=%ld active=%ld ratio=%ld flags=%s",