Re: Hung task when calling clone() due to netfilter/slab

From: Eric W. Biederman
Date: Thu Jan 19 2012 - 21:29:38 EST


Christoph Lameter <cl@xxxxxxxxx> writes:

> On Thu, 19 Jan 2012, Eric W. Biederman wrote:
>
>> Oh. I see. The problem is calling kobject_uevent (which happens to
>> live in slabs sysfs_slab_add) with a lock held. And kobject_uevent
>> makes a blocking call to userspace.
>>
>> No locks held seems to be a good policy on that one.
>
> Well we can just remove that call to kobject_uevent instead then. Does it
> do anything useful? Cannot remember why we put that in there.

Empirically it sounds like something is listening for it and doing cat
/proc/slabinfo. Something like that would have to occur for their to be
a deadlock that was observed.

On the flip side removing from sysfs with locks held must be done
carefully, and as a default I would recommend not to hold locks over
removing things from sysfs. As removal blocks waiting for all of the
callers into sysfs those sysfs attributes to complete.

It looks like you are ok on the removal because none of the sysfs
attributes appear to take the slub_lock, just /proc/slabinfo. But
it does look like playing with fire.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/