On 2024/9/15 15:13, Chen Ridong wrote:
I optimized the freezer to reduce redundant loops, and I add helper to make code concise. The following subtree was tested to prove whether my optimizations are effective. 0 / | \ \ A B C 1 / | \ \ A B C 2 ..... n / | \ A B C I tested by following steps: 1. freeze 0 2. unfreeze 0 3. freeze 0 4. freeze 1 And I measured the elapsed time(ns). n=10 freeze 0 unfreeze 0 freeze 0 freeze 1 BEFORE 106179390 94016050 110423650 95063770 AFTER 96473608 91054188 94936398 93198510 n=50 freeze 0 unfreeze 0 freeze 0 freeze 1 BEFORE 109506660 105643800 105970220 96948940 AFTER 105244651 97357482 97517358 88466266 n=100 freeze 0 unfreeze 0 freeze 0 freeze 1 BEFORE 127944210 122049330 120988900 101232850 AFTER 117298106 107034146 105696895 91977833 As shown above, after optimizations, it can save elapsed time. By freezing 0 and subsequently freezing 1, the elapsed time is consistent, indicating that my optimizations are highly effective. --- v3: - fix build warnings reported-by kernel test robot. v2: - open code inside the loop of cgroup_freeze instead of inline function. - add helper to make code concise. - remove selftest script(There are hierarchy test in test_freeze.c, I think that is enough for this series). Chen Ridong (3): cgroup/freezer: Reduce redundant traversal for cgroup_freeze cgroup/freezer: Add cgroup CGRP_FROZEN flag update helper cgroup/freezer: Reduce redundant propagation for cgroup_propagate_frozen include/linux/cgroup-defs.h | 6 +- kernel/cgroup/freezer.c | 110 ++++++++++++++++++------------------ 2 files changed, 59 insertions(+), 57 deletions(-)
Friendly ping. Best regards, Ridong