mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Davidlohr Bueso <davidlohr.bueso@hp.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Emmanuel Benisty <benisty.e@gmail.com>,
	"Vinod, Chegu" <chegu_vinod@hp.com>,
	"Low, Jason" <jason.low2@hp.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	aquini@redhat.com, Michel Lespinasse <walken@google.com>,
	Ingo Molnar <mingo@kernel.org>,
	Larry Woodman <lwoodman@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v2 4/4] ipc: sem: do not hold ipc lock more than necessary
Date: Wed, 20 Mar 2013 10:27:57 -0400	[thread overview]
Message-ID: <5149C76D.7090409@redhat.com> (raw)
In-Reply-To: <1362476179.2225.54.camel@buesod1.americas.hpqcorp.net>

On 03/05/2013 04:36 AM, Davidlohr Bueso wrote:

> @@ -1476,8 +1539,8 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops,
>   	queue.sleeper = current;
>
>   sleep_again:
> -	current->state = TASK_INTERRUPTIBLE;
>   	sem_unlock(sma);
> +	current->state = TASK_INTERRUPTIBLE;
>
>   	if (timeout)
>   		jiffies_left = schedule_timeout(jiffies_left);

After modifying my test case to start with a semaphore value of 1 on
every semaphore, and do down followed by up (to have only one process
take each semaphore at a time), I started seeing lost wakeups and the
test case being stuck.

I believe the change above is the cause of that issue.

By unlocking before setting current->state to TASK_INTERRUPTIBLE,
there is a small window where the next lock holder can grab the
lock and wake us up, before we set ourselves to TASK_INTERRUPTIBLE
and go to sleep.

I have reverted your change in my code and am building a test kernel
now.

If things work, I'll clean up the whole patch series for a re-posting
today.

-- 
All rights reversed

  parent reply	other threads:[~2013-03-20 14:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05  9:36 Davidlohr Bueso
2013-03-05 23:11 ` Rik van Riel
2013-03-20 14:27 ` Rik van Riel [this message]
2013-03-20 15:38   ` Rik van Riel

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=5149C76D.7090409@redhat.com \
    --to=riel@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=benisty.e@gmail.com \
    --cc=chegu_vinod@hp.com \
    --cc=davidlohr.bueso@hp.com \
    --cc=hpa@zytor.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwoodman@redhat.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=walken@google.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

Powered by JetHome