Solved Why would CPU usage be higher in Freebsd vs linux on identical systems?

I am running two identical DELL Optiplex 990 PCs. On one, I am running Freebsd 13.1 stable with DWM. On the other, I'm running Void Linux stable with DWM. When I run top on each system in xterm with only another instance of xterm running in order to use scrot, I get the following for each:

FREEBSD:
top-free.png


VOID LINUX
top-void.png


Despite a number of online searches, I have not been able to find an explanation for this situation. Specifically why Xorg and Bash are using so much CPU in Freebsd vs Void? I would appreciate either an explanation or a link to an explanation. Thanks!!! :)
 
I am running Freebsd 13.1 stable
13-STABLE is 13.2-STABLE now. So this is either an old -STABLE or not a -STABLE but a 13.1-RELEASE.

And please, don't post pictures of text. They're impossible to quote from.

Seeing you have a high CPU load with Xorg, I'm guessing you're not using an accelerated graphics driver. Which begs the question, what graphics card (internal iGPU perhaps?) do you have and which driver is being loaded?
 
I would run `truss` on the bash process. Xorg can be a bit uncontrollable, but bash should shut up if it is just an interactive shell.

I suspect that this bash process is something trying to setup something about your X11 session? Try locating the bash process in `ps -alx`.
 
13-STABLE is 13.2-STABLE now. So this is either an old -STABLE or not a -STABLE but a 13.1-RELEASE.

And please, don't post pictures of text. They're impossible to quote from.

Seeing you have a high CPU load with Xorg, I'm guessing you're not using an accelerated graphics driver. Which begs the question, what graphics card (internal iGPU perhaps?) do you have and which driver is being loaded?
I should have checked before I wrote that I was using 13.1. I was wrong.
uname -a shows:

Code:
FreeBSD Big 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

As far as I can tell, there is no gpu on the system.
lspci shows:
Code:
[don ~]$ sudo lspci
Password:
00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
00:16.0 Communication controller: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1 (rev 04)
00:16.3 Serial controller: Intel Corporation 6 Series/C200 Series Chipset Family KT Controller (rev 04)
00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)
00:1a.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2 (rev 04)
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 04)
00:1c.0 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1 (rev b4)
00:1c.2 PCI bridge: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 3 (rev b4)
00:1d.0 USB controller: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1 (rev 04)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev a4)
00:1f.0 ISA bridge: Intel Corporation Q67 Express Chipset LPC Controller (rev 04)
00:1f.2 SATA controller: Intel Corporation 6 Series/C200 Series Chipset Family 6 port Desktop SATA AHCI Controller (rev 04)
00:1f.3 SMBus: Intel Corporation 6 Series/C200 Series Chipset Family SMBus Controller (rev 04)

As for device drivers, I indicated the intel drivers in rc.conf:

Code:
[don ~]$ cat /etc/rc.conf
clear_tmp_enable="YES"
sendmail_enable="NONE"
hostname="Big"
ifconfig_em0="DHCP"
ntpdate_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"
firewall_enable="YES"
firewall_quiet="YES"
firewall_type="workstation"
firewall_myservices="80 443"
firewall_logdeny="YES"
sound_load="YES"
snd_hda_load="YES"
cupsd_enable="YES"
dbus_enable="YES"
kld_list="i915kms"
allscreens_flags="-f terminus-b32"
linux_enable="NO"
ubuntu_enable="YES"

And the loaded modules are as follows:

Code:
[don ~]$ sudo kldstat
Password:
Id Refs Address                Size Name
 1   88 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff82140000     a4a0 cryptodev.ko
 3    1 0xffffffff8214b000   59dfa8 zfs.ko
 4    1 0xffffffff82b20000   1858b8 i915kms.ko
 5    1 0xffffffff82ca6000    739e0 drm.ko
 6    2 0xffffffff82d1a000     5220 linuxkpi_gplv2.ko
 7    3 0xffffffff82d20000     62d8 dmabuf.ko
 8    1 0xffffffff82d27000     3250 ichsmb.ko
 9    1 0xffffffff82d2b000     2180 smbus.ko
10    1 0xffffffff82d2e000     3340 uhid.ko
11    1 0xffffffff82d32000     4350 ums.ko
12    1 0xffffffff82d37000     3380 usbhid.ko
13    1 0xffffffff82d3b000     31f8 hidbus.ko
14    1 0xffffffff82d3f000    27190 ipfw.ko
15    1 0xffffffff82d67000     2a08 mac_ntpd.ko
16    1 0xffffffff82d6a000    31a80 linux.ko
17    4 0xffffffff82d9c000     be88 linux_common.ko
18    1 0xffffffff82da8000    14b98 netlink.ko
19    1 0xffffffff82dbd000    2dca0 linux64.ko
20    1 0xffffffff82deb000     2260 pty.ko
21    1 0xffffffff82dee000     73b0 linprocfs.ko
22    1 0xffffffff82df6000     3284 linsysfs.ko
23    1 0xffffffff82dfa000     3530 fdescfs.ko
24    1 0xffffffff82dfe000     4700 nullfs.ko

If there are other commands that I should be running, please let me know. I am relatively new to FreeBSD. Thanks!!
 
I should have checked before I wrote that I was using 13.1. I was wrong.
That's fine, 13.1-RELEASE is still supported (this will end soon though). You need to be careful with words like 'stable' or 'current' though, they have a specific meaning with FreeBSD; 25.5. Tracking a Development Branch

As far as I can tell, there is no gpu on the system.
Sure you have, or else you wouldn't be able to see anything on your monitor ;)
It's this one:
Code:
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
That's the iGPU that's builtin on the CPU. 2nd generation is pretty old though, not sure if it's supported but for Intel or AMD graphics cards (including the builtin GPU on those CPUs) you need to install graphics/drm-kmod.

And it looks like you're already loading it:
Code:
 4    1 0xffffffff82b20000   1858b8 i915kms.ko
 5    1 0xffffffff82ca6000    739e0 drm.ko

But as I said, I'm not sure about 2nd generation CPU/GPUs. If I remember correctly it starts with the 3rd generation.

If there are other commands that I should be running, please let me know.
Yes, cat /var/log/Xorg.0.log | nc termbin.com 9999 and post the URL here. Then we can have a look at your Xorg log.
 
That's fine, 13.1-RELEASE is still supported (this will end soon though). You need to be careful with words like 'stable' or 'current' though, they have a specific meaning with FreeBSD; 25.5. Tracking a Development Branch


Sure you have, or else you wouldn't be able to see anything on your monitor ;)
It's this one:
Code:
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)
That's the iGPU that's builtin on the CPU. 2nd generation is pretty old though, not sure if it's supported but for Intel or AMD graphics cards (including the builtin GPU on those CPUs) you need to install graphics/drm-kmod.

And it looks like you're already loading it:
Code:
 4    1 0xffffffff82b20000   1858b8 i915kms.ko
 5    1 0xffffffff82ca6000    739e0 drm.ko

But as I said, I'm not sure about 2nd generation CPU/GPUs. If I remember correctly it starts with the 3rd generation.


Yes, cat /var/log/Xorg.0.log | nc termbin.com 9999 and post the URL here. Then we can have a look at your Xorg log.
 
I would run `truss` on the bash process. Xorg can be a bit uncontrollable, but bash should shut up if it is just an interactive shell.

I suspect that this bash process is something trying to setup something about your X11 session? Try locating the bash process in `ps -alx`.
The bash script is dwmbar :
Code:
[don ~/.config/suckless/dwmscripts]$ cat dwmbar
#! /usr/local/bin/bash

while true; do

    TIME=$(/home/don/.config/suckless/dwmscripts/dwmclock)
    xsetroot -name "$TIME"

    sleep 60s

done &

It manages the clock on the dwm bar.
 
Alright, seems like the driver is loaded and working. That's good.
Code:
[  6610.131] (II) intel(0): Allocated new frame buffer 1920x1080 stride 7680, tiled
[  6610.132] (II) UXA(0): Driver registered support for the following operations:
[  6610.133] (II)         solid
[  6610.133] (II)         copy
[  6610.133] (II)         composite (RENDER acceleration)
[  6610.133] (II)         put_image
[  6610.133] (II)         get_image
[  6610.133] (II) intel(0): [DRI2] Setup complete
[  6610.133] (II) intel(0): [DRI2]   DRI driver: crocus
[  6610.133] (II) intel(0): [DRI2]   VDPAU driver: va_gl
[  6610.133] (==) intel(0): Backing store enabled
[  6610.133] (==) intel(0): Silken mouse enabled
[  6610.133] (II) intel(0): Initializing HW Cursor
[  6610.133] (==) intel(0): DPMS enabled
[  6610.133] (==) intel(0): Intel XvMC decoder enabled
[  6610.133] (II) intel(0): Set up textured video
[  6610.133] (II) intel(0): [XvMC] xvmc_vld driver initialized.
[  6610.133] (II) intel(0): DRI2: Enabled
[  6610.133] (II) intel(0): DRI3: Disabled
[  6610.133] (==) intel(0): hotplug detection: "enabled"
 
Oh, that's a nice one. Seems GNU got very creative with their sleep in coreutils:
Code:
Pause for NUMBER seconds.  SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days.  Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number.  Given two or more arguments, pause for the amount of time
specified by the sum of their values.

Of course, all non-portable stuff 🙈
 
sleep 60s will fail and you will set root every several ms or something
sleep 60 (no s) will do
YES!!!!! :)
Problem solved!!!!

last pid: 27226; load averages: 0.11, 0.74, 1.06 up 0+07:15:39 12:46:16
37 processes: 1 running, 36 sleeping
CPU: 12.2% user, 0.3% nice, 19.8% system, 0.1% interrupt, 67.6% idle
Mem: 248M Active, 937M Inact, 33M Laundry, 1462M Wired, 13G Free
ARC: 900M Total, 291M MFU, 535M MRU, 5191K Header, 66M Other
733M Compressed, 1417M Uncompressed, 1.93:1 Ratio
Swap: 2048M Total, 2048M Free

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
17081 don 32 20 0 824M 429M select 0 0:08 0.00% python3.9
24701 don 13 30 10 16G 233M uwait 0 0:06 0.00% QtWebEngineProcess
61185 root 1 20 0 13M 2428K select 2 0:04 0.00% moused
14049 don 4 20 0 213M 103M select 1 0:01 0.00% Xorg
17731 don 10 30 10 8595M 195M uwait 1 0:01 0.00% QtWebEngineProcess
53172 ntpd 1 20 0 21M 5444K select 1 0:01 0.00% ntpd
26496 don 1 20 0 1036M 31M select 3 0:00 0.00% xterm
25438 root 1 20 0 13M 2768K select 1 0:00 0.00% syslogd
97158 root 1 20 0 13M 2560K nanslp 3 0:00 0.00% cron
14419 don 1 20 0 25M 15M select 3 0:00 0.00% dwm
58708 messagebus 1 20 0 14M 3828K select 2 0:00 0.00% dbus-daemon
65960 root 1 20 0 11M 1584K select 1 0:00 0.00% devd
80765 root 16 20 0 88M 10M select 0 0:00 0.00% console-kit-daemon
81059 polkitd 4 20 0 36M 9236K select 3 0:00 0.00% polkitd
12563 root 1 20 0 13M 3288K wait 2 0:00 0.00% login
96002 root 1 45 0 64M 7732K kqread 1 0:00 0.00% cupsd
26618 don 1 20 0 14M 4724K wait 0 0:00 0.00% bash
15561 don 1 20 0 13M 2612K select 2 0:00 0.00% sxhkd
 
Back
Top