From: Tim Wright <timw@splhi.com>
To: Andrew Morton <andrewm@uow.edu.au>
Cc: timw@splhi.com, nigel@nrg.org,
"David S. Miller" <davem@redhat.com>,
linux-kernel@vger.kernel.org,
linux-audio-dev@ginette.musique.umontreal.ca
Subject: Re: [linux-audio-dev] low-latency scheduling patch for 2.4.0
Date: Mon, 15 Jan 2001 11:46:25 -0800 [thread overview]
Message-ID: <20010115114625.A1896@scutter.internal.splhi.com> (raw)
In-Reply-To: <200101110519.VAA02784@pizda.ninka.net> <Pine.LNX.4.05.10101111233241.5936-100000@cosmic.nrg.org> <3A5F0706.6A8A8141@uow.edu.au>, <3A5F0706.6A8A8141@uow.edu.au>; <20010112071150.A1653@scutter.internal.splhi.com> <3A5FA8D0.A88BD7CA@uow.edu.au>
In-Reply-To: <3A5FA8D0.A88BD7CA@uow.edu.au>; from andrewm@uow.edu.au on Sat, Jan 13, 2001 at 12:01:04PM +1100
On Sat, Jan 13, 2001 at 12:01:04PM +1100, Andrew Morton wrote:
> Tim Wright wrote:
[...]
> > p_lock(lock);
> > retry:
> > ...
> > if (condition where we need to sleep) {
> > p_sema_v_lock(sema, lock);
> > /* we got woken up */
> > p_lock(lock);
> > goto retry;
> > }
> > ...
>
> That's an interesting concept. How could this actually be used
> to protect a particular resource? Do all users of that
> resource have to claim both the lock and the semaphore before
> they may access it?
>
Ahh, I thought I might have been a tad terse in my explanation. No, the
idea here is that the spinlock guards the access to the data structure we're
concerned about. The sort of code I was thinking about would be where we need
to allocate a data structure. We attempt to grab it from the freelist, and if
successful, then everything is fine. Otherwise, we need to sleep waiting for
some resources to be freed up. So we atomically drop the lock and sleep on
the allocation semaphore. The freeing-up path is also protected by the same
lock, and would do something like 'if (there are sleepers) wake(sleepers)'.
This wakes up the sleeper who grabs the spinlock and retries the alloc. The
result is no races, but we don't spin or hold the lock for a long time.
It doesn't have to be an allocation. The same idea works for e.g. protecting
access to "buffer cache" (not necessarily Linux) data, and then atomically
releasing the lock and sleeping waiting for an I/O to happen.
>
> There are a number of locks (such as pagecache_lock) which in the
> great majority of cases are held for a short period, but are
> occasionally held for a long period. So these locks are not
> a performance problem, they are not a scalability problem but
> they *are* a worst-case-latency problem.
>
Understood. Whether the above metaphor works depends on whether or not the
"holding for a long time" case fits this pattern i.e. at this stage,
I'm not sufficiently familiar with the Linux VM code. I'm in the process
of rectifying that problem :-)
Regards,
Tim
--
Tim Wright - timw@splhi.com or timw@aracnet.com or twright@us.ibm.com
IBM Linux Technology Center, Beaverton, Oregon
"Nobody ever said I was charming, they said "Rimmer, you're a git!"" RD VI
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2001-01-15 19:47 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-01-07 2:53 low-latency scheduling patch for 2.4.0 Andrew Morton
2001-01-11 3:12 ` [linux-audio-dev] " Jay Ts
2001-01-11 3:22 ` Cort Dougan
2001-01-11 12:38 ` Alan Cox
2001-01-11 11:30 ` Andrew Morton
2001-01-11 5:19 ` David S. Miller
2001-01-11 13:57 ` Daniel Phillips
2001-01-11 20:55 ` Nigel Gamble
2001-01-11 21:31 ` David S. Miller
2001-01-15 5:27 ` george anzinger
2001-01-12 13:30 ` Andrew Morton
2001-01-12 15:11 ` Tim Wright
2001-01-12 22:30 ` Nigel Gamble
2001-01-13 1:01 ` Andrew Morton
2001-01-15 19:46 ` Tim Wright [this message]
2001-01-12 22:46 ` Nigel Gamble
2001-01-12 23:08 ` george anzinger
2001-01-21 0:05 ` yodaiken
2001-01-22 0:54 ` Nigel Gamble
2001-01-22 1:49 ` Paul Barton-Davis
2001-01-22 2:21 ` Nigel Gamble
2001-01-22 3:31 ` J Sloan
2001-01-28 13:14 ` yodaiken
2001-01-28 14:07 ` Bill Huey
2001-01-28 14:26 ` Andrew Morton
2001-01-29 5:02 ` yodaiken
2001-01-28 14:19 ` Andrew Morton
2001-01-28 16:17 ` Joe deBlaquiere
2001-01-29 15:44 ` yodaiken
2001-01-29 17:23 ` Joe deBlaquiere
2001-01-29 17:38 ` yodaiken
2001-01-29 18:03 ` Joe deBlaquiere
2001-01-30 15:08 ` David Woodhouse
2001-01-30 15:44 ` Joe deBlaquiere
2001-01-30 16:29 ` Paul Davis
2001-01-30 16:35 ` David Woodhouse
2001-01-31 7:55 ` george anzinger
2001-01-30 16:19 ` David Woodhouse
2001-02-01 12:40 ` Pavel Machek
2001-02-01 22:33 ` David Woodhouse
2001-02-02 4:17 ` Joe deBlaquiere
2001-01-30 20:51 ` yodaiken
2001-01-30 21:00 ` David Woodhouse
2001-01-29 22:08 ` Pavel Machek
2001-01-29 22:31 ` Roger Larsson
2001-01-29 23:46 ` Joe deBlaquiere
2001-01-30 15:08 ` David Woodhouse
2001-01-12 13:21 ` Andrew Morton
2001-01-13 2:45 ` Jay Ts
2001-01-21 0:10 ` yodaiken
2001-01-26 9:14 ` Pavel Machek
2001-01-13 18:11 ` video drivers hog pci bus ? [was:[linux-audio-dev] low-latency scheduling patch for 2.4.0] Jörn Nettingsmeier
2001-01-14 11:35 ` low-latency scheduling patch for 2.4.0 Andrew Morton
2001-01-14 14:38 ` Gregory Maxwell
2001-01-15 10:59 ` Andrew Morton
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=20010115114625.A1896@scutter.internal.splhi.com \
--to=timw@splhi.com \
--cc=andrewm@uow.edu.au \
--cc=davem@redhat.com \
--cc=linux-audio-dev@ginette.musique.umontreal.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=nigel@nrg.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