Commit 649b8de2 authored by Shreyas B. Prabhu's avatar Shreyas B. Prabhu Committed by Linus Torvalds
Browse files

tracing/mm: don't trace mm_page_pcpu_drain on offline cpus

Since tracepoints use RCU for protection, they must not be called on
offline cpus.  trace_mm_page_pcpu_drain can be called on an offline cpu
in this scenario caught by LOCKDEP:

     [ INFO: suspicious RCU usage. ]
     4.1.0-rc1+ #9 Not tainted
     include/trace/events/kmem.h:265 suspicious rcu_dereference_check() usage!

    other info that might help us debug this:

    RCU used illegally from offline CPU!
    rcu_scheduler_active = 1, debug_locks = 1
     1 lock held by swapper/5/0:
      #0:  (&(&zone->lock)->rlock){..-...}, at: [<c0000000002073b0>] .free_pcppages_bulk+0x70/0x920

    stack backtrace:
     CPU: 5 PID: 0 Comm: swapper/5 Not tainted 4.1.0-rc1+ #9
     Call Trace:
       .dump_stack+0x98/0xd4 (unreliable)

Fix this by converting mm_page_pcpu_drain trace point into
TRACE_EVENT_CONDITION where condition is cpu_online(smp_processor_id())
Signed-off-by: default avatarShreyas B. Prabhu <>
Reviewed-by: default avatarPreeti U Murthy <>
Acked-by: default avatarSteven Rostedt <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 1f0c27b5
......@@ -276,12 +276,35 @@ DEFINE_EVENT(mm_page, mm_page_alloc_zone_locked,
TP_ARGS(page, order, migratetype)
DEFINE_EVENT_PRINT(mm_page, mm_page_pcpu_drain,
TP_PROTO(struct page *page, unsigned int order, int migratetype),
TP_ARGS(page, order, migratetype),
* This trace can be potentially called from an offlined cpu.
* Since trace points use RCU and RCU should not be used from
* offline cpus, filter such calls out.
* While this trace can be called from a preemptable section,
* it has no impact on the condition since tasks can migrate
* only from online cpus to other online cpus. Thus its safe
* to use raw_smp_processor_id.
__field( unsigned long, pfn )
__field( unsigned int, order )
__field( int, migratetype )
__entry->pfn = page ? page_to_pfn(page) : -1UL;
__entry->order = order;
__entry->migratetype = migratetype;
TP_printk("page=%p pfn=%lu order=%d migratetype=%d",
pfn_to_page(__entry->pfn), __entry->pfn,
__entry->order, __entry->migratetype)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment