Re: Kernel is using a lot of CPU (was: Re: test)

From: Nikos Vassiliadis <nvass_at_gmx.com>
Date: Mon, 30 Jan 2023 13:37:59 UTC

> Sent: Monday, January 30, 2023 at 3:27 PM
> From: "Mike Karels" <mike@karels.net>
> To: "Nikos Vassiliadis" <nvass@gmx.com>
> Cc: freebsd-stable@freebsd.org
> Subject: Re: Kernel is using a lot of CPU (was: Re: test)
>
> On 30 Jan 2023, at 5:03, Nikos Vassiliadis wrote:
> 
> >> Hi,
> >>
> >> I just rebooted a system of mine and it seems that the kernel is constantly doing something. How could I debug this?
> >> I am thinking of rebooting it tonight
> >>
> >> root@aurora:~ # top -S -b
> >> last pid:  2196;  load averages:  1.00,  1.00,  1.00  up 0+01:54:34    12:41:35
> >> 72 processes:  2 running, 69 sleeping, 1 waiting
> >> CPU:  0.0% user,  0.0% nice, 24.6% system,  0.0% interrupt, 75.3% idle
> >> Mem: 46M Active, 171M Inact, 1429M Wired, 14G Free
> >> ARC: 919M Total, 354M MFU, 487M MRU, 6912K Anon, 8726K Header, 63M Other
> >>      234M Compressed, 610M Uncompressed, 2.60:1 Ratio
> >> Swap: 16G Total, 16G Free
> >>
> >>   PID USERNAME    THR PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
> >>    11 root          4 155 ki31     0B    64K RUN      0 345:06 314.31% idle
> >>     0 root         49 -16    -     0B   784K swapin   1 112:27  99.85% kernel
> >>    30 root        319 -16    -     0B  5120K spa->s   3   0:06   0.00% zpool-aurora-os
> >>  1157 root          1  20    0   176M   150M select   2   0:05   0.00% smbd
> >>  1154 root          1  20    0   175M   150M select   2   0:05   0.00% smbd
> >>
> >> This is a 12.4-RELEASE system.
> >>
> >> Thanks for any ideas,
> >> Nikos
> >>
> >>
> >>
> >
> > Sending the email again with the correct subject
> 
> You could add -H to the top command, which will show kernel threads within
> the kernel process.
> 
> 		Mike
> 
> 

Thanks Mike,

A kernel thread named acpi_task_n seems to be the source of the problem. This system is rather old and was ok running 12.2-REL. Maybe some update to the ACPI code?. What could I try next?  

nik@aurora:~ % top -H -S -b
last pid:  2529;  load averages:  1.03,  1.03,  1.00  up 0+04:43:45    15:30:46
840 threads:   6 running, 820 sleeping, 14 waiting
CPU:  0.0% user,  0.0% nice, 24.6% system,  0.0% interrupt, 75.3% idle
Mem: 29M Active, 192M Inact, 1717M Wired, 13G Free
ARC: 1182M Total, 475M MFU, 608M MRU, 7744K Anon, 12M Header, 79M Other
     312M Compressed, 782M Uncompressed, 2.51:1 Ratio
Swap: 16G Total, 16G Free

  PID USERNAME    PRI NICE   SIZE    RES STATE    C   TIME    WCPU COMMAND
   11 root        155 ki31     0B    64K CPU3     3 272:53 100.00% idle{idle: cpu3}
   11 root        155 ki31     0B    64K RUN      0 260:10  81.15% idle{idle: cpu0}
    0 root          8    -     0B   784K -        3 141:30  76.76% kernel{acpi_task_2}
   11 root        155 ki31     0B    64K CPU1     1 212:51  74.66% idle{idle: cpu1}
   11 root        155 ki31     0B    64K RUN      2 108:52  51.86% idle{idle: cpu2}
    0 root          8    -     0B   784K CPU2     2 116:25  24.27% kernel{acpi_task_0}
 2324 root         20    0   177M   151M select   3   0:03   0.10% smbd{smbd}
    0 root          8    -     0B   784K -        0  21:08   0.00% kernel{acpi_task_1}
    0 root        -16    -     0B   784K swapin   2   0:53   0.00% kernel{swapper}