All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xue jiufei <xuejiufei@huawei.com>
To: ocfs2-devel@oss.oracle.com
Subject: [Ocfs2-devel] A deadlock when system do not has sufficient memory
Date: Wed, 20 Aug 2014 11:57:34 +0800	[thread overview]
Message-ID: <53F41CAE.2040204@huawei.com> (raw)

Hi all,
We found there may exist a deadlock when system has not sufficient
memory. Here's the situation:
            N1                                      N2
                                             send message to N1
      o2net_wq(kworker)
receiving message and call corresponding
handler to handle this message. It may 
need to alloc some memory(use GFP_NOFS or GFP_KERNEL).
but there's no sufficient memory, lower then
min watermark. So it wakeup kswapd to reclaim memory
and itself may also call
__alloc_pages_direct_reclaim(), trying to
free some pages.

It tries to free ocfs2 inode
cache and calls ocfs2_drop_lock()->dlmunlock()
to drop inode lock, sending unlock message to master,
say N2. When reply comes, queue sc_rx_work and
wait o2net_wq to handle this work. however
o2net_wq is still handling last message, so can not 
process the reply message. It will wait
o2net_nsw_completed() in o2net_send_message_vec()
forever. 
Kswapd thread enconter the same situation.


So is there any advice to solve this deadlock?
And what is the probability that kmalloc return ENOMEM when use GFP_ATOMIC flag?

Thanks.

             reply	other threads:[~2014-08-20  3:57 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-20  3:57 Xue jiufei [this message]
2014-08-22  8:30 ` [Ocfs2-devel] A deadlock when system do not has sufficient memory Xue jiufei
2014-08-22 17:08   ` Sunil Mushran
2014-08-25  2:05     ` Xue jiufei
2014-08-25  5:00       ` Sunil Mushran
2014-08-25  5:41         ` Joseph Qi
2014-08-25  5:45           ` Sunil Mushran
2014-08-25  6:05             ` Joseph Qi
2014-08-25 17:13               ` Sunil Mushran
2014-08-27  1:57                 ` Xue jiufei
2014-08-28  1:16                   ` Sunil Mushran
2014-08-25  1:50   ` Junxiao Bi
2014-08-28  8:16     ` Xue jiufei
2014-08-29  3:26       ` Junxiao Bi
2014-08-29  7:22         ` Xue jiufei
2014-08-29  7:30           ` Junxiao Bi

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=53F41CAE.2040204@huawei.com \
    --to=xuejiufei@huawei.com \
    --cc=ocfs2-devel@oss.oracle.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.