Vladimir Davydov bcccff93af kobject: don't block for each kobject_uevent
Currently kobject_uevent has somewhat unpredictable semantics.  The
point is, since it may call a usermode helper and wait for it to execute
(UMH_WAIT_EXEC), it is impossible to say for sure what lock dependencies
it will introduce for the caller - strictly speaking it depends on what
fs the binary is located on and the set of locks fork may take.  There
are quite a few kobject_uevent's users that do not take this into
account and call it with various mutexes taken, e.g.  rtnl_mutex,
net_mutex, which might potentially lead to a deadlock.

Since there is actually no reason to wait for the usermode helper to
execute there, let's make kobject_uevent start the helper asynchronously
with the aid of the UMH_NO_WAIT flag.

Personally, I'm interested in this, because I really want kobject_uevent
to be called under the slab_mutex in the slub implementation as it used
to be some time ago, because it greatly simplifies synchronization and
automatically fixes a kmemcg-related race.  However, there was a
deadlock detected on an attempt to call kobject_uevent under the
slab_mutex (see https://lkml.org/lkml/2012/1/14/45), which was reported
to be fixed by releasing the slab_mutex for kobject_uevent.

Unfortunately, there was no information about who exactly blocked on the
slab_mutex causing the usermode helper to stall, neither have I managed
to find this out or reproduce the issue.

BTW, this is not the first attempt to make kobject_uevent use
UMH_NO_WAIT.  Previous one was made by commit f520360d93cd ("kobject:
don't block for each kobject_uevent"), but it was wrong (it passed
arguments allocated on stack to async thread) so it was reverted in
05f54c13cd0c ("Revert "kobject: don't block for each kobject_uevent".").
It targeted on speeding up the boot process though.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Cc: Greg KH <greg@kroah.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-04-03 16:21:04 -07:00
..
2013-08-14 13:55:15 +05:30
2014-02-15 10:58:17 +00:00
2014-01-25 10:49:30 -08:00
2014-04-01 15:38:47 -07:00
2014-03-28 16:29:35 -04:00
2014-01-20 11:55:23 -08:00
2013-12-23 18:34:58 -08:00
2013-09-10 13:03:41 -07:00
2014-01-24 22:39:54 +01:00
2014-04-01 15:14:04 -07:00
2013-11-23 22:33:56 -08:00
2013-12-22 23:14:27 -08:00
2013-11-15 09:32:21 +09:00
2013-11-09 00:16:29 -05:00
2014-03-11 11:52:47 +01:00
2014-04-03 16:20:58 -07:00
2014-02-13 10:08:52 +05:30
2014-01-16 10:23:02 +10:30
2014-03-10 11:44:42 -04:00
2013-08-22 22:13:54 -07:00
2014-03-10 17:26:19 -07:00
2014-02-20 14:54:28 +01:00
2014-03-04 07:55:47 -08:00
2014-01-16 11:15:50 +01:00
2014-01-26 22:48:35 +01:00
2013-12-29 16:34:25 -05:00
2014-02-19 17:22:44 +01:00
2014-02-13 18:12:04 -08:00
2013-09-13 15:09:52 +02:00
2013-08-09 10:49:00 +02:00
2014-01-25 08:55:09 +01:00
2014-04-03 16:20:50 -07:00
2013-08-28 21:35:14 -07:00
2014-02-13 20:21:59 -08:00
2013-12-11 15:52:34 +01:00
2014-02-28 15:36:37 -08:00
2013-12-26 13:29:35 -05:00
2014-01-16 10:23:03 +10:30
2013-11-09 00:16:19 -05:00
2014-03-04 13:51:06 -05:00
2014-01-27 21:02:39 -08:00
2013-11-09 00:16:19 -05:00
2013-10-14 17:15:48 +02:00
2013-12-05 13:05:48 -08:00
2014-01-31 15:39:07 -08:00
2014-01-25 03:14:05 -05:00
2014-03-07 10:24:49 -05:00
2014-01-13 14:29:49 -08:00
2014-01-03 11:22:21 -08:00
2014-04-02 14:27:15 -07:00
2014-04-03 16:21:04 -07:00
2014-04-01 18:49:04 -07:00
2014-03-19 15:11:19 -06:00
2013-10-17 00:36:06 +02:00
2014-02-17 15:01:52 -08:00
2013-12-18 19:04:50 -08:00
2014-04-01 16:13:21 -07:00
2014-01-28 13:20:09 -08:00
2013-12-19 19:09:38 -05:00
2014-01-27 21:02:39 -08:00
2013-09-10 18:56:32 -04:00
2014-02-15 11:55:28 -08:00
2014-02-17 15:01:37 -08:00
2014-04-01 17:06:09 -07:00
2013-10-17 15:53:09 -04:00
2014-01-30 16:56:55 -08:00