mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "George Spelvin" <linux@horizon.com>
To: linux-kernel@vger.kernel.org, peterz@infradead.org
Cc: linux@horizon.com
Subject: Re: [PATCH 1/6] mlock: only hold mmap_sem in shared mode when
Date: 10 Dec 2010 14:00:47 -0500	[thread overview]
Message-ID: <20101210190047.11069.qmail@science.horizon.com> (raw)

How about (bugfixed):

bool cond_break_mutex(struct mutex *mutex)
{
	if (!mutex_is_contended(mutex))
		return false;
	mutex_unlock(mutex);
	mutex_lock(mutex);
	return true;
}

It would be possible to share work between the unlock and lock slowpaths
(particularly the wait_lock acquisition), but that's probably more
maintenance effort than it's worth.

                 reply	other threads:[~2010-12-10 19:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20101210190047.11069.qmail@science.horizon.com \
    --to=linux@horizon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®