[Linux] Major elevation of CPU consumption after update to v31

Users and developers helping users with generic and technical Pale Moon issues on all operating systems.

Moderator: trava90

Forum rules
This board is for technical/general usage questions and troubleshooting for the Pale Moon browser only.
Technical issues and questions not related to the Pale Moon browser should be posted in other boards!
Please keep off-topic and general discussion out of this board, thank you!
nero355
Apollo supporter
Apollo supporter
Posts: 37
Joined: 2018-01-15, 18:20

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by nero355 » 2022-06-11, 12:32

Seen this in the latest Changes Log :
Fixed an important stability and performance issue related to hardware acceleration.
So I thought : "Hey, let's test WITHOUT Hardware Acceleration again!"

Result : Bad idea! :mrgreen:


So...


Let's get some more details into this thread then and try to see if there are any common things for the people having this issue when :
- They DISABLE/TURN OFF Hardware Acceleration.
- Experience high CPU usage when opening a website in just 1 Tab and it quickly rises when they open 1 or 2 tabs more.

And the issue disappears when they ENABLE/TURN ON Hardware Acceleration :D

This is what I use at the moment :

Code: Select all

$ neofetch
            .-/+oossssoo+/-.
        `:+ssssssssssssssssss+:`           ----------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 20.04.4 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: 42406BG ThinkPad T520 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.4.0-117-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 hour, 8 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 2376 (dpkg) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.0.17 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1366x768 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: Plasma 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: KWin 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: plastik 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Breeze [Plasma], Breeze [GTK2/3] 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: breeze [Plasma], breeze [GTK2/3] 
  +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: konsole 
   /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: Intel i5-2450M (4) @ 3.100GHz 
    .ossssssssssssssssssdMMMNysssso.       GPU: Intel 2nd Generation Core Processor Family 
      -+sssssssssssssssssyyyssss+-         Memory: 896MiB / 3813MiB 
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.
My Pale Moon version :

Code: Select all

# dpkg -l | grep pale
ii  palemoon                                      31.1.0-1.gtk2                               amd64        Firefox-based, efficient and easy to use web browser
It's the one from Steve Pusser's Repo for Debian/Ubuntu users as described @ https://www.palemoon.org/contributed-builds.shtml


And just one more thing I would like to let everyone know :

I don't use Linux or Pale Moon because I use old hardware or consider it suitable for low specifications or anything...
The reason I use Pale Moon is because it's the best browser out there for me just like Linux/BSD are the best OS options out there for me! ;)

For example : I have a Desktop PC with 6C/12T and 64 GB of RAM which I use mainly for Gaming (yes, it runs Windows...) and even that PC uses Pale Moon 99,99% of the time! :mrgreen:

0strodamus
Fanatic
Fanatic
Posts: 142
Joined: 2014-11-19, 19:48

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by 0strodamus » 2022-06-12, 01:41

Moonchild wrote:
2022-06-11, 07:16
Basically, you keep splitting a range into two equal halves (see "bisect", bi = two, and sect from intersect) and check if something is fixed or broken, then taking the half that has your interest and doing it again.

This becomes more efficient the more commits you're dealing with, because every doubling of the amount of commits only needs 1 more build.
Thanks for the explanation, I thought you were talking about a git-specific command or technique. :)

My test build of 31.0.0 (staying with the last release so as to not add any other variables from 31.1.0 into the equation) with the Issue #1898 - Make sure that the sanity test stops running if necessary commit shows some promising results. It resolved the issue of high CPU usage when idle with no tabs open which was very nice.

The only anomaly I've noticed so far is that when I navigate to this forum page, the browser uses a steady 34-40% CPU until I navigate away or close the tab. With my 29.4.6 build CPU use is at 0% once that page finishes loading. I haven't spent much time testing other sites/pages, but the ones that I have all idle at 0% CPU once the pages load. I don't know what is triggering the elevated CPU on that specific forum page.

If I'm not mistaken, the Issue #1898 commit made it into 31.1.0. Are the other affected users that posted in this thread still having elevated CPU issues with 31.1.0?

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-12, 08:12

0strodamus wrote:
2022-06-12, 01:41
If I'm not mistaken, the Issue #1898 commit made it into 31.1.0.
It did, hence the line in the release notes.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
mr tribute
Lunatic
Lunatic
Posts: 332
Joined: 2016-03-19, 23:24

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by mr tribute » 2022-06-12, 22:24

0strodamus wrote:
2022-06-12, 01:41
The only anomaly I've noticed so far is that when I navigate to this forum page, the browser uses a steady 34-40% CPU until I navigate away or close the tab.
With my 29.4.6 build CPU use is at 0% once that page finishes loading.
...
Are the other affected users that posted in this thread still having elevated CPU issues with 31.1.0?
For the specific page above Brave uses 0 %. Pale Moon 31.1.0 uses about 12 % with a brand new profile. This on a quad core Celeron 10 watt (passive cooling) CPU.

User avatar
scaffold
Moongazer
Moongazer
Posts: 14
Joined: 2022-06-13, 14:28

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by scaffold » 2022-06-13, 15:17

Hello.
I have no problems with mentioned above forum page. 0% utilization.
Generally v31.1 seems quite good, though i had spikes of high CPU usage with previous version. As someone mentioned it was related to some kind of media inserted on page: videos, animated gifs. Now it looks good.
I'm using PM compiled by me on recent Gentoo.

User avatar
mr tribute
Lunatic
Lunatic
Posts: 332
Joined: 2016-03-19, 23:24

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by mr tribute » 2022-06-13, 16:47

scaffold wrote:
2022-06-13, 15:17
Hello.
I have no problems with mentioned above forum page. 0% utilization.
Generally v31.1 seems quite good, though i had spikes of high CPU usage with previous version. As someone mentioned it was related to some kind of media inserted on page: videos, animated gifs. Now it looks good.
I'm using PM compiled by me on recent Gentoo.
It is possible enabling hardware acceleration fixed it for you. However, if Brave can render this page without hardware acceleration then Pale Moon should too without using excessive CPU. I believe this is the same on Windows, but since I don't use Windows I haven't bothered testing. Something relating to page rendering is broken in Pale Moon v31 compared to Pale Moon v29.

Make sure to turn off hardware acceleration (requires restart) and go to this page. Take note of how much CPU resources Pale Moon uses after the page has finished loading.
viewtopic.php?f=3&t=28306&start=20
Make sure hardware acceleration is off
Make sure hardware acceleration is off

User avatar
tommy_2
Hobby Astronomer
Hobby Astronomer
Posts: 15
Joined: 2020-03-29, 22:33

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by tommy_2 » 2022-06-22, 02:38

fwiw I have the same prob this thread is about but not to the extent some are experiencing.

I had been using 29.1.1/gtk2, got 31.1.0/gtk2 after seeing this thread and ran the latter on a fresh profile under a vanilla user account. loading the same pages side by side I could see far more cpu usage from 31.1.0 over 29.1.1 (which for the most part was ~0% most of the time).

but I was anxious to get the update out of the way and since 31.1.0 for me wasn't all that bad I made a fresh profile and permanently switched to it. now that I use it all the time I can see it's an order of magnitude 'noisier' than 29.1.1 ever was.

'top' says cpu usage is ~5 - 10% when it's not doing hardly anything. hw accel has never made anything but a marginal difference at best and I leave it off. if I restart in safe mode it's the same thing although maybe a touch worse, ~8 - 15% most of the time.

0strodamus
Fanatic
Fanatic
Posts: 142
Joined: 2014-11-19, 19:48

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by 0strodamus » 2022-06-26, 23:59

After bisecting the commits between 29.4.6 and 31.0.0 and 12 builds, I was able to resolve the remaining high CPU issue on some webpages by reverse patching the following commits (ie patch -R -Np1 -i ./commit_XXX.patch):

Issue #1053 - Second pass remove android defines and build system stuff.
Issue #1053 - Remove Android systrace, more build system removals.
Issue #1053 - Remove android-ndk from mozconfigure.
Issue #1053 - Remove some Android compiler/runtime bug workarounds.
Issue #1053 - Remove /dom/system/android and dependent modules
Issue #1053 - First pass Android defines and remove Android Annotation
Issue #1053 - Remove Android WebGL/EGL extensions

I also reverted the commits above from 31.1.0 with success in resolving high CPU.

I tried to bisect these commits further, but had build errors every time. So I tried cherry picking changes from all the commits above to revert code that was commented for Android, but would apply to everything AFAICT (for example, the static_cast in dom/bindings/BindingDeclarations.h) without success (built OK, but still high CPU).

I'm out of ideas how to narrow this down any further.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-27, 00:16

So we have one that says it's telemetry removals, and someone else saying it's android removals...
That really doesn't help narrow it down, aside from the effect being potentially a side-effect of (large) code changes resulting in compiled code location differences.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by bSun0000 » 2022-06-27, 05:15

I'm not an expert but another pair of eyes is always good. So.. this is i manage to find, some suspicious (to me) places in this patches:


From this post with Android removals:
viewtopic.php?f=3&t=28306&start=40#p229726

Issue #1053 - Second pass remove android defines and build system stuff.

LINE 22 in ipc/chromium/src/base/condition_variable_posix.cc:

!(defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
->
if NOT defined(OS_ANDROID) AND NOT defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
was transformed into
if defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)

From "if not" to "if yes".. This is clearly an error, "!" is missing.


Issue #1053 - Remove android-ndk from mozconfigure.

LINE 45 in build/moz.configure/compilers-util.configure:

extra_toolchain_flags and extra_flags was removed. Is this reasonable? Yes google points to android but does this extra flags actually applies only to android systems?


Issue #1053 - Remove /dom/system/android and dependent modules

LINE 879 in build/moz.configure/toolchain.configure:

if c_compiler.type == 'clang' and target.os == 'Android':
replaced with
if c_compiler.type == 'clang':

Is this correct? "and" is not "or".. this check is for a "clang on android", not just for a clang alone.


Issue #1053 - First pass Android defines and remove Android Annotation

LINE 2617 in old-configure.in:

if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
replaced with
if test "$CPU_ARCH" = "arm"; then

Also look suspicious. This is "arm AND Android" check, not just arm. Or not? I don't actually know how this "-o" switch works.


From this post with Telemetry removal:
viewtopic.php?f=3&t=28306&start=20#p228932


Issue #21 - Remove Telemetry plumbing and fix build.

LINE 2237 in dom/plugins/ipc/PluginInstanceParent.cpp:

RecordDrawingModel() all calls to it was removed. This code changes mLastRecordedDrawingModel variable that declared with this comment:

PluginInstanceParent.h

// Since plugins may request different drawing models to find a compatible
// one, we only record the drawing model after a SetWindow call and if the
// drawing model has changed.
int mLastRecordedDrawingModel;

This does NOT look like a part of the telemetry or just *only* a telemetry. Maybe this should be restored?

Calls to RecordDrawingModel was removed from SetCurrentImage, RecvShow, NPP_SetWindow.


LINE 409 in netwerk/cache2/CacheEntry.cpp:

if (directLoad) {
// mLoadStart will be used to calculate telemetry of life-time of this entry.
// Low resulution is then enough.
mLoadStart = TimeStamp::NowLoRes();
mPinningKnown = true;
} else {
mLoadStart = TimeStamp::Now();
}

if directLoad - mLoadStart will be used to calculate telemetry but why call to the
mLoadStart = TimeStamp::Now(); from else branch was also removed?

Does mLoadStart actually required for a telemetry only?


LINE 479 in xpcom/threads/BackgroundHangMonitor.cpp

func BackgroundHangMonitor::DisableOnBeta
return value changed from false to true. For no visible reason.

Also everything related to ThreadStackHelper was removed, including the xpcom/threads/ThreadStackHelper.cpp \h
+xpcom/threads/moz.build: 'ThreadStackHelper.cpp',

IDK about that.. this code looks important.


Issue #21 - Remove use counters telemetry

This entire patch maybe should be reverted as its related to the images (and previous reports about lags with GIFs)
In case it do something more than just collecting telemetry


Issue #21 - Remove panning/tab animation performance measurements

LINE 1032 in palemoon/base/content/tabbrowser.xml

if (!aForceUpdate) {
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.beginTabSwitch();
}

This code removed for no visible reason.


Issue #21 - Remove Telemetry accumulation/structures from toolkit js

LINE 290 in toolkit/components/thumbnails/BackgroundPageThumbs.jsm

removed:
if (capture.doneReason != TEL_CAPTURE_DONE_OK) {
Services.obs.notifyObservers(null, "page-thumbnail:error", capture.url);
}

So.. why do we DON'T want to notify observers with page-thumbnail:error?


Issue #21 - Change MappedAttrParser to store its nsIPrincipal instead of nsSVGElement

Related to Use counters?

Also replacement of *this* to NodePrincipal() in calls to mappedAttrParser look weird to me.

User avatar
jobbautista9
Keeps coming back
Keeps coming back
Posts: 782
Joined: 2020-11-03, 06:47
Location: Philippines
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by jobbautista9 » 2022-06-27, 05:23

bSun0000 wrote:
2022-06-27, 05:15
Issue #1053 - First pass Android defines and remove Android Annotation

LINE 2617 in old-configure.in:

if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then
replaced with
if test "$CPU_ARCH" = "arm"; then

Also look suspicious. This is "arm AND Android" check, not just arm. Or not? I don't actually know how this "-o" switch works.
No, it's an OR, according to test(1)'s man page. AND would be "-a".
Image

merry mimas

XUL add-ons developer. You can find a list of add-ons I manage at http://rw.rs/~job/software.html.

Mima avatar by 絵虎. Pixiv post: https://www.pixiv.net/en/artworks/15431817

Image

0strodamus
Fanatic
Fanatic
Posts: 142
Joined: 2014-11-19, 19:48

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by 0strodamus » 2022-06-27, 05:34

Moonchild wrote:
2022-06-27, 00:16
So we have one that says it's telemetry removals, and someone else saying it's android removals...
Huh? Both of those batch commits had regressions and both were reported here by me, not someone else. The telemetry removal regression was causing high CPU at all times. That was resolved by a later commit made by FranklinDM (Issue #1898) which I reported earlier in this thread. The android removal regression is causing high CPU on random webpages such as the one here on this forum which I provided as an example in an earlier post.
Moonchild wrote:
2022-06-27, 00:16
That really doesn't help narrow it down, aside from the effect being potentially a side-effect of (large) code changes resulting in compiled code location differences.
It's disappointing to know that spending the last two weeks bisecting commits, compiling, and testing as requested earlier somehow doesn't narrow anything down. There were a hell of a lot more commits between 29 and 30 than these. Maybe it's just me, but I don't understand how this doesn't help narrow it down. As I said before, I would have continued to bisect further, but every time I tried the build failed.

If nothing else, I hope my findings will help another Linux user suffering from this regression to know what to revert to build something that works without the random CPU issues. Perhaps the best we Linux end-users with this issue can hope for is like Issue #1898 which was supposed to resolve a Windows issue, whatever is affecting us will also be noticed affecting the Windows build in some way and get a similar fix. ;)

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-27, 06:40

0strodamus wrote:
2022-06-27, 05:34
Huh? Both of those batch commits had regressions and both were reported here by me, not someone else.
My apologies. I was just confused that there were two seemingly different reports here for the same thing. I shouldn't be doing forum stuff on 4 hours of sleep and with a cooked brain >.<
0strodamus wrote:
2022-06-27, 05:34
It's disappointing to know that spending the last two weeks bisecting commits, compiling, and testing as requested earlier somehow doesn't narrow anything down.
Well it certainly helps pinpoint another issue, as in a different set of large code changes, but in itself didn't help - I was assuming that FranklinDM's change didn't solve -this- issue (as in the overall issue this topic is about), that it still existed, and that we now had a broader, not a narrower, set of regressing changes by pointing to a different set of sweeping changes to the code base.

That said, with your explanation here and bSun's help I think we have a few points to look at and some obvious errors to address that I made in the removal.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-27, 07:47

bSun0000 wrote:
2022-06-27, 05:15
I'm not an expert but another pair of eyes is always good.
I appreciate your help! :thumbup:

LINE 22 in ipc/chromium/src/base/condition_variable_posix.cc:

Obvious mistake yes, Nice catch. It was also missed with a follow-up removing the resulting extra parenthesis what happened there.
Since the entire original statement is always true when not on Android (it does get slightly confusing with double negatives there), the second part of the check should simply be removed. I think this may actually have been the major issue here. Especially with how this is posix-specific and doesn't affect Windows code.
!(defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
-> !(false && something) -> !(false) -> true
#if true -> always happens -> remove the conditional.

LINE 45 in build/moz.configure/compilers-util.configure:
extra_toolchain_flags and extra_flags was removed. Is this reasonable? Yes google points to android but does this extra flags actually applies only to android systems?
This is reasonable, AFAICS.
Only androind-ndk.configure defined extra_toolchain_flags and extra_flags. With that gone, there's no need to keep the redundant logic in place.

Issue #1053 - Remove /dom/system/android and dependent modules
LINE 879 in build/moz.configure/toolchain.configure:

This was already corrected:
def libcxx_inline_visibility(c_compiler, target):
# FIXME: Vestigial conditional left over from Android, please remove.
if False:
return ''
LINE 2617 in old-configure.in:
if test "$OS_TARGET" = "Android" -o "$CPU_ARCH" = "arm"; then

as pointed out, -o means OR

Telemetry removal:
Issue #21 - Remove Telemetry plumbing and fix build.

LINE 2237 in dom/plugins/ipc/PluginInstanceParent.cpp:
RecordDrawingModel() all calls to it was removed. This code changes mLastRecordedDrawingModel variable that declared with this comment:
I'm pretty sure I walked the calls to find that it was only used by telemetry, but I'll investigate.

LINE 409 in netwerk/cache2/CacheEntry.cpp:
Does mLoadStart actually required for a telemetry only?
Yes.
In fact I missed removing it from OldWrappers, so I'll clean that up :-)

LINE 479 in xpcom/threads/BackgroundHangMonitor.cpp
return value changed from false to true. For no visible reason.
We never want to trigger this, even if for some reason a build is considered "beta".
I didn't check the callsites where this function is called at the time. It's redundant and can be removed entirely at this point, but that's code cleanup that can be done without priority.
Also everything related to ThreadStackHelper was removed
It may look important but ultimately only used to get thread stack information for telemetry/crash reporting. We don't have a crash reporter and this part of the plumbing could be removed without telemetry being there anymore.

Issue #21 - Remove use counters telemetry
This entire patch maybe should be reverted as its related to the images (and previous reports about lags with GIFs)
In case it do something more than just collecting telemetry
I think this removal looked sane as it reverts a Chromium use counter system that was introduced for no apparent other reason than telemetry/stats gathering.
@FranklinDM might want to look at this and evaluate.


LINE 1032 in palemoon/base/content/tabbrowser.xml
if (!aForceUpdate) {
window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils)
.beginTabSwitch();
}
This code removed for no visible reason.
"beginTabSwitch" is no longer a thing; it was a telemetry-only method. So there's no point in keeping a call to it (that would just error out anyway)

Issue #21 - Remove Telemetry accumulation/structures from toolkit js

LINE 290 in toolkit/components/thumbnails/BackgroundPageThumbs.jsm
So.. why do we DON'T want to notify observers with page-thumbnail:error?
Because what used to be the telemetry reason check will then always fail (mDoneReason is no longer a thing) and all thumbnails will be considered failed (since the observer will then throw and the capture promise will reject). There may be some redundant plumbing here with the observers for :creat and :error we don't actually need any more.
But please do let me know if I got this wrong and if there's an actual error here, with details.

Issue #21 - Change MappedAttrParser to store its nsIPrincipal instead of nsSVGElement
Related to Use counters?
Also replacement of *this* to NodePrincipal() in calls to mappedAttrParser look weird to me.
Pretty sure this is OK, it reverts part of bug #968923 since this was only modified to accommodate use counters (see commit message).
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-27, 08:10

0strodamus wrote:
2022-06-27, 05:34
Perhaps the best we Linux end-users with this issue can hope for is like Issue #1898 which was supposed to resolve a Windows issue, whatever is affecting us will also be noticed affecting the Windows build in some way and get a similar fix. ;)
You underestimate how important Linux users are to us ;-)

The problem with this is that it's intermittent/hard to pinpoint and Linux only (which I am not using as a daily driver and likely won't be using as a daily driver for quite some time to come, if ever), so it's not something I can personally work on with direct feedback.
It's not because I don't want to, but because I'm simply limited in what's reasonable for my workflow.

That being said: try https://repo.palemoon.org/MoonchildProd ... 7af389b574 and let me know if this solves the issue for you.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
FranklinDM
Add-ons Team
Add-ons Team
Posts: 575
Joined: 2017-01-14, 02:40
Location: Philippines
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by FranklinDM » 2022-06-27, 09:14

bSun0000 wrote:
2022-06-27, 05:15
Issue #21 - Remove use counters telemetry

This entire patch maybe should be reverted as its related to the images (and previous reports about lags with GIFs)
In case it do something more than just collecting telemetry

Issue #21 - Change MappedAttrParser to store its nsIPrincipal instead of nsSVGElement

Related to Use counters?

Also replacement of *this* to NodePrincipal() in calls to mappedAttrParser look weird to me.
  • The removal of use counters does not touch any code related to the processing of GIFs. Reports about GIF lag depend on the site and might be caused by this or fixed by this change. As stated in the linked bug #968923 in those commits, which was used as the basis for the reversions made here (except for parts that particularly deal with nsDocument, which are now used in other parts of the platform), its sole purpose is to gather telemetry based on how often a specific CSS property or feature is used by pages loaded by the user.
  • MappedAttrParser was modified to use an nsSVGElement for the additional information it holds that is necessary for use counters. Since use counters was already removed in the commit preceding that, it doesn't make sense anymore for it to use an nsSVGElement when it only needs the principal. This was the patch that made that change and was reverted.

Simon P
Newbie
Newbie
Posts: 4
Joined: 2018-03-31, 11:31

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Simon P » 2022-06-27, 11:39

Moonchild wrote:
2022-06-27, 08:10
... try https://repo.palemoon.org/MoonchildProd ... 7af389b574 and let me know if this solves the issue for you.
When I read your post, I was testing a build using bSun0000's fix to those lines of code. I've now rebuilt using your version. In both builds, the excessive CPU use without h/w acceleration is fixed.

User avatar
bSun0000
Apollo supporter
Apollo supporter
Posts: 36
Joined: 2022-03-22, 23:32

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by bSun0000 » 2022-06-27, 13:39

Simon P wrote:
2022-06-27, 11:39
Moonchild wrote:
2022-06-27, 08:10
... try https://repo.palemoon.org/MoonchildProd ... 7af389b574 and let me know if this solves the issue for you.
When I read your post, I was testing a build using bSun0000's fix to those lines of code. I've now rebuilt using your version. In both builds, the excessive CPU use without h/w acceleration is fixed.
Awesome. Thanks for a quick confirmation.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35473
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by Moonchild » 2022-06-27, 14:01

Simon P wrote:
2022-06-27, 11:39
Moonchild wrote:
2022-06-27, 08:10
... try https://repo.palemoon.org/MoonchildProd ... 7af389b574 and let me know if this solves the issue for you.
When I read your post, I was testing a build using bSun0000's fix to those lines of code. I've now rebuilt using your version. In both builds, the excessive CPU use without h/w acceleration is fixed.
Fantastic! Thanks for confirming :) :thumbup:
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1498
Joined: 2018-10-28, 19:56
Location: Georgia

Re: [Linux] Major elevation of CPU consumption after update to v31

Unread post by athenian200 » 2022-06-27, 18:23

bSun0000 wrote:
2022-06-27, 05:15
LINE 22 in ipc/chromium/src/base/condition_variable_posix.cc:

!(defined(OS_ANDROID) && defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC))
->
if NOT defined(OS_ANDROID) AND NOT defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)
was transformed into
if defined(HAVE_PTHREAD_COND_TIMEDWAIT_MONOTONIC)

From "if not" to "if yes".. This is clearly an error, "!" is missing.
That code was the issue? It's funny, that code actually caused a compile error when it was first done. I just "fixed" it in autopilot mode and did the simplest thing to make it compile because I was in a rush. Now that I read what was there before, I see that the last parenthesis was left there for a reason.

It looks like the fallback code when that conditional is false exists to address a deficiency in the Android 5.0 and macOS libc, namely the fact that for whatever reason, pthread_condattr_setclock isn't supported on either platform, so it just calls pthread_cond_init with a null. That doesn't break other platforms, but it does mean every platform other than Windows was essentially using the macOS version of the code that is worse than what we use for every other platform. HAVE_PTHREAD_TIMEDWAIT_MONOTONIC was never going to evaluate to true on any supported platform, because it was only ever supported on old versions of Android as far as I know.

In fairness to Moonchild, there is a good chance he would have noticed that if I had not touched the code. But because I ran in and made it compile in a hurry, neither of us ever revisited the original code. Though it's also fairly likely that closing off the codebase and not having more people looking at what we were doing was the biggest reason it didn't get noticed earlier...

Note to self... sometimes a stray ending parenthesis can also mean that its counterpart should be present but isn't, and doesn't always mean it's fine to remove the leftover one. So yeah, my apologies to Linux users in particular.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

Locked