CONFIG_HZ 决定了jiffies一次的时钟滴答,影响系统的调度和性能。

一般在内核中固定好的,不能在.config中强制修改,因为不会生效,一旦执行了menuconfig又会变为内核默认的。

在param.h文件中这样定义

#ifndef __ASM_PARAM_H
#define __ASM_PARAM_H

#ifdef __KERNEL__
# define HZ		CONFIG_HZ	/* Internal kernel timer frequency */
# define USER_HZ	100		/* User interfaces are in "ticks" */
# define CLOCKS_PER_SEC	(USER_HZ)	/* like times() */
#else
# define HZ		100
#endif

#define EXEC_PAGESIZE	4096

#ifndef NOGROUP
#define NOGROUP         (-1)
#endif

/* max length of hostname */
#define MAXHOSTNAMELEN  64

#endif
在这里修改的话。编译的时候会在timeconst.h(由脚本timeconst.pl自动生成的文件)报错

#if HZ != 256
#error "kernel/timeconst.h has the wrong HZ value!"
#endif


可以这样修改:
在arch/arm/Kconfig中

看到 

config HZ
	int
	default 200 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
		ARCH_S5PV210 || ARCH_EXYNOS4
	default AT91_TIMER_HZ if ARCH_AT91
	default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
	default 100
这样可以修改默认值 200.

为了能在menuconfig中修改这个值,可以添加字符串。
修改成

config HZ
	int "TIME HZ"
	default 256 if ARCH_EBSA110 || ARCH_S3C24XX || ARCH_S5P64X0 || \
		ARCH_S5PV210 || ARCH_EXYNOS4
	default AT91_TIMER_HZ if ARCH_AT91
	default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
	default 100




GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:23 天前 )
186a802e added ecosystem file for PM2 4 年前
5def40a3 Add host customization support for the NodeJS version 4 年前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐