From 98e193529318119e1d16f2efa6ae280fe39b7294 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Tue, 9 Nov 2021 20:48:26 +0800 Subject: [PATCH] Don't iterate the whole /sys/devices just to find drm device upstream: fedora resolves: bz2003832 conflict: none commit c6021648f1db52a5e2eee31ec409efe468fe5af2 Author: Kairui Song Date: Fri Mar 19 18:21:11 2021 +0800 Don't iterate the whole /sys/devices just to find drm device 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 Acked-by: Pingfan Liu Signed-off-by: Tao Liu --- 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 5918484..68b2874 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -45,7 +45,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