public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Christoph Hellwig <hch@infradead.org>
Cc: Steven Whitehouse <swhiteho@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: Preempt & smp_processor_id in __make_request
Date: Tue, 26 Jul 2011 15:05:19 +0200	[thread overview]
Message-ID: <4E2EBB8F.7000908@kernel.dk> (raw)
In-Reply-To: <20110726114330.GA12704@infradead.org>

On 2011-07-26 13:43, Christoph Hellwig wrote:
> On Tue, Jul 26, 2011 at 10:32:06AM +0100, Steven Whitehouse wrote:
>> diff --git a/block/blk-core.c b/block/blk-core.c
>> index f8cb099..f925581 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) {
>>
>> However this fixes the symptoms, rather than the cause, so I'm not at
>> all sure that this is the correct solution,
> 
> It doesn't fix the symptoms - the warning is one of those 98% percent
> right types of warnings.  In this case get_cpu/put_cpu doesn't buy you
> anthing - we want to stash away the cpu id that we submitted the I/O
> from, to compare it when we later process the I/O completion from
> a different context.  With some PREEMPT options we might actually get
> rescheduled to a different CPU during the rest of this function, but
> as we submit the plugged requests at this point we'll still be correct.
> 
> Even if wasn't we would already thrash the cache badly enough for this
> optimization not to matter in that case.

This was reported earlier today as well, and I suggested the same fix.
raw_smp_processor_id() is fine, since it's just a hint.

-- 
Jens Axboe


      reply	other threads:[~2011-07-26 13:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26  9:32 Preempt & smp_processor_id in __make_request Steven Whitehouse
2011-07-26 10:56 ` Sergey Senozhatsky
2011-07-26 16:15   ` Williams, Dan J
2011-07-26 11:43 ` Christoph Hellwig
2011-07-26 13:05   ` Jens Axboe [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E2EBB8F.7000908@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swhiteho@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox