* btrfs/078 may got stuck in the __wait_on_atomic_t
@ 2015-04-24 12:08 George Wang
2015-04-24 14:03 ` David Howells
0 siblings, 1 reply; 2+ messages in thread
From: George Wang @ 2015-04-24 12:08 UTC (permalink / raw)
To: dhowells; +Cc: linux-btrfs
Hi, I got stuck by btrfs/078 with 1 cpu(2 core) machine. And I notice
this patch maybe the
root cause of it.
commit cb65537ee1134d3cc55c1fa83952bc8eb1212833
Author: David Howells <dhowells@redhat.com>
Date: Fri May 10 19:50:26 2013 +0100
Add wait_on_atomic_t() and wake_up_atomic_t()
<snip>
+/*
+ * To allow interruptible waiting and asynchronous (i.e. nonblocking) waiting,
+ * the actions of __wait_on_atomic_t() are permitted return codes. Nonzero
+ * return codes halt waiting and return.
+ */
+static __sched
+int __wait_on_atomic_t(wait_queue_head_t *wq, struct wait_bit_queue *q,
+ int (*action)(atomic_t *), unsigned mode)
+{
+ atomic_t *val;
+ int ret = 0;
+
+ do {
+ prepare_to_wait(wq, &q->wait, mode);
+ val = q->key.flags;
+ if (atomic_read(val) == 0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^here,
is this judge ok? if the val not 0,
the most thing we want to do is schedule.
+ ret = (*action)(val);
+ } while (!ret && atomic_read(val) != 0);
+ finish_wait(wq, &q->wait);
+ return ret;
+}
Thanks,
George
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: btrfs/078 may got stuck in the __wait_on_atomic_t
2015-04-24 12:08 btrfs/078 may got stuck in the __wait_on_atomic_t George Wang
@ 2015-04-24 14:03 ` David Howells
0 siblings, 0 replies; 2+ messages in thread
From: David Howells @ 2015-04-24 14:03 UTC (permalink / raw)
To: George Wang; +Cc: dhowells, linux-btrfs
George Wang <xuw2015@gmail.com> wrote:
> + do {
> + prepare_to_wait(wq, &q->wait, mode);
> + val = q->key.flags;
> + if (atomic_read(val) == 0)
> + ret = (*action)(val);
> + } while (!ret && atomic_read(val) != 0);
This isn't what's in the upstream kernel now. See commit
42577ca8c3616baaafdd8f167b2e1fb959026081.
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-24 14:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-24 12:08 btrfs/078 may got stuck in the __wait_on_atomic_t George Wang
2015-04-24 14:03 ` David Howells
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).