list_for_each is enough for counting the list length. We also avoid
including struct page definition this way.
Suggested-by: Michal Nazarewicz <mina86@mina86.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
#include <linux/types.h>
#include <linux/list.h>
#include <linux/tracepoint.h>
-#include <linux/mm_types.h>
#include <trace/events/gfpflags.h>
DECLARE_EVENT_CLASS(mm_compaction_isolate_template,
TP_fast_assign(
unsigned long nr_failed = 0;
- struct page *page;
+ struct list_head *page_lru;
/*
* migrate_pages() returns either a non-negative number
if (migrate_rc >= 0)
nr_failed = migrate_rc;
else
- list_for_each_entry(page, migratepages, lru)
+ list_for_each(page_lru, migratepages)
nr_failed++;
__entry->nr_migrated = nr_all - nr_failed;