ZEN: Implement zen-tune v4.19
4.9: In a surprising turn of events, while benchmarking and testing hierarchical scheduling with BFQ + writeback throttling, it turns out that raising the number of requests in queue _actually_ improves responsiveness and completely eliminates the random stalls that would normally occur without hierarchical scheduling. To make this test more intense, I used the following test: Rotational disk1: rsync -a /source/of/data /target/to/disk1 Rotational disk2: rsync -a /source/of/data /target/to/disk2 And periodically attempted to write super fast with: dd if=/dev/zero of=/target/to/disk1/block bs=4096 This wrote 10gb incredibly fast to writeback and I encountered zero stalls through this entire test of 10-15 minutes. My suspicion is that with cgroups, BFQ is more able to properly sort among multiple drives, reducing the chance of a starved process. This plus writeback throttling completely eliminate any outstanding bugs with high writeback ratios, letting the user enjoy low latency writes (application thinks they're already done), and super high throughput due to batched writes in writeback. Please note however, without the following configuration, I cannot guarantee you will not get stalls: CONFIG_BLK_CGROUP=y CONFIG_CGROUP_WRITEBACK=y CONFIG_IOSCHED_CFQ=y CONFIG_CFQ_GROUP_IOSCHED=y CONFIG_IOSCHED_BFQ=y CONFIG_BFQ_GROUP_IOSCHED=y CONFIG_DEFAULT_BFQ=y CONFIG_SCSI_MQ_DEFAULT=n Special thanks to h2, author of smxi and inxi, for providing evidence that a configuration specific to Debian did not cause stalls found the Liquorix kernels under heavy IO load. This specific configuration turned out to be hierarchical scheduling on CFQ (thus, BFQ as well). 4.10: During some personal testing with the Dolphin emulator, MuQSS has serious problems scaling its frequencies causing poor performance where boosting the CPU frequencies would have fixed them. Reducing the up_threshold to 45 with MuQSS appears to fix the issue, letting the introduction to "Star Wars: Rogue Leader" run at 100% speed versus about 80% on my test system. Also, lets refactor the definitions and include some indentation to help the reader discern what the scope of all the macros are. 4.11: Increase MICRO_FREQUENCY_UP_THRESHOLD from 95 to 85 Increase MIN_FREQUENCY_UP_THRESHOLD from 11 to 6 These changes should help make using CFS feel a bit more responsive when working with mostly idle workloads, browsing the web, scrolling through text, etc. Increasing the minimum frequency up threshold to 6% may be too aggressive though. Will revert this setting if it causes significant battery drain. 4.12: Make bfq the default MQ scheduler Reduce default sampling down factor from 10 to 1 With the world eventually moving to a more laptop heavy configuration, it's getting more important that we can reduce our frequencies quickly after performing work. This is normal with a ton of background processes that need to perform burst work then sleep. Since this doesn't really impact performance too much, lets not keep it part of ZEN_INTERACTIVE. Some time ago, the minimum frequency up threshold was set to 1 by default, but the zen configuration was never updated to take advantage of it. Remove custom MIN_FREQUENCY_UP_THRESHOLD for MuQSS / ZEN_INTERACTIVE configurations and make 1 the default for all choices. 4.18: Prefer bfq-mq when available if zen interactive is enabled The bfq-mq elevator is typically one major kernel version ahead in optimizations and bug fixes due to early access patches in the algodev/bfq-mq github repository. Since these patches are typically low risk and almost always improve performance and/or increase stability, prefer bfq-mq over bfq when available. Switch from MuQSS to PDS-mq. 4.19: Switch from PDS-mq back to MuQSS Signed-off-by: MOVZX <movzx@yahoo.com>
This commit is contained in:
@@ -46,7 +46,11 @@ struct blk_stat_callback;
|
||||
struct keyslot_manager;
|
||||
|
||||
#define BLKDEV_MIN_RQ 4
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
#define BLKDEV_MAX_RQ 512
|
||||
#else
|
||||
#define BLKDEV_MAX_RQ 128 /* Default maximum */
|
||||
#endif
|
||||
|
||||
/* Must be consisitent with blk_mq_poll_stats_bkt() */
|
||||
#define BLK_MQ_POLL_STATS_BKTS 16
|
||||
|
||||
32
init/Kconfig
32
init/Kconfig
@@ -44,6 +44,38 @@ config THREAD_INFO_IN_TASK
|
||||
|
||||
menu "General setup"
|
||||
|
||||
config ZEN_INTERACTIVE
|
||||
bool "Tune kernel for interactivity"
|
||||
default y
|
||||
help
|
||||
Tunes the kernel for responsiveness at the cost of throughput and power usage.
|
||||
|
||||
--- Virtual Memory Subsystem ---------------------------
|
||||
|
||||
Mem dirty before bg writeback..: 10 % -> 20 %
|
||||
Mem dirty before sync writeback: 20 % -> 50 %
|
||||
|
||||
--- Block Layer ----------------------------------------
|
||||
|
||||
Queue depth...............: 128 -> 512
|
||||
Default MQ scheduler......: mq-deadline -> bfq
|
||||
|
||||
--- CFS CPU Scheduler ----------------------------------
|
||||
|
||||
Scheduling latency.............: 6 -> 3 ms
|
||||
Minimal granularity............: 0.75 -> 0.3 ms
|
||||
Wakeup granularity.............: 1 -> 0.5 ms
|
||||
CPU migration cost.............: 0.5 -> 0.25 ms
|
||||
Bandwidth slice size...........: 5 -> 3 ms
|
||||
Ondemand fine upscaling limit..: 95 % -> 85 %
|
||||
|
||||
--- MuQSS CPU Scheduler --------------------------------
|
||||
|
||||
Scheduling interval............: 6 -> 3 ms
|
||||
ISO task max realtime use......: 70 % -> 25 %
|
||||
Ondemand coarse upscaling limit: 80 % -> 45 %
|
||||
Ondemand fine upscaling limit..: 95 % -> 45 %
|
||||
|
||||
config BROKEN
|
||||
bool
|
||||
|
||||
|
||||
@@ -119,8 +119,13 @@ walt_dec_cfs_rq_stats(struct cfs_rq *cfs_rq, struct task_struct *p) {}
|
||||
*
|
||||
* (default: 6ms * (1 + ilog(ncpus)), units: nanoseconds)
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
unsigned int sysctl_sched_latency = 3000000ULL;
|
||||
unsigned int normalized_sysctl_sched_latency = 3000000ULL;
|
||||
#else
|
||||
unsigned int sysctl_sched_latency = 5000000ULL;
|
||||
unsigned int normalized_sysctl_sched_latency = 5000000ULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable/disable honoring sync flag in energy-aware wakeups.
|
||||
@@ -149,13 +154,22 @@ enum sched_tunable_scaling sysctl_sched_tunable_scaling = SCHED_TUNABLESCALING_L
|
||||
*
|
||||
* (default: 0.75 msec * (1 + ilog(ncpus)), units: nanoseconds)
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
unsigned int sysctl_sched_min_granularity = 300000ULL;
|
||||
unsigned int normalized_sysctl_sched_min_granularity = 300000ULL;
|
||||
#else
|
||||
unsigned int sysctl_sched_min_granularity = 750000ULL;
|
||||
unsigned int normalized_sysctl_sched_min_granularity = 750000ULL;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This value is kept at sysctl_sched_latency/sysctl_sched_min_granularity
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
static unsigned int sched_nr_latency = 10;
|
||||
#else
|
||||
static unsigned int sched_nr_latency = 8;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* After fork, child runs first. If set to 0 (default) then
|
||||
@@ -172,10 +186,17 @@ unsigned int sysctl_sched_child_runs_first __read_mostly;
|
||||
*
|
||||
* (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds)
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
unsigned int sysctl_sched_wakeup_granularity = 500000UL;
|
||||
unsigned int normalized_sysctl_sched_wakeup_granularity = 500000UL;
|
||||
|
||||
const_debug unsigned int sysctl_sched_migration_cost = 250000UL;
|
||||
#else
|
||||
unsigned int sysctl_sched_wakeup_granularity = 1000000UL;
|
||||
unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL;
|
||||
|
||||
const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
|
||||
#endif
|
||||
DEFINE_PER_CPU_READ_MOSTLY(int, sched_load_boost);
|
||||
|
||||
#ifdef CONFIG_SCHED_WALT
|
||||
@@ -206,8 +227,12 @@ int __weak arch_asym_cpu_priority(int cpu)
|
||||
*
|
||||
* (default: 5 msec, units: microseconds)
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
unsigned int sysctl_sched_cfs_bandwidth_slice = 3000UL;
|
||||
#else
|
||||
unsigned int sysctl_sched_cfs_bandwidth_slice = 5000UL;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_BORE
|
||||
uint __read_mostly sched_burst_exclude_kthreads = 1;
|
||||
|
||||
@@ -71,7 +71,11 @@ static long ratelimit_pages = 32;
|
||||
/*
|
||||
* Start background writeback (via writeback threads) at this percentage
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
int dirty_background_ratio = 20;
|
||||
#else
|
||||
int dirty_background_ratio = 10;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* dirty_background_bytes starts at 0 (disabled) so that it is a function of
|
||||
@@ -88,7 +92,11 @@ int vm_highmem_is_dirtyable;
|
||||
/*
|
||||
* The generator of dirty data starts writeback at this percentage
|
||||
*/
|
||||
#ifdef CONFIG_ZEN_INTERACTIVE
|
||||
int vm_dirty_ratio = 50;
|
||||
#else
|
||||
int vm_dirty_ratio = 20;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* vm_dirty_bytes starts at 0 (disabled) so that it is a function of
|
||||
|
||||
Reference in New Issue
Block a user