public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jes Sorensen <jes@sgi.com>
Cc: kaos@sgi.com, torvalds@osdl.org, viro@zeniv.linux.org.uk,
	linux-kernel@vger.kernel.org
Subject: Re: [patch] reduce IPI noise due to /dev/cdrom open/close
Date: Tue, 4 Jul 2006 01:04:55 -0700	[thread overview]
Message-ID: <20060704010455.811eedbc.akpm@osdl.org> (raw)
In-Reply-To: <44AA1D7A.2060202@sgi.com>

On Tue, 04 Jul 2006 09:49:14 +0200
Jes Sorensen <jes@sgi.com> wrote:

> Keith Owens wrote:
> >> static void invalidate_bh_lrus(void)
> >> {
> >> -	on_each_cpu(invalidate_bh_lru, NULL, 1, 1);
> >> +	/*
> >> +	 * Need to hand down a copy of the mask or we wouldn't be run
> >> +	 * anywhere due to the original mask being cleared
> >> +	 */
> >> +	cpumask_t mask = lru_in_use;
> >> +	cpus_clear(lru_in_use);
> >> +	schedule_on_each_cpu_mask(invalidate_bh_lru, NULL, mask);
> >> }
> > 
> > Racy?  Start with an empty lru_in_use.
> > 
> > Cpu A                         Cpu B
> > invalidate_bh_lrus()
> > mask = lru_in_use;
> > preempted
> >                               block I/O
> > 			      bh_lru_install()
> > 			      cpu_set(cpu, lru_in_use);
> > resume
> > cpus_clear(lru_in_use);
> > schedule_on_each_cpu_mask() - does not send IPI to cpu B
> 
> I guess the real question is whether the device is still valid for new
> IO by the time we hit the invalidate function. If not, and that was my,
> possibly flawed, assumption, then it's not an issue. Whatever bh's are
> left in the lrus from other devices will be handled on the next hit.
> 

The problem is that we can actually lose bits in invalidate_bh_lrus().

CPU0				CPU1

mask = lru_in_use;
				cpu_set(lru_in_use, 1);
cpus_clear(lru_in_use);

Now we have a stray bh which nobody knows about.

      reply	other threads:[~2006-07-04  8:09 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-03 15:33 [patch] reduce IPI noise due to /dev/cdrom open/close Jes Sorensen
2006-07-03 15:37 ` [PATCH] simplfy bh_lru_install Milton Miller
2006-07-03 15:37   ` Milton Miller
2006-07-03 15:37 ` [patch] reduce IPI noise due to /dev/cdrom open/close Milton Miller
2006-07-04  7:47   ` Jes Sorensen
2006-07-04  7:53     ` Arjan van de Ven
2006-07-04  8:12       ` Jes Sorensen
2006-07-04  8:23         ` Arjan van de Ven
2006-07-04  8:33           ` Jes Sorensen
2006-07-04 13:02         ` Helge Hafting
2006-07-04  8:42     ` Milton Miller
2006-07-04  8:59       ` Jes Sorensen
2006-07-04  9:30         ` Milton Miller
2006-07-04  5:32 ` Keith Owens
2006-07-04  6:41   ` Andrew Morton
2006-07-04  7:51     ` Jes Sorensen
2006-07-04  9:13     ` Milton Miller
2006-07-04 17:33     ` Nick Piggin
2006-07-05  7:30       ` Jes Sorensen
2006-07-05 18:26         ` Nick Piggin
2006-07-05  0:10     ` Paul Mackerras
2006-07-04  7:49   ` Jes Sorensen
2006-07-04  8:04     ` Andrew Morton [this message]

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=20060704010455.811eedbc.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=jes@sgi.com \
    --cc=kaos@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=viro@zeniv.linux.org.uk \
    /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