On some large systems, /sys/devices is huge and it's not a wise idea to iterate it. `find` may cause tremendous contention on the kernfs_mutex when there are already stress on /sys, and it will perform very very poorly.
Simply check if drm class presents should be good enough.
Signed-off-by: Kairui Song kasong@redhat.com --- dracut-module-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ac0f196..ce05de7 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -58,7 +58,7 @@ depends() { _dep="$_dep znet" fi
- if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then + if [ -n "$( ls -A /sys/class/drm 2>/dev/null )" ] || [ -d /sys/module/hyperv_fb ]; then add_opt_module drm fi
On 3/19/21 6:21 PM, Kairui Song wrote:
On some large systems, /sys/devices is huge and it's not a wise idea to iterate it. `find` may cause tremendous contention on the kernfs_mutex when there are already stress on /sys, and it will perform very very poorly.
Simply check if drm class presents should be good enough.
Signed-off-by: Kairui Song kasong@redhat.com
dracut-module-setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ac0f196..ce05de7 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -58,7 +58,7 @@ depends() { _dep="$_dep znet" fi
- if [ -n "$( find /sys/devices -name drm )" ] || [ -d /sys/module/hyperv_fb ]; then
- if [ -n "$( ls -A /sys/class/drm 2>/dev/null )" ] || [ -d /sys/module/hyperv_fb ]; then add_opt_module drm fi
Acked-by: Pingfan Liu piliu@redhat.com