存档

文章标签 ‘kernel’

内核的 shmall 和 shmmax 参数

2009年3月2日 wd 没有评论

shmall 是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。这两个可以设置为内存的 90%。例如 16G 内存,16*1024*1024*1024*90% = 15461882265,shmall 的大小为 15461882265/4k(getconf PAGESIZE可得到) = 3774873。

修改 /etc/sysctl.conf。

kernel.shmmax=15461882265
kernel.shmall=3774873
kernel.msgmax=65535
kernel.msgmnb=65535
执行 sudo sysctl -p

可以使用 ipcs -l 看结果。ipcs -u 可以看到实际使用的情况。

------ Shared Memory Limits --------
max number of segments = 4096
max seg size (kbytes) = 15099494
max total shared memory (kbytes) = 15097856
min seg size (bytes) = 1
 
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
 
------ Messages: Limits --------
max queues system wide = 16
max size of message (bytes) = 8192
DEFAULT max size of queue (bytes) = 16384
分类: Linux 标签:

更新 kenerl 到了 2.6.28

2008年12月27日 wd 没有评论

之前用的是 tuxonice 的 kernel, 为了体验他的休眠。可是最近发现我基本就不用休眠。而且 tuxonice 的内核还一直停留在 2.6.26 上面。最近 2.6.28 火的不行,所以就给他升级了。

升级没遇到什么问题。新选择了 ext4 支持,等哪天把 fs 都修改到 ext4 去,不过好像有点折腾,呵呵。

gentoo-souces 也是支持的休眠的。想要在 gnome 下面休眠的话,安装一个 pm-utilus 这个包就可以了。在电源管理那里选休眠就可以了。不过发现 挂起 好像不支持,挂起了就不能唤醒了,很郁闷。我记得 tuxonice 下面挂起好像也不支持,不管他了。

那个号称革命性的 GEM 不知道什么时候能在 radeon 上面出现。等着吧。

分类: Linux 标签: , , ,

使用 uvesafb

2008年4月13日 wd 没有评论

FB 就是 Frambuffer 了。直观一点说,使用之后,可以给 console 设置分辨率,可以在console下面看电影,看图?

在 Kernel 里面,ATI 显卡有个 Readonfb,使用后不需要修改 grub 就可以直接出现高分辨率的 console,但是他和 ATI 的 fglrx 驱动冲突,会导致死机,所以,基本没法子用,除非你不打算进 x。

uvesafb 以前叫做 vesafb-tng,似乎是从 kernel 2.6.23 开始改名的。使用这个也很简单了,参考作者的 web 页面。

有几个内核参数:

Connector - unified userspace <-> kernelspace linker
Graphics support ---> Userspace VESA VGA graphics support
General Setup --->  Initial RAM filesystem and RAM disk (initramfs/initrd) support 设置为 /usr/share/v86d/initramfs
上面几个设置分别是
CONFIG_CONNECTOR=y
CONFIG_FB_UVESA=y
CONFIG_INITRAMFS_SOURCE="/usr/share/v86d/initramfs"

安装 klibc 和 v86d 。修改 grub,添加 video=uvesafb:1024×768-32,mtrr:3,ywrap

如果遇到 ‘uvesafb: failed to execute /sbin/v86d’ 的错误,可能是最后一个内核参数没有设置好的缘故。

分类: Linux 标签: ,

linux tuning

2007年6月4日 wd 没有评论

地址 http://www.enigma.id.au/linux_tuning.txt

# Linux kernel tweaking for performance and security on a busy Linux
# server with a decent amount of memory.
#
# This file should be saved as /etc/sysctl.conf
# You can source it manually if your system has booted by using:
# sysctl -e -p /etc/sysctl.conf
#
# Paul Day, paul (at) bur.st
#
# Last updated 02/03/05 and tested on 2.6.9
#
 
# Increase RPC slots
sunrpc.tcp_slot_table_entries = 32
sunrpc.udp_slot_table_entries = 32
# Increase size of RPC datagram queue length
net.unix.max_dgram_qlen = 50
# Log spoofed, source routed and redirects
net.ipv4.conf.default.log_martians = 1
# Don't accept source routes
net.ipv4.conf.default.accept_source_route = 0
# Don't send redirects
net.ipv4.conf.default.send_redirects = 0
# Source route verification on - incoming packets must match outgoing routing
net.ipv4.conf.default.rp_filter = 1
# Don't accept redirects
net.ipv4.conf.default.accept_redirects = 0
# Don't forward source routes
net.ipv4.conf.default.mc_forwarding = 0
# Disable forwarding 
net.ipv4.conf.default.forwarding = 0
# Log spoofed, source routed and redirects
net.ipv4.conf.all.log_martians = 1
# Don't relay bootp
net.ipv4.conf.all.bootp_relay = 0
# Don't proxy arp for anyone
net.ipv4.conf.all.proxy_arp = 0
# Don't accept source route packets
net.ipv4.conf.all.accept_source_route = 0
# Don't send redirects
net.ipv4.conf.all.send_redirects = 0
# Source route verification on - incoming packets must match outgoing routing
net.ipv4.conf.all.rp_filter = 1
# Don't accept redirects
net.ipv4.conf.all.accept_redirects = 0
# Don't forward source routes
net.ipv4.conf.all.mc_forwarding = 0
# Don't enable forwarding
net.ipv4.conf.all.forwarding = 0
# Don't allow the arp table to become bigger than this
net.ipv4.neigh.default.gc_thresh3 = 2048
# Tell the gc when to become aggressive with arp table cleaning.
# Adjust this based on size of the LAN. 256 is suitable for most
net.ipv4.neigh.default.gc_thresh2 = 1024
# Adjust where the gc will leave arp table alone - set to 32.
net.ipv4.neigh.default.gc_thresh1 = 32
# Adjust to arp table gc to clean-up more often
net.ipv4.neigh.default.gc_interval = 30
# Increase TCP
net.ipv4.neigh.default.proxy_qlen = 96
net.ipv4.neigh.default.unres_qlen = 6
# Increase size of socket buffers
net.ipv4.tcp_rmem = 4096	98304	349520
net.ipv4.tcp_wmem = 4096	65535	262142
net.ipv4.tcp_mem = 98304	262142	393216
# Turn off sack
net.ipv4.tcp_dsack = 0
# Don't use ECN because too many sites have wacky routers that can't handle it`
net.ipv4.tcp_ecn = 0
net.ipv4.tcp_reordering = 3
# Turn off sack/fack
net.ipv4.tcp_fack = 0
# Enable bad error message Protection
net.ipv4.icmp_ignore_bogus_error_responses = 1
# Ignore broadcasts pings, could become part of a Smurf
net.ipv4.icmp_echo_ignore_broadcasts = 1
# But don't ignore directed pings
net.ipv4.icmp_echo_ignore_all = 0
# Widen local port range
net.ipv4.ip_local_port_range = 33000	60000
# Bump up TCP socket queuer to help with syn floods
net.ipv4.tcp_max_syn_backlog = 2048
# Turn syn-cookie protection on
net.ipv4.tcp_syncookies = 1
# Drop it so lack of FIN times out quicker
net.ipv4.tcp_fin_timeout = 30
# How many times to retry killing an alive TCP connection
net.ipv4.tcp_retries2 = 15
net.ipv4.tcp_retries1 = 3
# Enable a fix for RFC1337 - time-wait assassination hazards in TCP
net.ipv4.tcp_rfc1337 = 1
# Drop keep-alive time
net.ipv4.tcp_keepalive_time = 3600
# Set number of times to retry a SYN-ACK in a half-open new connections
net.ipv4.tcp_synack_retries = 5
# Set number of times to retry SYN in a new connection
net.ipv4.tcp_syn_retries = 5
# Turn off sack
net.ipv4.tcp_sack = 0
# Enable really big (>65kB) TCP window scaling if we want it.
net.ipv4.tcp_window_scaling = 1
# Turn off timestamps
# Turn this back on if you're on a gigabit or very busy network
# Having it off is one less thing the IP stack needs to work on
net.ipv4.tcp_timestamps = 0
# Increase number of incoming connections backlog
net.core.somaxconn = 512
# Bump optmem_max up
net.core.optmem_max = 20480
# Increase number of incoming connections backlog
net.core.netdev_max_backlog = 1024
net.core.dev_weight = 64
# Bump up default r/wmem to max
net.core.rmem_default = 262141
net.core.wmem_default = 262141
# Bump up max r/wmem
net.core.rmem_max = 262141
net.core.wmem_max = 262141
# Increase size of file handles and inode cache
fs.file-max = 209708

Powered by ScribeFire.

分类: Linux, Other 标签: , ,