linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Raul Xiong <raulxiong@gmail.com>
To: Robert Love <rlove@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Neil Zhang <glacier1980@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Shankar Brahadeeswaran <shankoo77@gmail.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Bjorn Bringert <bringert@google.com>,
	devel <devel@driverdev.osuosl.org>,
	Hugh Dickins <hughd@google.com>,
	Anjana V Kumar <anjanavk12@gmail.com>,
	linux-next <linux-next@vger.kernel.org>
Subject: Re: [PATCH -next] ashmem: Fix ashmem_shrink deadlock.
Date: Tue, 17 Sep 2013 13:05:29 +0800	[thread overview]
Message-ID: <CAG9bXvkaAg2tqUKU8Gv-8rseraWzdaXXgohHg9BqnVmsLd=33w@mail.gmail.com> (raw)
In-Reply-To: <CAG6tG3yQVhANm1eHx3W3Hacp8t5Bh=pF9dQbHc3rSVs5n0WR9g@mail.gmail.com>

2013/5/17 Robert Love <rlove@google.com>:
> On Thu, May 16, 2013 at 1:19 PM, Andrew Morton
> <akpm@linux-foundation.org> wrote:
>> On Thu, 16 May 2013 13:08:17 -0400 Robert Love <rlove@google.com> wrote:
>>> This problem seems a rare proper use of mutex_trylock.
>>
>> Not really.  The need for a trylock is often an indication that a
>> subsystem has a locking misdesign.  That is indeed the case here.
>
> It is exactly the same as PF_MEMALLOC. We've got an effectively
> asynchronous event (shrinking) that can occur while you are holding
> locks requisite to that shrinking. Given that the shrinkage is best
> effort, a trylock actually communicates the intent pretty well: "If
> possible, grab this lock and shrink."
>
> I think the idiomatic fix is to introduce a GFP_SHMEM but that seems
> overkill. Lots of the GFP flags are really just preventing recursing
> into the shrinkage code and it seems ill-designed that we require
> developers to know where they might end up. But we can disagree. :)
>
>> Well, it's not exactly a ton of work, but adding a per-ashmem_area lock
>> to protect ->file would rather be putting lipstick on a pig.  I suppose
>> we can put the trylock in there and run away, but it wouldn't hurt to
>> drop in a big fat comment somewhere explaining that the driver should be
>> migrated to a per-object locking scheme.
>
> Unfortunately I think ashmem_shrink would need to grab the per-object
> lock too; it needs to update the ranges. I'm sure we could re-design
> this but I don't think it is as easy as simply pushing the locking
> into the objects.
>
>        Robert

Hi all,
I am wondering if this is fixed in latest kernel? We are continuously
seeing this deadlock issue.

Best Regards,
Raul

      reply	other threads:[~2013-09-17  5:05 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-01 13:56 [PATCH -next] ashmem: Fix ashmem_shrink deadlock Robert Love
2013-05-01 15:54 ` David Rientjes
2013-05-02 18:22   ` David Rientjes
2013-05-02 20:39     ` Greg Kroah-Hartman
2013-05-07 20:52 ` Andrew Morton
2013-05-13 21:42 ` Greg Kroah-Hartman
2013-05-14  3:29   ` Neil Zhang
2013-05-14  3:37     ` Raul Xiong
2013-05-16  8:15       ` Raul Xiong
2013-05-16 13:44         ` Robert Love
2013-05-16 16:45           ` Andrew Morton
2013-05-16 17:08             ` Robert Love
2013-05-16 17:19               ` Andrew Morton
2013-05-16 17:28                 ` Robert Love
2013-09-17  5:05                   ` Raul Xiong [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='CAG9bXvkaAg2tqUKU8Gv-8rseraWzdaXXgohHg9BqnVmsLd=33w@mail.gmail.com' \
    --to=raulxiong@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anjanavk12@gmail.com \
    --cc=bringert@google.com \
    --cc=dan.carpenter@oracle.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=glacier1980@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=rlove@google.com \
    --cc=shankoo77@gmail.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 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).