Please note: we have made some forum changes regarding user data and privacy.
More info here: Planned downtime for the forum and changes.

Palemoon only using one core/hyperthread

Support and discussions for the x86/x64 Linux version of Pale Moon.

Moderators: trava90, satrow

Post Reply
User avatar
gs1956
New to the forum
New to the forum
Posts: 2
Joined: 2019-08-19, 17:54

Palemoon only using one core/hyperthread

Post by gs1956 » 2019-08-19, 19:29

I'm using palemoon 28.6.1+repack-2 from Steven Pusser's repository "http://download.opensuse.org/repositori ... untu_18.04 Packages"

I'm on Ubuntu 18.04.3 LTS, kernel is "5.0.0-25-generic".

Some pages (I've only hit one so far, it's the browser fingerprint tester at https://panopticlick.eff.org/) cause high utilization in Palemoon. It maxes out 100% on one "CPU" and the browser becomes very slow to respond to anything, while everything else on the mcahine seems fine.

'top' shows me that all that utilization is confined to one hyperthread - I've git a 6 core system, in top that shows as 12 "CPUs", and all the utilization is on one of those "CPUs".

Is there any way to spread the load?

The system is a Powerspec, using an Asrock H310M-HDV/M.2 motherboard. 16GB of RAM.

From /proc/cpuinfo:

Code: Select all

processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 158
model name	: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
stepping	: 10
microcode	: 0xb4
cpu MHz		: 4309.703
cache size	: 12288 KB
physical id	: 0
siblings	: 12
core id		: 0
cpu cores	: 6
apicid		: 0
initial apicid	: 0
fpu		: yes
fpu_exception	: yes
cpuid level	: 22
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht 
tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc
_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcn
t tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single pti ssbd ibrs ibpb stibp tp
r_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflush
opt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
bugs		: cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips	: 6384.00
clflush size	: 64
cache_alignment	: 64
address sizes	: 39 bits physical, 48 bits virtual
power management:

User avatar
gs1956
New to the forum
New to the forum
Posts: 2
Joined: 2019-08-19, 17:54

Re: Palemoon only using one core/hyperthread

Post by gs1956 » 2019-08-20, 05:08

*sigh*

It doesn't do it in Safe Mode.

I have a number of addons installed, mainly to prevent tracking and fingerprinting. I guess that's where I need to look.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24906
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: Palemoon only using one core/hyperthread

Post by Moonchild » 2019-08-20, 08:11

Since panopticlick is specifically designed to test fingerprinting techniques, it sounds like one of your anti-fingerprinting extensions doesn't work properly and causes high CPU as a result. It may even be because you have multiple installed that try to prevent the same thing, causing a race condition.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
moonbat
Keeps coming back
Keeps coming back
Posts: 764
Joined: 2015-12-09, 15:45
Location: Australia

Re: Palemoon only using one core/hyperthread

Post by moonbat » 2019-08-20, 14:05

FWIW, I asked about a similar problem recently, and the culprit was the CanvasBlocker extension.
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Linux Mint 19.2 Xfce x64 on HP i5 laptop with 4 GB RAM, always latest versions of PM & Basilisk unless specified.

User avatar
stevepusser
Astronaut
Astronaut
Posts: 532
Joined: 2015-08-01, 18:33
Location: California

Re: Palemoon only using one core/hyperthread

Post by stevepusser » 2019-08-23, 23:24

I tested the MX Linux Palemoon build, which is very similar to the OBS build, and compared it to Firefox's performance on a similar i7-8750H laptop CPU with a 5.2-12 Liquorix kernel.

I couldn't see any difference between the two. The CPU stayed at its lowest speed and the low CPU use was spread out among the 12 threads that the CPU uses for both browsers. I don't think either browser is going to use multiple threads for a task like that.

User avatar
mabloom
Moongazer
Moongazer
Posts: 10
Joined: 2019-08-25, 11:08

Re: Palemoon only using one core/hyperthread

Post by mabloom » 2019-09-03, 01:52

I've run into this behavior in other browsers, and in lieu of a fix, I've found some (admittedly klugy) workarounds with them. When you are hitting 100% CPU, you could have a situation in which some of the library code (I dare not suggest the browser itself might ever do this ) is spinning it's wheels making large numbers of unnecessary system calls. With some of the other browsers, one example of that kind of behavior can arise when the code returns from non-blocking polls with no descriptors reported as being ready for i/o and then proceeds to issue non-blocking i/o calls on descriptors that the poll() had not reported as being available for i/o, never seriously doing any blocking that could have given something else a chance (good programming practice could normally use one approach or the other, but not both), repeated ad infinitum, and only rarely doing any actual i/o. There are tricks you can do with LD_PRELOAD and your own modified copies of syscalls (especially poll() or i/o calls on descriptors set not to block ). You may find that you want to introduce a limited amount of short-lived blocking using the clock_nanosleep() syscall. For this to work and depending upon how you go about it, you will probably want to introduce state into your own copies of the calls and have some means to keep track of it.

It may sound counter-intuitive, but a less invasive approach approach that can still have a certain amount of success is to INCREASE the nice value of the processes to reduce their scheduling relative to other processes. THis does not impact execution of the instructions that are actually doing useful work, but does reduce the amount of time that the processes are wasting time doing nothing useful.

To check for a large number of wasted syscalls taking place, use the Linux strace command.
The simplest form is strace -p pid
That will give a lot of output on a runaway process. You can use "-e" options to limit the set(s) of calls displayed. The strace man page will give you further details. I recall reading that there is equivalent functionality available for windows, but I don't remember the details.

On many modern Linux systems, strace functionality may be crippled for non-root users. You can get traditional functionality in such cases by issuing the command "echo 0 > /proc/sys/kernel/yama/ptrace_scope ". Without intervention, the effect of this will only last until the next reboot.

One of the uglier (although fairly innocuous) things you may see when tracing some browsers might be threads that repeatedly issue the gettid() syscall to learn their own thread id, which they apparently never bother to store.

User avatar
mabloom
Moongazer
Moongazer
Posts: 10
Joined: 2019-08-25, 11:08

Re: Palemoon only using one core/hyperthread

Post by mabloom » 2019-09-03, 22:27

I just wanted to add to my post at https://forum.palemoon.org/viewtopic.php?f=37&t=22770&p=173978#p173978 that when creating a private system call version, one would access the underlying functionality using the syscall() library function (see man -s 2 syscall). So in your own version of poll(), the hard part might be done by something like :

num_ready = (int) syscall(SYS_poll, (ulong) &pollfds, nfds, timeout); /* Invoke the real poll() */

To slightly elaborate on the previous post, one would create a private library (compiling for position independent code, and linking as a library) and then run the program using LD_PRELOAD (see man ld.so) to make your own system call wrapper(s) be used in place of the C library's wrapper(s) for the same underlying call(s).
N.B. You should be careful not to put anything in your source that would cause a run-time linking conflict (which shouldn't be a problem, as long as you don't start to go overboard and try doing things beyond the scope of solving your immediate problem).

(I wanted to add this to the original post, rather than creating a new one, but when I tried to edit it, I learned of a time limit, for editing or deleting posts, that it appears I'd exceeded. In the event the display of this post occurs at a distance from my original post, clicking on the above link should bring you directly to it.)

User avatar
mabloom
Moongazer
Moongazer
Posts: 10
Joined: 2019-08-25, 11:08

Re: Palemoon only using one core/hyperthread

Post by mabloom » 2019-09-04, 15:20

mabloom wrote:
2019-09-03, 01:52
It may sound counter-intuitive, but a less invasive approach approach that can still have a certain amount of success is to INCREASE the nice value of the processes to reduce their scheduling relative to other processes. THis does not impact execution of the instructions that are actually doing useful work, but does reduce the amount of time that the processes are wasting time doing nothing useful.
I'd like to add that I've found that approach to be especially useful with Chrome family browsers (Chromium, slimjet, etc), as they can be observed to be particularly careless with the manner in which they (or third-party libraries that they may have less control over than their own code) make use of non-blocking syscalls. Experience with slimjet just now prompted me to return to point that out.

After opening a number of tabs, the browser began to slow a bit. Then a bit more. But when I went to CVS' web site and began transfering multiple CVS coupons to my CVS card, it slowed to a literally unusable crawl. uptime was reporting a load average of nearly 7! A brief examination, first using top and then strace confirmed that this was a circumstance for which the "counter-intuitive" measure suggested in the portion of my post quoted above would be appropriate.
I issued the shell command:
$ renice 8 $(pgrep slimjet) # Change the 'niceness' of all slimjet processes
after which the load average immediately began to drop, and continued doing so until it reached it's present value of 0.93

I wouldn't expect such a pronounced drop in load average to occur when using this approach with Pale Moon, but as long as any browser makes use of libraries that it's own developers haven't written, the kind of behavior described in my original post is more than possible. If seeing slowdowns or hangs that the browser's own code shouldn't account for, there is a good chance that at least either some of "too many cooks" are improperly using non-blocking calls (in the manner described in my original post) or different libraries are internally using different paradigms for non-blocking i/o that can't or don't coordinate with each other, leaving gaping wide holes for massive amounts of time being wasted doing nothing useful in between smaller periods of useful work. As previously stated, the strace program can make it easy to see when that is happening.

It is also possible that unexplained slowdowns could involve similarly massively unnecessary repetition ofsome other kinds of syscalls not involving non-blocking i/o (particularly in multi-threaded code). strace could help in such cases, as well, to clarify the nature of the problem.

One final (hopefully ;) ) note: Although strace itself is present only on Linux, Unix, and some other Posix-based systems, there are several programs available for Windows that provide equivalent functionality, including at least one from Microsoft.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24906
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
Contact:

Re: Palemoon only using one core/hyperthread

Post by Moonchild » 2019-09-04, 16:00

mabloom: maybe you should write a blog. What you're posting in the various topics here is often veering off on tangents or potential (but often very unlikely) causes and scenarios, and only barely related to questions asked, often discoursing about an extremely specific thing in detail that isn't really helping people with support questions. Although interesting reading material from an academic point of view, it's not really relevant.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

User avatar
mabloom
Moongazer
Moongazer
Posts: 10
Joined: 2019-08-25, 11:08

Re: Palemoon only using one core/hyperthread

Post by mabloom » 2019-09-06, 16:38

stevepusser wrote:
2019-08-23, 23:24
I tested the MX Linux Palemoon build, which is very similar to the OBS build, and compared it to Firefox's performance on a similar i7-8750H laptop CPU with a 5.2-12 Liquorix kernel.

I couldn't see any difference between the two. The CPU stayed at its lowest speed and the low CPU use was spread out among the 12 threads that the CPU uses for both browsers. I don't think either browser is going to use multiple threads for a task like that.
Perhaps not "hyperthreads", Steve, but Pale Moon is certainly using scheduling threads (what are sometimes called "lightweight processes"). Right now, the only thing I have running in PM is the Pale Moon forum, with no extensions, and the command ps -eLf|grep pale reports 41 threads (the NLWP column), which are necessarily competing with each other for time slices (after all, if they weren't intended to run concurrently, why use threads in the first place?)

Code: Select all

mab@tablet ~/tracepalehang/cpu-usage $ ps -eLf|egrep pale'|LWP'
UID        PID  PPID   LWP  C NLWP STIME TTY          TIME CMD
mab      28269  6454 28269  0    1 06:59 pts/1    00:00:00 more ../palemoontrace2
mab      30215  1982 30215  9   41 07:50 ?        00:08:30 palemoon
mab      30215  1982 30219  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30221  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30222  0   41 07:50 ?        00:00:01 palemoon
mab      30215  1982 30223  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30224  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30225  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30226  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30227  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30228  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30229  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30230  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30231  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30232  0   41 07:50 ?        00:00:02 palemoon
mab      30215  1982 30234  0   41 07:50 ?        00:00:12 palemoon
mab      30215  1982 30235  0   41 07:50 ?        00:00:31 palemoon
mab      30215  1982 30236  0   41 07:50 ?        00:00:01 palemoon
mab      30215  1982 30237  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30238  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30239  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30240  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30241  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30242  0   41 07:50 ?        00:00:06 palemoon
mab      30215  1982 30245  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30246  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30247  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30248  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30249  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30250  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30251  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30252  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30253  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30254  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30255  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30256  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30257  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30260  0   41 07:50 ?        00:00:00 palemoon
mab      30215  1982 30271  0   41 07:51 ?        00:00:05 palemoon
mab      30215  1982 30800  0   41 08:21 ?        00:00:00 palemoon
mab      30215  1982 30802  0   41 08:22 ?        00:00:00 palemoon
mab      30215  1982 30803  0   41 08:22 ?        00:00:00 palemoon
mab      30805  6454 30805  0    1 08:22 pts/1    00:00:00 grep -E --color=auto pale|LWP
[/b][/size]

User avatar
Mike_Walsh
Hobby Astronomer
Hobby Astronomer
Posts: 19
Joined: 2019-09-14, 20:09
Location: King's Lynn, UK

Re: Palemoon only using one core/hyperthread

Post by Mike_Walsh » 2019-09-14, 22:31

Been running Palemoon in 'Puppy' Linux for a couple of years now. (I'm actually a long-term Chrome user, but where that browser runs fine on my old Compaq desktop - which has the necessary 'grunt' - my ancient Dell laptop (2002 vintage) - does not, being saddled with a Pentium 4. So 'Palemoon' fits the bill nicely there....)

The Compaq has an elderly Athlon 64 X2 dual-core. Palemoon always uses both cores, and maximum usage is only ever around the 35-40% mark.....when viewing YouTube. Other times, never much more than 20-25%, max.


Mike. :)

Post Reply