From: Tejun Heo <tj@kernel.org>
To: paulmck@linux.vnet.ibm.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: Question about synchronize_sched_expedited()
Date: Tue, 26 Oct 2010 11:25:35 +0200 [thread overview]
Message-ID: <4CC69E8F.20003@kernel.org> (raw)
In-Reply-To: <20101025194140.GB6390@linux.vnet.ibm.com>
Hello, Paul.
On 10/25/2010 09:41 PM, Paul E. McKenney wrote:
>> I think your concern is valid and this can happen w/o preemption given
>> enough cpus and perfect timing. Was the original code free from this
>> problem?
>
> I believe so -- there was a mutex guarding the whole operation, including
> the increment.
I see.
>> IMHO the counter based mechanism is a bit too difficult to ponder and
>> verify. Can we do more conventional double queueing (ie. flipping
>> pending and executing queues so that multiple sync calls can get
>> coalesced while another one is in progress)? That's what the code is
>> trying to achieve anyway, right?
>
> Hmmm... But it would be necessary to flip the queues somewhere, and
> wouldn't determining where that somewhere was involve the same analysis
> and complexity as determining where to increment the counter?
I was thinking something like the following.
lock;
if (list_empty(running))
add myself to running
unlock;
else
remember list_empty(pending)
append myself to pending queue;
unlock and sleep;
if (pending wasn't empty)
return;
do it;
lock;
wake up all on running and clear it;
list_splice_init(pending, running);
wake up the first of running;
unlock;
Thanks.
--
tejun
prev parent reply other threads:[~2010-10-26 9:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-25 15:43 Question about synchronize_sched_expedited() Paul E. McKenney
2010-10-25 16:03 ` Tejun Heo
2010-10-25 19:41 ` Paul E. McKenney
2010-10-26 9:25 ` Tejun Heo [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=4CC69E8F.20003@kernel.org \
--to=tj@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@linux.vnet.ibm.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