Unverified Commit be25759c authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!2313 fixed the repeated setting logic of memcg_swap_qos_enable

Merge Pull Request from: @zhangwei123171 
 
    
Now when echo 1 > /proc/sys/vm/memcg_swap_qos_enable multiple times,  memcg_swap_qos_reset will be called every time.

In a production environment, when memcg swap qos is working normally, operations Engineer may execute sysctl -p for other reasons, destroying the relationship between each container and its corresponding swapfile. 
 
Link:https://gitee.com/openeuler/kernel/pulls/2313

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents 2a66dad6 4e6a126f
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -4084,11 +4084,13 @@ static int sysctl_memcg_swap_qos_handler(struct ctl_table *table, int write,
	if (ret)
		return ret;
	if (write) {
		if (sysctl_memcg_swap_qos_stat) {
		if (sysctl_memcg_swap_qos_stat &&
				!static_branch_likely(&memcg_swap_qos_key)) {
			memcg_swap_qos_reset();
			static_branch_enable(&memcg_swap_qos_key);
			enable_swap_slots_cache_max();
		} else {
		} else if (!sysctl_memcg_swap_qos_stat &&
				static_branch_likely(&memcg_swap_qos_key)) {
			static_branch_disable(&memcg_swap_qos_key);
		}
	}