# systemd-udevd high CPU usage

## feiticeir0

Hi all !

Recently i've started having a problem with systemd-udevd . I noticed my computer was getting slow. Even a small operation like alt+tab is slow...

Using TOP, i get this:

```

top - 23:31:23 up  2:13,  3 users,  load average: 4,40, 4,76, 4,10

Tasks: 214 total,   3 running, 203 sleeping,   0 stopped,   8 zombie

%Cpu(s): 13,5 us, 13,8 sy,  0,0 ni, 68,5 id,  4,1 wa,  0,0 hi,  0,0 si,  0,0 st

KiB Mem:   7983212 total,  7811168 used,   172044 free,     3136 buffers

KiB Swap: 16777212 total,   400496 used, 16376716 free,   415800 cached

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND         

  155 root      20   0  230520 194808    652 R  99,7  2,4 121:44.40 systemd-udevd   

   52 root      20   0       0      0      0 R  87,2  0,0  30:41.34 kswapd0         

  337 root      20   0  493084  53264  44568 S   2,3  0,7   2:19.79 Xorg            

 1299 feitice+  20   0 1022668 123608  17324 S   1,6  1,5   2:22.70 chrome          

30163 feitice+  20   0 1050048  95836  23464 S   1,6  1,2   0:05.69 chrome          

25977 feitice+  20   0  582264  14868   5128 S   1,3  0,2   0:13.87 gnome-termin

```

I've noticed systemd-udevd was getting all the CPU...  Why was my question...

Then, i start monitoring the process with udevadm monitor and this is my result:

```

udevadm monitor

monitor will print the received events for:

UDEV - the event which udev sends out after rule processing

KERNEL - the kernel uevent

KERNEL[8145.177508] remove   /module/nvidia (module)

UDEV  [8145.177527] add      /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.177536] add      /module/nvidia (module)

KERNEL[8145.177545] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.186141] add      /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.189759] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.196034] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.196059] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.196067] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.196136] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.202166] remove   /module/nvidia (module)

UDEV  [8145.203083] add      /module/nvidia (module)

UDEV  [8145.217936] remove   /module/nvidia (module)

UDEV  [8145.223645] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

UDEV  [8145.232058] remove   /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.250535] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.252246] add      /module/nvidia (module)

KERNEL[8145.252949] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.262299] add      /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.271400] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.271493] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.271506] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.271582] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.277126] remove   /module/nvidia (module)

UDEV  [8145.284830] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.286148] add      /module/nvidia (module)

KERNEL[8145.286762] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.296175] add      /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.301405] add      /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.305005] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.305032] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.305040] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.305123] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.310140] remove   /module/nvidia (module)

KERNEL[8145.318950] add      /module/nvidia (module)

UDEV  [8145.319355] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.319594] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.328733] add      /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.337623] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.337649] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.337657] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.337735] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.342156] remove   /module/nvidia (module)

UDEV  [8145.343009] add      /module/nvidia (module)

UDEV  [8145.351687] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

UDEV  [8145.359549] remove   /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.371513] remove   /module/nvidia (module)

UDEV  [8145.376758] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.397337] add      /module/nvidia (module)

KERNEL[8145.411201] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.411407] add      /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.412172] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.420759] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.420784] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.420792] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.420862] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.427111] remove   /module/nvidia (module)

UDEV  [8145.428688] add      /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.435588] add      /module/nvidia (module)

KERNEL[8145.436167] add      /kernel/slab/:t-0012288 (slab)

KERNEL[8145.446236] add      /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.447664] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.455757] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.455802] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.455825] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.455910] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.463151] remove   /module/nvidia (module)

KERNEL[8145.472263] add      /module/nvidia (module)

KERNEL[8145.472845] add      /kernel/slab/:t-0012288 (slab)

UDEV  [8145.482788] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.483712] add      /bus/pci/drivers/nvidia (drivers)

UDEV  [8145.490846] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.493043] add      /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.493106] remove   /devices/pci0000:00/0000:00:01.0/0000:01:00.0/drm/card1 (drm)

KERNEL[8145.493116] remove   /bus/pci/drivers/nvidia (drivers)

KERNEL[8145.493194] remove   /kernel/slab/:t-0012288 (slab)

KERNEL[8145.499166] remove   /module/nvidia (module)

UDEV  [8145.500072] add      /module/nvidia (module)

UDEV  [8145.507386] remove   /kernel/slab/:t-0012288 (slab)

```

This is my system:

```

00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)

00:02.0 VGA compatible controller: Intel Corporation 3rd Gen Core processor Graphics Controller (rev 09)

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)

00:16.0 Communication controller: Intel Corporation 7 Series/C210 Series Chipset Family MEI Controller #1 (rev 04)

00:1a.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 7 Series/C210 Series Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 1 (rev c4)

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)

00:1c.3 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 4 (rev c4)

00:1d.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation HM76 Express Chipset LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 7 Series/C210 Series Chipset Family SMBus Controller (rev 04)

01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 630M] (rev ff)

03:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)

04:00.0 Ethernet controller: Qualcomm Atheros AR8161 Gigabit Ethernet (rev 08)

```

And i'm using linux-3.12.13-gentoo

And here are the nvidia-drivers version i've installed - although not in use

```

x11-drivers/nvidia-drivers-334.21-r3 

```

I've an Asus N56V - core i7 with an hybrid graphics card - nvidia optimus. I almost never use the nvidia card and i'm using intel i915 for my X display....  What could be causing all that activity with the udev ? Is it a bug in the nvidia module ?

Best regards

Bruno Santos

----------

## feiticeir0

Well, I've dig a bit more and I think I've solved it, but a lit more usage is needed.

I've just upgrade (to a unstable version in portage) the nvidia drivers and apparently I don't have this problem anymore.

I'll wai and see ! 

Cheers

Bruno

----------

## disperato

I'm having similar issues, on similar system. Let me explain.

starting from a few weeks ago, my computer start to hang with a frozen display (showing the last picture shown while working), frozen keyboard, frozen mouse.

I could not even use the ctrl+print (+S, +U, +B) sequence to safely reboot, had to rudely press the button, reboot with a key, fix partitions (need to avoid xfs corruption) and finally reboot.

The incident happened in various conditions, so could not say a specific program is the culprit. Didn't try ssh-ing to the laptop because hadn't time to configure it properly, nor the dmesg, rc.log and such were helpful in the slightest. The only thing clue I can tell, is I was using X (xfce4, precisely).

Hardware: intel+nvidia gfx 770m

Drivers: i915 from kernel; nvidia 334 from nvidia-drivers

Daemons: no bumblebee activated by default (I'm still getting used to it, so not using this so often, and *important* not using it when the freeze accidents happened. And have to say this is a very unfriendly way of using this infamous double cards hell, which highly discourage use of gpu, while keeping the intel video bus hot anyway: this fad is yet another stupid, idiotic way to engineer a system).

This nightmare stopped when I disabled the discrete GPU nvidia from BIOS. Obviously this is experimental, because it doesn't make sense having such a cpu and do not use it.

A few days after that (yesterday) I started using kernel from gentoo-sources-3.14.1. The problem had disappeared by disabling dGPU, and kept away using this new kernel, too.

I bet the solution was disabling dGPU.

Everything was going fine, up to a few minutes ago, when fans spiked up and 100% cpu was being used by a udev process  as stated by "top". Top signalled that another udev process was running too, using a smaller and usual cpu percentage (around 3%). Had to restart udev to get rid of the offending udev task.

Checking console 0, I found the messages: 

```
NVRM: no NVIDIA graphics adapter found

NVRM: NVIDIA init module failed!
```

This messages are normal, given that dGPU is disabled from BIOS, but my previous hangs + this late udev misbehaving are not.

And this message was repeatedly shown just while udev was abusing 100% cpu.

Version: udev-208

----------

## feiticeir0

Hi disperato.

Thanks for the reply.

My laptop never hanged or crashed, just gets really really really slow... It's painful trying to work like that. 

In my case, I can't deactivate the nvidia card on my BIOS  - i don't have that option

Last night, after i posted this thread, i've updated the nvidia-drivers -( I have bumblebee working, but i don't use much the nvidia card - when i play games - rarely - I try the nvidia card, but is not very often.) and everything seemed OK - but only today i can tell for sure if that worked or not. If it's ok, I'll open a bug for that version of the nvidia-drivers.

Best regards

Bruno Santos

----------

## feiticeir0

No... Still the same thing.... I'm really getting annoyed by this... 

No clues whatsoever...

----------

## feiticeir0

Well, if i stop bumblebee,  the messages stop and systemd-udevd stops !

Is this a bumblebee bug ???

----------

## disperato

I'm fighting (on a system never reformatted and constantly grown-updated-moved for 10 years or so, the time I've been a gentoo user) with the same beasts these days, nvidia-drivers (+xorg-server), bumblebee, and had one only incident with udevd behaving like your case, this is why I felt my case was similar. Now I'm realizing there is another difference, huge indeed, other than the difference between computer crashes and painfully slow marches: you have systemd-udevd, mine is openrc+udev

Intrigued by this fact I searched a bit on my system, just to discover that I don't have systemd installed and recalled that it is an alternative to the gentoo default openrc.

I have udevd, though, and only once had the slowing defect that is affecting your system. As for my issues, everything is working very fine (now, after much struggling, no more missed wake-up from sleep, no more errors from bumblebee, etc.). 

Hence my question is: do you need systemd? Maybe systemd-udevd is fighting with udevd? May be that bumblebee is defaulting to use system-udevd that conflicts with udevd eating cpu/ram or filling some bus?

The answer to the first question is quick: if you are a >=gnome-3.8 user it's yes, otherwise can be discovered by:

```

equery d sys-apps/systemd
```

I'm using openrc (+udev)  instead of systemd, and not experiencing that slow pain, nor had I that during this decade, never.

Similar events happened, not so often, hard to investigate, often due to conflicting packages where one was a useless  remnant of previous choices or just a concurrent alternative.

I'd try to solve this before fighting with bumblebee+nvidia-drivers.

As for the right combination of packages + some little hacks to the system to make it work well with the nvidia optimus beastie, I'll drop two lines on the forum once I'm really sure that everything is running smoothly.

----------

## feiticeir0

Hi disperato !

Well, that's right, i'm a Gnome 3 user.  I just love it, but always considering others - when i have the time and patient to try them... I've used KDE, xfce, openbox, fluxbox, etc... I'm not settled yet !

I'll deepen the search for the cause of the problem and try to find out what is causing this... Bumblebee is a serious candidate . The funny thing is, it doesn't start right away, after the system boots... After an hour or so, i start noticing the slowness of the system and it's when i check top and see the systemd-udevd problem... and monitoring udev i start seeing those lines about the nvidia card... 

I'll try and update bumblebee and see if it stops the problem... 

Thanks for your replys.

Best regards

Bruno

----------

## Royal_ts

Hey!

Was you research successfully? I got the same problem and obviously udevd crashed because there is no db in 

 *Quote:*   

> /sys/kernel/slab/:t-0012288

 

Do you know which kind of data's are stored in /sys/kernel/slab and why :t-0012288 does not exist?

Do u have a workaround or something like that?

by the way. a snippet of udev debug looks like that:

 *Quote:*   

> 
> 
> no db file to read /run/udev/data/+module:nvidia: No such file or directory
> 
> RUN '/bin/rm -f /dev/nvidiactl /dev/nvidia0 /dev/nvidia1' /etc/udev/rules.d/99-bumblebee-nvidia-dev.rules:3
> ...

 

for those guys who can handle that  :Very Happy: 

regards Stefan

----------

## superpwnzormegaman

Hi

I had a similiar issue, I think i fixed it by changing the bumlbebeed.service file in 

```
/etc/systemd/system/graphical.target.wants
```

 In there is a line 

```
Type=simple
```

 I changed it to 

```
Type=forking
```

I found this on the arch wiki, that sais deamons should be forking.

I hope this helps you as well.

-- edit --

no this does not work, instead of eating all your cpu the deamon will stay alive for about a minut and then kill itself.

----------

## .maverick

The same happens to me, too. Did anyone find anything helpful, yet? This thread is about the only thing that comes up when looking for the symptoms ...

----------

## Bert Reynolds

I just had this too.

I fixed it by cleaning up the udev db.

Running: udevadm info -c

----------

## V3n3RiX

Well, after 1 day of hunting what causes the problem I think I found it. Indeed plugin-container from firefox causes the nvidia module to be loaded. None of the above solutions worked for me. I managed to find the way plugin-container loads the nvidia module : it uses nvidia-modprobe binary . So I took away executable permissions from it and now everything works : full hw accelerated flash, and udevd is calm.

----------

## Ant P.

 *disperato wrote:*   

> I could not even use the ctrl+print (+S, +U, +B) sequence to safely reboot, had to rudely press the button, reboot with a key, fix partitions (need to avoid xfs corruption) and finally reboot.

 

For future reference: systemd disables most sysrq keys.

----------

## ulenrich

 *Ant P. wrote:*   

>  *disperato wrote:*   I could not even use the ctrl+print (+S, +U, +B) sequence to safely reboot, had to rudely press the button, reboot with a key, fix partitions (need to avoid xfs corruption) and finally reboot. 
> 
> For future reference: systemd disables most sysrq keys.

 

emerge sys-apps/gentoo-systemd-integration

for having systemd behavior as Gentoo users are used to. Though /etc/sysctl.d would be the better place of /usr/lib/sysctl.d/60-gentoo.conf

----------

