AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64] (https://forums.alliedmods.net/showthread.php?t=320648)

Fastmancz 01-01-2020 18:13

[CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64]
 

Introduction
  • Many people don't know how to build their own core. I will try to help you in this tutorial. With this post, I want to start a discussion and find the best kernel build solution for Counter-Strike: Global Offensive. We can do it! It's there are a lot of smart people (it's not ironically).

DISCLAIMER
  • I'm not responsible for destroyed hardware or software caused by this tutorial. You do everything at your own risk. This tutorial is intended for intermediate users of Linux. Incorrect installation can cause system instability and may not boot your linux system. If you are a complete beginner, I recommend using a virtual machine (Virtualbox). I recommend backup your data before proceeding in this tutorial.
  • This tutorial doesn't guarantee performance. We all have probably different hardware.

Let's do it

This tutorial has been tested on hardware (dedicated server):
  • Intel Core i7-3770 (3.40 GHz / 3.90 GHz)
  • HDD2x HDD SATA 3,0 TB
  • RAM2x RAM 8192 MB DDR3
OS:
  • Debian GNU/Linux 9 (stretch)
  • SMP Debian 4.9.189-3+deb9u2 (2019-11-11) x86_64
Open your server console and follow the instructions.
  1. Install important compilation packages.
    PHP Code:

    apt install fakeroot ca-certificates build-essential bison flex gnupg libncurses-dev libelf-dev libssl-dev wget bc rsync 


  2. PHP Code:

    gpg --locate-keys torvalds@kernel.org gregkh@kernel.org 


  3. PHP Code:

    mkdir ~/kernel
    cd 
    ~/kernel 

  4. Download the latest kernel from: https://www.kernel.org/ (yellow button or stable -> tarball)
    PHP Code:

    wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.7.tar.xz
    wget https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.7.tar.sign 

  5. Unpack the package. If package verification fails, remove (| gpg --verify linux-5.4.7.tar.sign -).
    PHP Code:

    unxz -c linux-5.4.7.tar.xz gpg --verify linux-5.4.7.tar.sign -
    cd linux-5.4.7 

  6. We're going to set up your kernel.
    PHP Code:

    make menuconfig 

  7. Now set according to the settings tree.
    PHP Code:

    Processor type and features
    [*] CPU Frequency scaling
         Timer frequency 
    (xxx Hz) ---> 1 000 Hz

    -------------------------------------------------------------------
    Power management and ACPI options -> CPU Frequency scaling
        
    Default CPUFreq governor (performance) --->
    [*] 
    CPU Frequency scaling
    [*]   'performance' governor
        
    []   'powersave' governor
        
    []   'userspace' governor for userspace frequency scaling
        
    []   'ondemand' cpufreq policy governor
        
    []   'conservative' cpufreq governor
        
    []   'schedutil' cpufreq governor 

  8. Save everything and exit.
  9. Check the following settings in .config and save.
    PHP Code:

    nano .config
    CONFIG_SYSTEM_TRUSTED_KEYS 
    ""
    CONFIG_DEBUG_INFO=

  10. You can use your own name instead of fastkernel.
    PHP Code:

    make clean
    make deb
    -pkg LOCALVERSION=-fastkernel -j[NUMBER_OF_CORES

  11. The kernel is compiling. Hard work. Here you have some bacon as a reward. :bacon!: (Now you have about 2 hours of free time ~ depends on processor performance). :wink:
  12. We have a compiled kernel. Install the kernel.
    PHP Code:

    Install
    =====
    dpkg -../linux-image-5.4.7-fastkernel_5.4.7-fastkernel-1_amd64.deb

    Uninstall
    =====
    apt-get purge fastkernel_5.4.7 

  13. Restart the server and enter the command after booting.
    PHP Code:

    uname -r
    --> You will get5.4.7-fastkernel <-- 

  14. We turn on the Intel turbo.
    PHP Code:

    echo > /sys/devices/system/cpu/intel_pstate/no_turbo 

  15. Now let's set the CPU's permanent performance to maximum. Create a cpu.sh file somewhere. Modify the settings according to your processor!
    PHP Code:

    apt install cpufrequtils //Install this tool, otherwise it will not work. 

    PHP Code:

    #!/bin/bash

    cpufreq-set --cpu 0 --governor performance
    cpufreq
    -set --cpu 1 --governor performance
    cpufreq
    -set --cpu 2 --governor performance
    cpufreq
    -set --cpu 3 --governor performance
    cpufreq
    -set --cpu 4 --governor performance
    cpufreq
    -set --cpu 5 --governor performance
    cpufreq
    -set --cpu 6 --governor performance
    cpufreq
    -set --cpu 7 --governor performance

    cpufreq
    -set -u 3.90GHz
    cpufreq
    -set -d 3.90GHz

    cpufreq
    -set --g performance 

  16. Now let's set the script to run every time the server restarts. I put the startup script into etc/rc.local (the file does not normally exist). We'll create it.
    PHP Code:

    nano /etc/systemd/system/rc-local.service 

    PHP Code:

    [Unit]
    Description=/etc/rc.local
    ConditionPathExists
    =/etc/rc.local

    [Service]
    Type=forking
    ExecStart
    =/etc/rc.local start
    TimeoutSec
    =0
    StandardOutput
    =tty
    RemainAfterExit
    =yes
    SysVStartPriority
    =99

    [Install]
    WantedBy=multi-user.target 

    PHP Code:

    nano /etc/rc.local 

    PHP Code:

    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    /cpu.sh || exit 1

    exit 

    PHP Code:

    chmod +/etc/rc.local
    systemctl enable rc
    -local
    systemctl start rc
    -local.service
    systemctl status rc
    -local.service 

  17. Restart the server.
  18. Type the command cpupower frequency-info. You should see something like that.
    PHP Code:

    analyzing CPU 0:
      
    driverintel_pstate
      CPUs which run at the same hardware frequency
    0
      CPUs which need to have their frequency coordinated by software
    0
      maximum transition latency
    :  Cannot determine or is not supported.
      
    hardware limits1.60 GHz 3.90 GHz
      available cpufreq governors
    performance powersave
      current policy
    frequency should be within 3.90 GHz and 3.90 GHz.
                      
    The governor "performance" may decide which speed to use
                      
    within this range.
      
    current CPU frequencyUnable to call hardware
      current CPU frequency
    3.40 GHz (asserted by call to kernel)
      
    boost state support:
        
    Supportedyes
        Active
    yes
        3700 MHz max turbo 4 active cores
        3800 MHz max turbo 3 active cores
        3900 MHz max turbo 2 active cores
        3900 MHz max turbo 1 active cores 


Congratulations, we're done. I'll give you bacon again, you deserve it! :bacon!: 8)

Fastmancz 01-01-2020 18:20

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
https://i.imgur.com/imLKcFJ.jpg

Another kernels (I didn't try it)

iGANGNAM 01-02-2020 23:48

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
Is there any point from cpufrequtils ? and nice tut by the way :) but I'm getting same results as yours just by using xanmod kernel and tuned-adm latency-performance profile

Fastmancz 01-03-2020 03:31

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
First, thanks! The cpufrequtils package is intended to improve processor performance after setup (to force the processor to use full performance). There will probably be no difference between cpufrequtils and tuned-adm.

However, I wanted to try the tuned-adm package, but it doesn't exist for Debian 9 (I didn't find it). :(

Maxximou5 01-03-2020 04:41

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
Quote:

Originally Posted by Fastmancz (Post 2678832)
However, I wanted to try the tuned-adm package, but it doesn't exist for Debian 9 (I didn't find it). :(

Of course you can use tuned for Debian 9!

Simply do the following.
  1. Edit your /etc/apt/sources.list and add below line:
  2. deb http://ftp.us.debian.org/debian sid main
  3. apt-get update;apt install tuned tuned-gtk tuned-utils tuned-utils-systemtap
  4. Complete the update and installation
  5. Run the command: tuned-adm list
  6. Remove or comment out the SID source in sources.list as it's unstable

Fastmancz 01-03-2020 18:20

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
Thanks Maxximou5, it works! :up:

However, what makes tuned-adm better than cpufrequtils? Are there any benefits?

asdfxD 01-06-2020 22:59

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
xanmod is the best kernel, others doesn't feel like "128" Tick.

spumer 01-07-2020 10:54

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
All this needed only for manual enable Intel Turbo?

If you have enough performance CPU and one server load one CPU up to 80%, in that case i think you can use standart kernel. But, for performance reasons you can setup process affinity and stick each server to different CPUs.

ThePwnt 01-08-2020 08:41

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
@Fastmancz

I did add this thread, on my Github! =)

Fastmancz 01-09-2020 06:07

Re: [CS:GO][LINUX] Build your own kernel = 1 000 Hz + CPU Performance [Debian ~ amd64
 
Quote:

Originally Posted by ThePwnt (Post 2679393)
@Fastmancz

I did add this thread, on my Github! =)

Thanks! :up: :3


All times are GMT -4. The time now is 15:04.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.