+ kobject-dont-block-for-each-kobject_uevent.patch added to -mm tree
Subsystems (2)
[email protected]
maintainerSubject: + kobject-dont-block-for-each-kobject_uevent.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 18 Feb 2014 12:53:32 -0800
The patch titled
Subject: kobject: don't block for each kobject_uevent
has been added to the -mm tree. Its filename is
kobject-dont-block-for-each-kobject_uevent.patch
This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/kobject-dont-block-for-each-kobject_uevent.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/kobject-dont-block-for-each-kobject_uevent.patch
Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's
*** Remember to use Documentation/SubmitChecklist when testing your code ***
The -mm tree is included into linux-next and is updated there every 3-4 working days
------------------------------------------------------
From: Vladimir Davydov <[email protected]>
Subject: 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 f520360d93c ("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.
---
include/linux/kobject.h | 1 lib/kobject_uevent.c | 42 ++++++++++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 6 deletions(-)
include/linux/kobject.h renamed from include/linux/kobject.h~kobject-dont-block-for-each-kobject_uevent +1 -0
@@ -119,6 +119,7 @@ struct kobj_type { };struct kobj_uevent_env { +char *argv[3 ];char *envp[UEVENT_NUM_ENVP ];int envp_idx;char buf[UEVENT_BUFFER_SIZE ];
lib/kobject_uevent.c renamed from lib/kobject_uevent.c~kobject-dont-block-for-each-kobject_uevent +36 -6
62 lines not on this page · raw message
_
Patches currently in -mm which might be from [email protected] are
mm-vmscan-respect-numa-policy-mask-when-shrinking-slab-on-direct-reclaim.patch mm-vmscan-move-call-to-shrink_slab-to-shrink_zones.patch mm-vmscan-remove-shrink_control-arg-from-do_try_to_free_pages.patch mm-vmscan-shrink_slab-rename-max_pass-freeable.patch kobject-dont-block-for-each-kobject_uevent.patch kobject-dont-block-for-each-kobject_uevent-v2.patch slub-do-not-drop-slab_mutex-for-sysfs_slab_add.patch linux-next.patch