Linux cgroups development
 help / color / mirror / Atom feed
From: Chen Ridong <chenridong@huawei.com>
To: <tj@kernel.org>, <lizefan.x@bytedance.com>, <hannes@cmpxchg.org>,
	<longman@redhat.com>, <adityakali@google.com>,
	<sergeh@kernel.org>, <mkoutny@suse.com>, <guro@fb.com>
Cc: <cgroups@vger.kernel.org>
Subject: [PATHC v3 -next 0/3] Some optimizations about freezer
Date: Sun, 15 Sep 2024 07:13:04 +0000	[thread overview]
Message-ID: <20240915071307.1976026-1-chenridong@huawei.com> (raw)

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(-)

-- 
2.34.1


             reply	other threads:[~2024-09-15  7:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-15  7:13 Chen Ridong [this message]
2024-09-15  7:13 ` [PATHC v3 -next 1/3] cgroup/freezer: Reduce redundant traversal for cgroup_freeze Chen Ridong
2024-09-25 17:29   ` Michal Koutný
2024-09-15  7:13 ` [PATHC v3 -next 2/3] cgroup/freezer: Add cgroup CGRP_FROZEN flag update helper Chen Ridong
2024-09-25 17:29   ` Michal Koutný
2024-09-15  7:13 ` [PATHC v3 -next 3/3] cgroup/freezer: Reduce redundant propagation for cgroup_propagate_frozen Chen Ridong
2024-09-25 17:46   ` Michal Koutný
2024-09-27  9:46     ` Chen Ridong
2024-10-08 12:16       ` Chen Ridong
2024-09-23  3:37 ` [PATHC v3 -next 0/3] Some optimizations about freezer chenridong
2024-09-23 15:36   ` Tejun Heo
2024-09-24  3:49     ` Chen Ridong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240915071307.1976026-1-chenridong@huawei.com \
    --to=chenridong@huawei.com \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=guro@fb.com \
    --cc=hannes@cmpxchg.org \
    --cc=lizefan.x@bytedance.com \
    --cc=longman@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=sergeh@kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox