From 11ccf116d0d756d06989775288e41f737d98e0c5 Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 26 Jul 2011 15:01:15 +0200 Subject: block: fix warning with calling smp_processor_id() in preemptible section After commit 5757a6d7 introduced an unsafe calling of smp_processor_id(), with preempt debuggin turned on we spew a lot of: BUG: using smp_processor_id() in preemptible [00000000] code: kjournald/514 caller is __make_request+0x1b8/0x308 [] (unwind_backtrace+0x0/0xe8) from [] (debug_smp_processor_id+0xbc/0xf0) [] (debug_smp_processor_id+0xbc/0xf0) from [] (__make_request+0x1b8/0x308) [] (__make_request+0x1b8/0x308) from [] (generic_make_request+0x4dc/0x558) [] (generic_make_request+0x4dc/0x558) from [] (submit_bio+0x114/0x138) [] (submit_bio+0x114/0x138) from [] (submit_bh+0x148/0x16c) [] (submit_bh+0x148/0x16c) from [] (__sync_dirty_buffer+0x88/0xd8) [] (__sync_dirty_buffer+0x88/0xd8) from [] (journal_commit_transaction+0x1198/0x1688) [] (journal_commit_transaction+0x1198/0x1688) from [] (kjournald+0xb4/0x224) [] (kjournald+0xb4/0x224) from [] (kthread+0x8c/0x94) [] (kthread+0x8c/0x94) from [] (kernel_thread_exit+0x0/0x8) Fix this by just using raw_smp_processor_id(), it's just a hint after all. There's no pinning of the CPU or accessing per-cpu structures involved. Reported-by: Ming Lei Signed-off-by: Jens Axboe --- block/blk-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index f8cb09951830..f9255815a5bb 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1283,7 +1283,7 @@ get_rq: if (test_bit(QUEUE_FLAG_SAME_COMP, &q->queue_flags) || bio_flagged(bio, BIO_CPU_AFFINE)) - req->cpu = smp_processor_id(); + req->cpu = raw_smp_processor_id(); plug = current->plug; if (plug) { -- cgit v1.2.3-70-g09d2