mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Andrew Morton <akpm@digeo.com>
Cc: Matthew Wilcox <willy@debian.org>,
	John Levon <levon@movementarian.org>,
	linux-kernel@vger.kernel.org
Subject: Re: flock(fd, LOCK_UN) taking 500ms+ ?
Date: Wed, 2 Oct 2002 21:05:08 +0100	[thread overview]
Message-ID: <20021002210508.C28586@parcelfarce.linux.theplanet.co.uk> (raw)
In-Reply-To: <3D9B4797.8399682@digeo.com>; from akpm@digeo.com on Wed, Oct 02, 2002 at 12:23:03PM -0700

On Wed, Oct 02, 2002 at 12:23:03PM -0700, Andrew Morton wrote:
> hm.  This is a tricky thing to guarantee.  If this process is
> high-priority or SCHED_RR or whatever, we want to ensure that
> any current holder of the lock gets a CPU slice?
> 
> Seems a strange thing to want to do, and if we really want to
> implement these semantics then there's quite a bit of stuff
> to do - making *all* blocked processes get some CPU will involve
> scheduler work, or funny games with semaphores.
> 
> Now if we interpret "allowed to run" as meaning "made runnable" then
> no probs.  Just wake them up.

Yeah, I think the original author was a little imprecise in his description
of the semantics.  The freebsd flock(2) manpage says:

     A shared lock may be upgraded to an exclusive lock, and vice versa, sim­
     ply by specifying the appropriate lock type; this results in the previous
     lock being released and the new lock applied (possibly after other pro­
     cesses have gained and released the lock).

So I think what they're trying to say is that changing the lock type is
exactly equivalent to removing the existing lock and then applying the
new lock; it just happens to be one syscall.  Using cond_resched() looks
like the right approach.

-- 
Revolutions do not require corporate support.

  reply	other threads:[~2002-10-02 19:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-02  2:39 John Levon
2002-10-02  3:23 ` John Levon
2002-10-02 13:14   ` Matthew Wilcox
2002-10-02 17:04     ` Andrew Morton
2002-10-02 18:30       ` Matthew Wilcox
2002-10-02 18:58         ` John Levon
2002-10-02 19:10           ` Robert Love
2002-10-02 19:21         ` Robert Love
2002-10-02 19:23         ` Andrew Morton
2002-10-02 20:05           ` Matthew Wilcox [this message]
2002-10-02 21:36 Manfred Spraul

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=20021002210508.C28586@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=akpm@digeo.com \
    --cc=levon@movementarian.org \
    --cc=linux-kernel@vger.kernel.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®