mirror of https://lore.kernel.org/lkml/
 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>
Cc: <cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<chenridong@huaweicloud.com>
Subject: [PATCH v1 -next 0/3] Some optimizations about freezer
Date: Thu, 5 Sep 2024 13:41:27 +0000	[thread overview]
Message-ID: <20240905134130.1176443-1-chenridong@huawei.com> (raw)

We optimized the freezer to reduce redundant loops. We add a selftest to
ensure our optimizations cause no harm, and we confirmed that the
performance can be improved.

We tested the following subtree: D, E, F and G each have n children.
        A
       / \
      B   C
    / | \  \
    D E F   G
   /  |  \   \
 1-n 1-n 1-n  0-n

Our test is to freeze A B C D E F G, and then unfreeze A B C D E F G.
We measured the elapsed time.

	BEFORE(ns)	AFTER(ns)	SAVED(ns)
n=10	142679950	139666014	3,013,936
n=100	199832160	192773032	7,059,128
n=1000	488595100	414901570	73,693,530

As shown above, the larger the value of n, the more significant the time
savings can be. If tested with a deeper hierarchy, the difference could
become even more apparent.

Chen Ridong (3):
  cgroup/freezer: Reduce redundant traversal for cgroup_freeze
  cgroup/freezer: Reduce redundant propagation for
    cgroup_propagate_frozen
  cgroup/freezer: Add freeze selftest

 include/linux/cgroup-defs.h                   |   2 +-
 kernel/cgroup/freezer.c                       |  72 ++++++++----
 .../testing/selftests/cgroup/test_freezer.sh  | 111 ++++++++++++++++++
 3 files changed, 160 insertions(+), 25 deletions(-)
 create mode 100755 tools/testing/selftests/cgroup/test_freezer.sh

-- 
2.34.1


             reply	other threads:[~2024-09-05 13:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-05 13:41 Chen Ridong [this message]
2024-09-05 13:41 ` [PATCH v1 -next 1/3] cgroup/freezer: Reduce redundant traversal for cgroup_freeze Chen Ridong
2024-09-09 19:01   ` Michal Koutný
2024-09-10  2:39     ` Chen Ridong
2024-09-05 13:41 ` [PATCH v1 -next 2/3] cgroup/freezer: Reduce redundant propagation for cgroup_propagate_frozen Chen Ridong
2024-09-09 19:02   ` Michal Koutný
2024-09-10  3:08     ` Chen Ridong
2024-09-10 11:33       ` Michal Koutný
2024-09-05 13:41 ` [PATCH v1 -next 3/3] cgroup/freezer: Add freeze selftest Chen Ridong
2024-09-09 19:03   ` Michal Koutný
2024-09-10  3:09     ` Chen Ridong
2024-09-09 19:04 ` [PATCH v1 -next 0/3] Some optimizations about freezer Michal Koutný
2024-09-10  3:16   ` 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=20240905134130.1176443-1-chenridong@huawei.com \
    --to=chenridong@huawei.com \
    --cc=adityakali@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chenridong@huaweicloud.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®