All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Czerner <lczerner@redhat.com>
To: Lin Ming <lxy@ss.pku.edu.cn>
Cc: Lukas Czerner <lczerner@redhat.com>,
	Bart Van Assche <bvanassche@acm.org>,
	Jens Axboe <jaxboe@fusionio.com>,
	Mike Snitzer <snitzer@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: blkdev_issue_discard() hangs forever if the underlying storage device is removed
Date: Mon, 29 Aug 2011 16:42:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1108291637470.3904@dhcp-27-109.brq.redhat.com> (raw)
In-Reply-To: <CAF1ivSY0NwdZTCQQ_BG5Vk8rnjiH=sS0V08ajxc8Gw5YBwD3qA@mail.gmail.com>

On Mon, 29 Aug 2011, Lin Ming wrote:

> On Mon, Aug 29, 2011 at 7:56 PM, Lukas Czerner <lczerner@redhat.com> wrote:
> >
> > Regarding the atomic operations I do not think that implicit memory
> > barriers are needed here as atomic_dec_and_test() implies memory
> 
> Which implicit memory barrier you are talking about?

smp_mb() at both side of the operation as documented here in
Documentation/memory-barriers.txt

[citation]
Any atomic operation that modifies some state in memory and returns
information about the state (old or new) implies an SMP-conditional
general memory barrier (smp_mb()) on each side of the actual operation
(with the exception of explicit lock operations, described later).
These include:

	xchg();
	cmpxchg();
	atomic_cmpxchg();
	atomic_inc_return();
	atomic_dec_return();
	atomic_add_return();
	atomic_sub_return();
	atomic_inc_and_test();
	atomic_dec_and_test();
	atomic_sub_and_test();
	atomic_add_negative();
	atomic_add_unless();
	test_and_set_bit();
	test_and_clear_bit();
	test_and_change_bit();

[/citation]

-Lukas

> 
> > barrier, atomic_set() is out of the scope of our interest (and it would
> > not cause the problem like that anyway) and reordering atomic_inc()
> > would not cause problem like this as well.
> 

  reply	other threads:[~2011-08-29 14:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-27  6:11 blkdev_issue_discard() hangs forever if the underlying storage device is removed Bart Van Assche
2011-08-29 11:56 ` Lukas Czerner
2011-08-29 14:15   ` Lin Ming
2011-08-29 14:42     ` Lukas Czerner [this message]
2011-08-29 15:11       ` Lin Ming
2011-08-29 15:16         ` Lukas Czerner
2011-08-29 15:26           ` Lin Ming
2011-08-29 17:56   ` Bart Van Assche
2011-08-30  2:01     ` Dave Chinner
2011-08-30 10:38       ` Bart Van Assche
2011-09-27 17:57       ` Bart Van Assche
2011-08-30 10:34     ` Lukas Czerner
2011-09-22 17:26 ` Bart Van Assche

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=alpine.LFD.2.00.1108291637470.3904@dhcp-27-109.brq.redhat.com \
    --to=lczerner@redhat.com \
    --cc=bvanassche@acm.org \
    --cc=jaxboe@fusionio.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lxy@ss.pku.edu.cn \
    --cc=snitzer@redhat.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.