1
我有問題圍繞cgroups
和tc
環繞自己。cgroups和tc/netem:不知道如何讓它們一起工作
我試圖給特定的進程添加延遲。下面的代碼不起作用。但我不知道什麼是錯的(甚至什麼是正確的)。
# Set up net_cls to make
modprobe cls_cgroup
mount -t cgroup -o net_cls none /sys/fs/cgroup/net_cls
# Create a new CGroup called 'high-latency'
mkdir /sys/fs/cgroup/high-latency
# All packets originating from this CG have their packers
# marked as class 1:11/0x1_0011
echo 0x100011 > /sys/fs/cgroup/high-latency/net_cls.classid
# Delete old rules, just in case
tc qdisc del dev eth0 root
# New root
tc qdisc add dev eth0 handle 1: root htb
# Class for filtered packets 1:11 == 0x10011
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 100Mbps
# Apply delay to class 1:11
tc qdisc add dev eth0 parent 1:11 handle 10: netem delay 1000ms
# Don't understand this line at all! Why does tc need to know
# about 'cgroup', when net_cls is already putting them in class 1:11
tc filter add dev eth0 parent 1:11 protocol ip prio 10 handle 1: cgroup
# Add my process to the cgroup
echo 1234 > /sys/fs/cgroup/high-latency/tasks
另一個有趣的事情是,運行此之後,貓/sys/fs/cgroup/high-latency/tasks
打印一大堆的過程,包括PID 1.
任何想法,我做錯了,更重要的是(全部) - 在嘗試使用tc和cgroup時可以使用哪些調試工具?