tools:cgroup:memcg_shrinker remove redundant import

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.

Link: https://lkml.kernel.org/r/20230108105023.4289-1-apantykhin@gmail.com
Signed-off-by: Alexander Pantyukhin <apantykhin@gmail.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
Alexander Pantyukhin 2023-01-08 15:50:23 +05:00 committed by Andrew Morton
parent b6f00c9190
commit d526643f15

View File

@ -5,7 +5,6 @@
import os import os
import argparse import argparse
import sys
def scan_cgroups(cgroup_root): def scan_cgroups(cgroup_root):
@ -44,7 +43,7 @@ def main():
cgroups = scan_cgroups("/sys/fs/cgroup/") cgroups = scan_cgroups("/sys/fs/cgroup/")
shrinkers = scan_shrinkers("/sys/kernel/debug/shrinker/") 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 n = 0
for s in shrinkers: for s in shrinkers: