Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to play games and emerge?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gamers & Players
View previous topic :: View next topic  
Author Message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Sun Jan 24, 2016 11:58 am    Post subject: how to play games and emerge? Reply with quote

I have 8 core 4 GHZ CPU.
I play games, using steam.
I set emerge to use 4 cores and have highest nice value of 20.
Game FPS drops a lot.(any game)
even though game has lowest nice value.(steam as parent process)
why is this happening?

I checked with htop, emerge uses 4 cores and has blue color, so my settings for emerge and steam are correct.
What can I do to avoid low FPS?(and run oth games and emerge at same time)

my sys:
780Ti binary nvidia, 4ghz vishera from AMD(8 core). 32 Gb of ram(1600).

Thank you in advance!
_________________
Just a user.
Back to top
View user's profile Send private message
bstaletic
Apprentice
Apprentice


Joined: 05 Apr 2014
Posts: 249

PostPosted: Sun Jan 24, 2016 12:09 pm    Post subject: Reply with quote

I never played with nice, so can't truly help, but why don't you just postpone emerge and let it work while you're not using you pc?
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Sun Jan 24, 2016 12:16 pm    Post subject: Reply with quote

bstaletic wrote:
I never played with nice, so can't truly help, but why don't you just postpone emerge and let it work while you're not using you pc?

that's an option of course, but it's more of a work around than a solution.
answer woudl be this:
I play game, I set world to update, if something fails, I can hear it(usually i set some sound notificator or something)
i can switch over to thing that failed, fix it, and go back to playing.
So I am more efficient at multitasking that way.
or I can set world to compile, go to sleep, and find in the morning, something failed in first 5 minutes of compilation. And all over again next day...
_________________
Just a user.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54208
Location: 56N 3W

PostPosted: Sun Jan 24, 2016 12:38 pm    Post subject: Reply with quote

dimko,

Three things come to mind,

IO bandwidth
Memory bandwidth
Cache thrashing

nice sets how hard processes fight over the CPU - it says nothing about disc access.
Games and emerge both need disk access, if you don't have SSD, then you have the head movement latency an the drive seeks between the game area and the areas emerge wants.

The game and emerge need to share access to main memory. If emerge is using it, the game cannot.

Cache thrashing in an interesting one. Your CPU has a small amount of memory that runs at the full CPU core speed. Its 100 or so times faster than main memory, when you consider the main memory latency. While you are using 4 cores for a game and 4 cores for emerge, there is no such restriction on the CPU cache RAM. What happens is that one process will push another process out of the cache. This forces the process that was pushed out to fetch thing from much slower main memory, increasing the pressure on the memory bandwidth.
The CPU cache manager keeps the most recently used data in cache.

Its all very well using 4 cores each but how many jobs is emerge allowed to use?
You need to manage the number of running threads.

How do you set emerge to use 4 cores?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Sun Jan 24, 2016 12:57 pm    Post subject: Reply with quote

The solution I use is cgroups. Games are given exclusive access to a lion share of bandwidth, ram and cpu.
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Sun Jan 24, 2016 12:58 pm    Post subject: Reply with quote

NeddySeagoon wrote:
dimko,



nice sets how hard processes fight over the CPU - it says nothing about disc access.
Games and emerge both need disk access, if you don't have SSD, then you have the head movement latency an the drive seeks between the game area and the areas emerge wants.

The game and emerge need to share access to main memory. If emerge is using it, the game cannot.


Its all very well using 4 cores each but how many jobs is emerge allowed to use?
You need to manage the number of running threads.

How do you set emerge to use 4 cores?


Disc access is not the issue with 32 gigs of ram. Once file read - it stays in ram, until ram is ever filled. 32 gigs of ram = never filled.
FPS drops is somewhat constant. So its not 'loading textures from HDD' issue.

How to control access to main memory? Are there any commands for that?(I doubt, was googling for that some time ago)
20 processes run in emerge.(usually 10 or so)
you can set limit of CPU's for program + sub processes, using command 'taskset'.
_________________
Just a user.
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Sun Jan 24, 2016 1:26 pm    Post subject: Reply with quote

Naib wrote:
The solution I use is cgroups. Games are given exclusive access to a lion share of bandwidth, ram and cpu.

thanks ill look into that.
_________________
Just a user.
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2569
Location: Here and Away Again

PostPosted: Sun Jan 24, 2016 10:25 pm    Post subject: ><)))°€ Reply with quote

It's been quite a while since I started using the sys-kernel/ck-sources, and haven't tried any other for a long while so I can't really say for sure it's a huge difference still. I do seem to remember there being quite a change back some years ago at least when I did first try them out.

I can emerge with all my 6 cores while playing, without huge performance drops (more during some builds than during others).

So if you haven't yet, perhaps give the BFS a try. ^^
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Jan 25, 2016 10:44 am    Post subject: Reply with quote

You should also think about core in use.

If 4 cores out of your 8 are busy, and the game try to use one of the 4 busy cores...

Have a look at taskset to handle what cores do what work (as many scheduler are dumb, pushing emerge on 4 latest cores might be enough as many games never need more than 2-3 cores in real).

Or goes with Chiitoo's suggest, while i'm not myself familiar with BFS it might do a better balancing...
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 10:56 am    Post subject: Re: ><)))°€ Reply with quote

Chiitoo wrote:


I can emerge with all my 6 cores while playing, without huge performance drops (more during some builds than during others).

So if you haven't yet, perhaps give the BFS a try. ^^

i did try long time ago - didn't seem to make much difference.
i tried to give it a shot this time, i get kernel panic. I copy old config from current /usr/src/linux and paste in ck patched folder, then make&& make modules&& make modules install.
so no luck there either.

star opposite of bfs was up, so I assume scheduler was chosen.
I give up on BFS at this time.
_________________
Just a user.


Last edited by dimko on Mon Jan 25, 2016 11:01 am; edited 1 time in total
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 10:59 am    Post subject: Reply with quote

krinn wrote:
You should also think about core in use.

If 4 cores out of your 8 are busy, and the game try to use one of the 4 busy cores...

Have a look at taskset to handle what cores do what work (as many scheduler are dumb, pushing emerge on 4 latest cores might be enough as many games never need more than 2-3 cores in real).

Or goes with Chiitoo's suggest, while i'm not myself familiar with BFS it might do a better balancing...


I did taskset emerge process with 4 first cores and used 4 last cores for my Sword Coast Legends, FPS dropped to 11 in area it doesn't go below 30, where usually its between 40-60 or so(no visible lag anyway).
_________________
Just a user.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Jan 25, 2016 11:10 am    Post subject: Reply with quote

then lower it to 2 cores only, as your cpu have only 4 cores (even 8 logical ones are seen)
it's no worst than intel with ht, but alas, it's also not better.
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 11:11 am    Post subject: Reply with quote

krinn wrote:
then lower it to 2 cores only, as your cpu have only 4 cores (even 8 logical ones are seen)
it's no worst than intel with ht, but alas, it's also not better.

will do will report.
_________________
Just a user.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Jan 25, 2016 11:15 am    Post subject: Reply with quote

ps: don't forget to look at /proc/cpuinfo and ident each core by its "core id" number, as assigning "core id 0 cpu cores 4" and "core id 0 cpu cores 6" will not assign tasks to two cores, but on the same one.
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 11:39 am    Post subject: Reply with quote

krinn wrote:
ps: don't forget to look at /proc/cpuinfo and ident each core by its "core id" number, as assigning "core id 0 cpu cores 4" and "core id 0 cpu cores 6" will not assign tasks to two cores, but on the same one.

taskset for 0,2 and for game 4,6 seem to have done trick, but I wonder what was wrong with 0,1,2,3 and 4,5,6,7?
Shouldn't it have same effect?

i checked /proc info there is no difference between different CPU, only processor number.
_________________
Just a user.
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 11:53 am    Post subject: Reply with quote

krinn wrote:
ps: don't forget to look at /proc/cpuinfo and ident each core by its "core id" number, as assigning "core id 0 cpu cores 4" and "core id 0 cpu cores 6" will not assign tasks to two cores, but on the same one.


dont see that much of an effect with core 0 2 for emerge and core 4 6 with game
_________________
Just a user.
Back to top
View user's profile Send private message
Syl20
l33t
l33t


Joined: 04 Aug 2005
Posts: 619
Location: France

PostPosted: Mon Jan 25, 2016 7:07 pm    Post subject: Reply with quote

dimko wrote:
Disc access is not the issue with 32 gigs of ram. Once file read - it stays in ram, until ram is ever filled. 32 gigs of ram = never filled.

Where do you think wget puts the downloaded sources packages, tar loads and uncompresses them, gcc reads the source and header files, and puts the compiled files (unless you use a dedicated RAM FS, of course), ccache (if used) reads and writes its cache files, emerge merges the final package files, and removes the obsolete files ? Have a look on your IO access when emerging, you'll see that lots of RAM, when well used, can certainly provide better perfs, but are not a magic wand. :wink:

However, I don't know if IO are the problem, in your case.
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7470

PostPosted: Mon Jan 25, 2016 8:40 pm    Post subject: Reply with quote

dimko wrote:

taskset for 0,2 and for game 4,6 seem to have done trick, but I wonder what was wrong with 0,1,2,3 and 4,5,6,7?
Shouldn't it have same effect?

it should, but it will not because of the amd architecture, https://en.wikipedia.org/wiki/Bulldozer_%28microarchitecture%29#Bulldozer_core
Quote:
this module is equal to a dual-core processor in its integer power, and to a single-core processor in its floating-point power: for each two integer cores, there is one floating-point core.

So when doing integer operations, each module within one core (one core have 2 integer module) is able to handle 1 thread, making one core doing two threads, but as the core have only 1 fpu, any floating point operation done by this core will cut down its performance to 1 thread.

And guess what, a 3D game (i suppose gcc will not help there) will of course need a lot of floating point operations, making each core running one thread and the 4 real cores busy to full. So when you feed the 4 other logical cores, they cannot work and the real cores must handle the operations, as they are already busy : delays.
Hence my suggest to limit game to 2 cores only, and also this is why i suggest you to really check what cores you feed with. With my i7 i can see what are real core and HT ones by checking the "core id" value of each core.
Code:
processor   : 2
core id      : 2
...
processor   : 6
core id      : 2

It mean if i feed core 2 and core 6 i'm doing it wrong, as core 2 and core 6 share the same id, one of them is an HT core, and if i busy core 2, core 6 may not be able to produce anything.
While we could assume real ones are declare first (0..3) and HT last, i have no info or clue if that's true.

While intel claims my i7 to be 4 cores and HT, and claims it can do 8 threads, that's more or less true, it is really 4 cores, and it "can" do 8 threads when HT is able to work, what you could only claim for sure is that it can do 4 threads always. I suppose the little lie is acceptable for marketting: it "can" do 8 threads, but can doesn't mean it will always do 8 threads, but when checking spec this little lie is hidden behind a <core/threads 4/8> without telling anyone <core/threads 4/ min:4 max:8>
amd just pickup the full lie shortcut and claim it's an 8 core cpu, but when you buy a 8 core cpu, you didn't buy an 8 cores cpu for integers, you buy a general purpose 8 cores cpu, and it should do 8 fpu operations too then, something that cpu cannot do https://en.wikipedia.org/wiki/Bulldozer_%28microarchitecture%29#False_advertising_lawsuit
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 9:38 pm    Post subject: Reply with quote

Well, for compiling, which, AFAIK, fpu is not needed much, so I did buy my CPU with this in mind. This + gaming are my biggest CPU eaters. I admit, I am a bit AMD CPU fan boy + it costs far less than Intel, most of time I am simply broke. Anyway, games I play should be sorta, kinda, OK with 'dual core'. So I imagine, out of 4 FPU CPU's 2 should be enough for something like sword coast legends.(780 TI nvidia, which is rather not bad card)

for your curiosity, here is proc 0 and proc 7 from /proc:

processor : 0
vendor_id : AuthenticAMD
cpu family : 21
model : 2
model name : AMD FX(tm)-8350 Eight-Core Processor
stepping : 0
microcode : 0x600081c
cpu MHz : 2100.000
cache size : 2048 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 16
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1
bugs : fxsave_leak sysret_ss_attrs
bogomips : 8035.86
TLB size : 1536 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro

processor : 7
vendor_id : AuthenticAMD
cpu family : 21
model : 2
model name : AMD FX(tm)-8350 Eight-Core Processor
stepping : 0
microcode : 0x600081c
cpu MHz : 2800.000
cache size : 2048 KB
physical id : 0
siblings : 8
core id : 7
cpu cores : 4
apicid : 23
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc extd_apicid aperfmperf pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 popcnt aes xsave avx f16c lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs xop skinit wdt lwp fma4 tce nodeid_msr tbm topoext perfctr_core perfctr_nb arat cpb hw_pstate npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold vmmcall bmi1
bugs : fxsave_leak sysret_ss_attrs
bogomips : 8035.86
TLB size : 1536 4K pages
clflush size : 64
cache_alignment : 64
address sizes : 48 bits physical, 48 bits virtual
power management: ts ttp tm 100mhzsteps hwpstate cpb eff_freq_ro
_________________
Just a user.
Back to top
View user's profile Send private message
dimko
Apprentice
Apprentice


Joined: 12 Feb 2006
Posts: 196

PostPosted: Mon Jan 25, 2016 10:25 pm    Post subject: Reply with quote

CneGroumF wrote:
dimko wrote:
Disc access is not the issue with 32 gigs of ram. Once file read - it stays in ram, until ram is ever filled. 32 gigs of ram = never filled.

Where do you think wget puts the downloaded sources packages, tar loads and uncompresses them, gcc reads the source and header files, and puts the compiled files (unless you use a dedicated RAM FS, of course), ccache (if used) reads and writes its cache files, emerge merges the final package files, and removes the obsolete files ? Have a look on your IO access when emerging, you'll see that lots of RAM, when well used, can certainly provide better perfs, but are not a magic wand. :wink:

However, I don't know if IO are the problem, in your case.


Most games, whenever stage loads, preloads all of the textures into memory. So at this time, game will not load anything at run time(stage takes load time to preload, also I know there is run time load, when I see it)
Once assets preloaded - they will be in RAM, and 32 gigs of ram is usually never used to 100% even with file caching.

I was wondering, can alsa/pulseaudio have bad effect on FPS?(though I did notice significant FPS drop outside of battles, when it's relatively silent)
_________________
Just a user.
Back to top
View user's profile Send private message
Naib
Watchman
Watchman


Joined: 21 May 2004
Posts: 6051
Location: Removed by Neddy

PostPosted: Mon Jan 25, 2016 10:40 pm    Post subject: Reply with quote

possibly... FPS drop can be caused by anything causing rendering to ... pause. Be it too long to render, IO bound waiting for new info from net (or inputs if bad code) and equally sound...

or the drivers are shocking... and alot of "HD sound" onboard chipsets are ... shocking.
_________________
Quote:
Removed by Chiitoo
Back to top
View user's profile Send private message
Chiitoo
Administrator
Administrator


Joined: 28 Feb 2010
Posts: 2569
Location: Here and Away Again

PostPosted: Mon Jan 25, 2016 11:32 pm    Post subject: Re: ><)))°€ Reply with quote

Hmmm.

dimko wrote:
i tried to give it a shot this time, i get kernel panic. I copy old config from current /usr/src/linux and paste in ck patched folder, then make&& make modules&& make modules install.

I've not had any kernel panics, so I believe that is not something that normally is part of the deal. ^^

I might suggest at least 'make oldconfig' before building the kernel and modules, but nevermind that (unless you want to try again at some point!), I'm interested on which version of ck-sources you did try? I might try reproducing it and, if need be, report it as a bug.
_________________
Kindest of regardses.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gamers & Players All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum