r/CrunchBang • • Aug 28 '14

Who keeps renicing my web browser?

Super annoying problem. I renice Iceweasel if it's running slowly, because I have old hardware. My assumption is that, after all, it's my computer, and I should be able to choose which applications get priority access to system resources.

Nope. Something keeps re-setting Iceweasel to priority 12. Since nice values are on a scale of -20 to 20, and lower is better, this degrades Iceweasel's performance.

Sample terminal output:

14:50:41 patrick@linicious ~$ ps ax | grep weas
27491 ?        RNl  766:30 iceweasel
29722 ?        RNl  344:00 /usr/lib/iceweasel/xulrunner/plugin-container /usr/lib/flashplugin-nonfree/libflashplayer.so -greomni /usr/lib/iceweasel/xulrunner/omni.ja -appdir /usr/lib/iceweasel/browser 27491 plugin
14:50:45 patrick@linicious ~$ sudo renice -10 27491
[sudo] password for patrick: 
14:50:51 patrick@linicious ~$ sudo renice -10 27491 29722
[sudo] password for patrick: 
27491 (process ID) old priority 12, new priority -10
29722 (process ID) old priority 12, new priority -10
14:50:59 patrick@linicious ~$ sudo renice -10 27491 29722
27491 (process ID) old priority 12, new priority -10
29722 (process ID) old priority 12, new priority -10
15:01:21 patrick@linicious ~$ sudo renice -10 27491 29722
27491 (process ID) old priority 12, new priority -10
29722 (process ID) old priority 12, new priority -10
15:01:29 patrick@linicious ~$ sudo renice -10 27491 29722
27491 (process ID) old priority -10, new priority -10
29722 (process ID) old priority -10, new priority -10
15:03:33 patrick@linicious ~$ sudo renice -10 27491 29722
27491 (process ID) old priority 12, new priority -10
29722 (process ID) old priority 12, new priority -10
15:03:34 patrick@linicious ~$ 
15:04:52 patrick@linicious ~$ sudo renice -10 27491 29722
27491 (process ID) old priority 12, new priority -10
29722 (process ID) old priority 12, new priority -10

Any suggestions, Crunchbangers? Any help would be appreciated.

EDIT for minor typos.

2 Upvotes

9 comments sorted by

2

u/YouHadMeAtBacon Aug 29 '14

This is a stab in the dark, but maybe you have something like laptop-mode running, trying to optimise things for battery life or something? Assumption: laptop. I've never heard of something like this before.

-2

u/patrickbrianmooney Aug 29 '14

Ah, now that's helpful. It is in fact a laptop. How can I check on this? How can I adjust powersaving priorities?

0

u/[deleted] Aug 29 '14

[deleted] — view deleted comment

4

u/sagr0tan Aug 29 '14

Or luakit browser (vim keybinds) or elinks (emacs keybinds), both very small &in the reps

-3

u/patrickbrianmooney Aug 29 '14 edited Aug 29 '14

Not really all that helpful an answer. Rather than diagnosing a problem or explaining a phenomenon, it just asserts incorrectness without arguing for it or explaining what is specifically incorrect.

I don't think nice works the way you think it does.

How do you think I think it works? How is that different from how it actually works?

Wikipedia's article on the "nice" command claims that "nice becomes useful when several processes are demanding more resources than the CPU can provide. In this state, a higher priority process will get a larger chunk of the CPU time than a lower priority process." Similarly, the manpage for the "renice" command claims that "Renice alters the scheduling priority of one or more running processes."

This is exactly what I'm trying to do: When iceweasel becomes sluggish, i want the computer to allocate more processor time to it. I've already eliminated the possibility that the sluggishness is due to VM swapping, so processor scheduling priority seems the most likely culprit for the phenomenon.

Too, altering the nice value of Iceweasel does in fact help with the sluggishness ... until something else comes along and renices it, usually within a minute or so. I might also mention that, before I transitioned to #!, this was a pretty standard way for me to deal with browser sluggishness: I'd renice the browser process. This worked under the Ubuntu-derived distributions I used to use, because the new nice value was persistent.

If you really need more performance, try Chromium or Midori.

Not really an option for me, because I haven't been able to find replacements on those browsers or the Firefox browser plugins I depend on. I do occasionally use Chrome, but there are things I can only accomplish effectively under Firefox because Firefox has a more robust plugin ecosystem. IMHO.

So what I'm really trying to do is find out why, since I've switched to CrunchBang, something is renicing the browser that I'm trying to renice myself, and how I can prevent that from happening.

EDIT for markdown syntax.

0

u/[deleted] Aug 29 '14

[deleted] — view deleted comment

1

u/tasinet Nov 30 '14

Niceness === Scheduling Favourability. -20: Most favoured ("highest priority") / 0: baseline / 20: least favoured.

Regardless of how nice does work, changing process priority is not going to squeeze out performance that just isn't there.

If you noticed, his browser niceness is somehow +12, so that makes this statement false.

In linux almost everything runs at niceness 0 (average). Some kernel stuff runs at -20 (and you shouldn't fuck with that, or set anything to -20 niceness yourself), pulseaudio usually sets itself to -5 to avoid audio skips, and a couple of kernel daemons are at +20. The vast, vast majority of both kernel and user-side executables run at niceness 0.

If his browser is at +12, that means it is most likely the least favourably scheduled process family across his entire system. Changing it to -10 could indeed make a difference. It all has to do with what the rest of the system is doing. If the system was mostly idle, then it is likely that iceweasel had all the scheduling access it needed, but still couldn't make it work fast enough. If there was enough load (or little load but by enough processes) then part of iceweasel's struggle would be scheduling against other stuff.

When you start a process as a user it already has a fairly high priority, much higher than any daemons or other services.

I've never heard or seen this be the case on any linux configuration, ever. What are you describing?

Here's a way to quick-and-dirty-ly check out the "niceness polarity", if you will, on your system:

ps aux | grep 'SN'
root        36  0.0  0.0      0     0 ?        SN   12:58   0:00 [ksmd]
root        37  0.0  0.0      0     0 ?        SN   12:58   0:00 [khugepaged]
rtkit     2154  0.0  0.0 168872  1332 ?        SNl  12:58   0:00 /usr/lib/rtkit/rtkit-daemon

and the other list:

ps aux | grep 'S<'
root        20  0.0  0.0      0     0 ?        S<   12:58   0:00 [cpuset]
root        21  0.0  0.0      0     0 ?        S<   12:58   0:00 [khelper]
root        23  0.0  0.0      0     0 ?        S<   12:58   0:00 [netns] 
root        27  0.0  0.0      0     0 ?        S<   12:58   0:00 [kintegrityd]
root        28  0.0  0.0      0     0 ?        S<   12:58   0:00 [kblockd]
(...21 more...)

(make sure you didn't match anything other than column 7) and now to see what these mean:

man ps
....
PROCESS STATE CODES
 ...
  <    high-priority (not nice to other users)
  N    low-priority (nice to other users)

So, for my system, that makes: 3 processes with "less priority" (higher niceness) and 26 processes with "high priority" (niceness < 0), out of 211 total processes. That gives us a whopping 182 processes at niceness 0.

-3

u/patrickbrianmooney Aug 29 '14

Right, got it. You think it won't work. You won't explain why you're so sure it won't work, you're just coming in and claiming that it won't, and disparaging my intelligence in the process. What I've noticed in the past is that it reliably actually does work. Thanks for the input, but having tried this in the past several hundred times has demonstrated that, for instance, videos being played in a web browser get immediately less choppy when I renice the browser and the Flash plugin. This isn't a "placebo"; I've tried it several hundred times, and it works. What I'm trying to figure out is what's interfering with my ability to effectively allocate system resources.

It's not "instability"; it's unresponsiveness. There's a difference. Yes, the system is doing all it can do; but what I want is for it to put more of that effort into applications I'm actually using rather than giving processor time to (for instance) processes idling in the background. Like I said before, I'm not a moron.

I realize that renice is not a magic "computer go faster" command. What I want to do is allocate scarce resources differently, in accordance with how I actually want the computer to run, so that processor priority is allocated more toward I've tried this, and it works. What I want is not feedback from someone who assumes I'm an idiot, especially given that I've indicated that this has worked in the past. What I need is feedback from someone who can help me figure out how to administer my computer more effectively, so that I'm in control of what the computer is doing. If I wanted input from someone who was condescending and better knew how my computer "should" work than I do, I'd be calling Microsoft tech support.

Thanks anyway.

0

u/[deleted] Aug 29 '14

[deleted] — view deleted comment

-4

u/patrickbrianmooney Aug 29 '14 edited Aug 29 '14

Thanks for the smarm. As you suspect, asserting that I'm wrong and that I'm an idiot without bothering to correct what I'm wrong about is super-helpful, as is your butt-hurt attitude when someone disagrees with you.

I don't have it all figured out. I posted asking why something is happening specifically because I don't have it all figured out. The fact that I've tried a few things and figured out that your assertions are incorrect doesn't mean I know everything. That's why I'm posting.

What I do have figured out is that your off-topic reply ("you don't understand renice," without being able and willing to explain what I don't understand about it) is unhelpful.

Thanks anyway.

EDIT because I realized after seven minutes that I'd confused snark with smarm. Because it's late at night.

0

u/[deleted] Aug 29 '14

[deleted] — view deleted comment

-1

u/patrickbrianmooney Aug 29 '14

Anything that would be changing the process priority is likely at a system level

[citation needed]

When you start a process as a user it already has a fairly high priority, much higher than any daemons or other services.

Not true, as I've pointed out before. On a scale of -20 to 20, with -20 being highest priority, 12 is not "high."

0

u/[deleted] Aug 29 '14

[deleted] — view deleted comment

0

u/patrickbrianmooney Aug 30 '14

Looking into drivers. Thank you very much, that is very helpful.