* [PATCH] tools:cgroup:memcg_shrinker remove redundant import
@ 2023-01-08 10:50 Alexander Pantyukhin
0 siblings, 0 replies; only message in thread
From: Alexander Pantyukhin @ 2023-01-08 10:50 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, roman.gushchin, Alexander Pantyukhin
Remove redundant import of the sys module.
Also use the sort function instead of sorted.
It sorts the direct array without create the new one in memory.
Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
---
tools/cgroup/memcg_shrinker.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/tools/cgroup/memcg_shrinker.py b/tools/cgroup/memcg_shrinker.py
index 706ab27666a4..e81c3017ada9 100644
--- a/tools/cgroup/memcg_shrinker.py
+++ b/tools/cgroup/memcg_shrinker.py
@@ -5,7 +5,6 @@
import os
import argparse
-import sys
def scan_cgroups(cgroup_root):
@@ -44,7 +43,7 @@ def main():
cgroups = scan_cgroups("/sys/fs/cgroup/")
shrinkers = scan_shrinkers("/sys/kernel/debug/shrinker/")
- shrinkers = sorted(shrinkers, reverse = True, key = lambda x: x[0])
+ shrinkers.sort(reverse = True, key = lambda x: x[0])
n = 0
for s in shrinkers:
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-01-08 10:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-08 10:50 [PATCH] tools:cgroup:memcg_shrinker remove redundant import Alexander Pantyukhin
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®