linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: George Wang <xuw2015@gmail.com>
To: dhowells@redhat.com
Cc: linux-btrfs@vger.kernel.org
Subject: btrfs/078 may got stuck in the __wait_on_atomic_t
Date: Fri, 24 Apr 2015 20:08:04 +0800	[thread overview]
Message-ID: <CAPBX1xJsZ+spTHNLhq+vyHt_ex_wjPGoz6H8fsV3=faNJ0jJyw@mail.gmail.com> (raw)

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

             reply	other threads:[~2015-04-24 12:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-24 12:08 George Wang [this message]
2015-04-24 14:03 ` btrfs/078 may got stuck in the __wait_on_atomic_t David Howells

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='CAPBX1xJsZ+spTHNLhq+vyHt_ex_wjPGoz6H8fsV3=faNJ0jJyw@mail.gmail.com' \
    --to=xuw2015@gmail.com \
    --cc=dhowells@redhat.com \
    --cc=linux-btrfs@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).