Re: [PATCH -next] ashmem: Fix ashmem_shrink deadlock.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/5/17 Robert Love <rlove@xxxxxxxxxx>:
> On Thu, May 16, 2013 at 1:19 PM, Andrew Morton
> <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>> On Thu, 16 May 2013 13:08:17 -0400 Robert Love <rlove@xxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-next" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux USB Development]     [Yosemite News]     [Linux SCSI]

  Powered by Linux