From: Tom Zanussi <tzanussi@gmail.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>,
akpm@linux-foundation.org, compudj@krystal.dyndns.org,
linux-kernel@vger.kernel.org, righi.andrea@gmail.com
Subject: Re: [PATCH 2/3] relay: Fix race condition which occurs when reading across CPUs.
Date: Mon, 16 Jun 2008 00:38:10 -0500 [thread overview]
Message-ID: <1213594690.7744.49.camel@charm-linux> (raw)
In-Reply-To: <84144f020806140916j7c39d3fr6ada38169ebc84c2@mail.gmail.com>
On Sat, 2008-06-14 at 19:16 +0300, Pekka Enberg wrote:
> On Fri, 13 Jun 2008 23:26:41 -0500
> Tom Zanussi <tzanussi@gmail.com> wrote:
> >> Alternatively, you could get rid of the problem by making sure CPU0
> >> never reads CPU1's data, by having the userspace reader use per-cpu
> >> threads and using sched_setaffinity() to pin each thread to a given
> >> cpu. See for example, the blktrace code, which does this.
>
> On Sat, Jun 14, 2008 at 6:11 PM, Eduard - Gabriel Munteanu
> <eduard.munteanu@linux360.ro> wrote:
> > Yes, and performance-wise this is better. Though I'm not sure setting
> > affinity is 100% safe. Will the thread be migrated soon enough, so we
> > don't read cross-CPU? The point is I'm not sure how hard this is
> > enforced.
> >
> > However, I suggest this patch should go in, for two reasons:
> > 1. It provides expected behavior in any such situation.
> > 2. It adds (almost) no overhead when used in conjuction with setting CPU
> > affinity. When the writer acquires the spinlock, it does not busy-wait,
> > so the spinlock just disables IRQs (relay_write()).
>
> Agreed. Tom, any objections to merging this patch?
Well, I suppose anyone who had a problem with it would make their own
local copy of relay_write() without it, or more likely they'd be using
relay_reserve() anyway. It does add some code to read() which can't be
gotten around, but since it adds (almost) no overhead, it shouldn't be a
problem.
So I guess I don't have strong feelings about it if it's solving a real
usability problem and doesn't cause any performance (or other)
regressions.
Tom
next prev parent reply other threads:[~2008-06-16 5:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 1:09 [PATCH 2/3] relay: Fix race condition which occurs when reading across CPUs Eduard - Gabriel Munteanu
2008-06-14 4:26 ` Tom Zanussi
2008-06-14 15:11 ` Eduard - Gabriel Munteanu
2008-06-14 16:16 ` Pekka Enberg
2008-06-16 5:38 ` Tom Zanussi [this message]
2008-06-16 6:19 ` Pekka Enberg
2008-06-17 4:52 ` Tom Zanussi
2008-06-16 12:22 ` Mathieu Desnoyers
2008-06-16 13:22 ` Eduard - Gabriel Munteanu
2008-06-16 16:46 ` Jens Axboe
2008-06-16 18:18 ` Pekka Enberg
2008-06-16 18:23 ` Mathieu Desnoyers
2008-06-16 18:28 ` Jens Axboe
2008-06-17 12:39 ` Eduard - Gabriel Munteanu
2008-06-17 12:49 ` Eduard - Gabriel Munteanu
2008-06-17 13:10 ` Mathieu Desnoyers
2008-06-17 13:35 ` Eduard - Gabriel Munteanu
2008-06-17 13:50 ` Mathieu Desnoyers
2008-06-17 14:55 ` Eduard - Gabriel Munteanu
2008-06-17 12:55 ` Mathieu Desnoyers
2008-06-17 13:21 ` Eduard - Gabriel Munteanu
-- strict thread matches above, loose matches on Subject: below --
2008-06-12 20:26 Eduard - Gabriel Munteanu
2008-06-12 22:58 ` Andrea Righi
2008-06-12 23:15 ` Eduard - Gabriel Munteanu
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=1213594690.7744.49.camel@charm-linux \
--to=tzanussi@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=compudj@krystal.dyndns.org \
--cc=eduard.munteanu@linux360.ro \
--cc=linux-kernel@vger.kernel.org \
--cc=penberg@cs.helsinki.fi \
--cc=righi.andrea@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.