Techniques For Reduction in Variance in Execution Cycles - Sheet1
The document outlines various techniques for optimizing system performance, including real-time scheduling policies (SCHED_FIFO and SCHED_RR), reducing system load by managing services, and setting CPU affinity using the taskset command. It also discusses proactive page reclaim through a custom kernel module and CPU isolation using the isolcpus kernel parameter. Many of these techniques require sudo access and involve modifying system settings or kernel configurations.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
10 views2 pages
Techniques For Reduction in Variance in Execution Cycles - Sheet1
The document outlines various techniques for optimizing system performance, including real-time scheduling policies (SCHED_FIFO and SCHED_RR), reducing system load by managing services, and setting CPU affinity using the taskset command. It also discusses proactive page reclaim through a custom kernel module and CPU isolation using the isolcpus kernel parameter. Many of these techniques require sudo access and involve modifying system settings or kernel configurations.
sudo systemctl stop <service_name> Disable the service: sudo systemctl disable <service_name> Reduce System Load Mask the service: (Stop Unnecessary Services & sudo systemctl mask <service_name> YES - _ Daemons)
2. Using chkconfig (SysVinit):
Disable the service:
/sbin/chkconfig <service_name> off Restore the service: /sbin/chkconfig <service_name> reset 1. taskset Command taskset -c 0 ./your_c_program 2.To launch pinned to a list of CPUs (e.g., CPUs 0 and 1): CPU Affinity No No CPU Affinity by Default Pinned to Specific Core(s) taskset -c 0,1 ./your_c_program 3.To find the current affinity of a running process (e.g., PID 1234): taskset -p 1234 monitor the /proc/reclaimed_pages file: watch -n 1 cat /proc/reclaimed_pages view the existing min_free_kbytes setting: Indirectly modifying kswapd through /proc/sys/vm/min_free_kbytes and cat /proc/sys/vm/min_free_kbytes reduction in the frequency and monitoring /proc/reclaimed_pages can be a technique to reduce YES values of /proc/reclaimed_pages raising the freemem threshold(generally by 2x): amount of reclaimed pages aggressive page reclaim & jitter mitigation sudo sysctl -w vm.min_free_kbytes=new_value to make change persistent: sudo nano /etc/sysctl.conf save changes: sudo sysctl -p Develop a Custom Kernel Module: 1. Specify free memory threshold: static unsigned long min_free_pages_threshold, reclaim_pages_count; define static ssize_t min_free_pages_read(), min_free_pages_write(); 2. specify the number of pages to reclaim: define static ssize_t reclaimed_pages_read(), reclaimed_pages_write(); 3. monitor disk read requests, amount of free memory & desired reclaim behavior standard page reclaim behavior is Modified Threshold and page reclaim Proactive Page Reclaim via a Custom Kernel Module and Thread YES 4. Define kernel thread function: static int reclaim_thread_fn governed by kswapd amount 5. module initialization: Create a Makefile(.ko) using make command 6. Load the Kernel Module : sudo insmod your_module.ko 7. Interact with the /proc Files : cat /proc/min_free_pages cat /proc/reclaimed_pages sudo sh -c "echo 16384 > /proc/min_free_pages sudo sh -c "echo 1024 > /proc/reclaimed_pages 1.Check current kernel configuration: zgrep CONFIG_NO_HZ_FULL /proc/config.gz 2.Use a kernel configuration tool (e.g., make menuconfig, make xconfig) to enable CONFIG_NO_HZ_FULL under the "Power management and ACPI options" or "Processor type and features" menu (or) Using make menuconfig and enabling CONFIG_NO_HZ_FULL), periodic scheduling ticks enabled on CPU Isolation using the isolcpus Kernel Parameter. 3. build the kernel:make -j<n> all CPUs. (programmable timer is configured to generate an interrupt signal at a install modules: sudo make modules_install YES CONFIG_NO_HZ_FULL might or might specific frequency: configuration parameter, like CONFIG_HZ in Linux) install the kernel : sudo make install) not be enabled in the default kernel 4. Update GRUB configuration sudo nano /etc/default/grub 5.specify which CPUs should run in "full tickless" mode: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nohz_full=2,3" sudo update-grub 5. sudo reboot 6. verify tickless mode: cat /sys/devices/system/cpu/cpu2/power/tickless==1