Commit 326017c7 authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

perf: net_dropmonitor: Do not assume ordering of dictionaries

The sort order of dictionaries in Python is undocumented.  Use
tuples instead, which are documented to be lexically ordered.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5a1e99dd
...@@ -32,7 +32,7 @@ def get_kallsyms_table(): ...@@ -32,7 +32,7 @@ def get_kallsyms_table():
j = j +1 j = j +1
if ((j % 100) == 0): if ((j % 100) == 0):
print "\r" + str(j) + "/" + str(linecount), print "\r" + str(j) + "/" + str(linecount),
kallsyms.append({ 'loc': loc, 'name' : name}) kallsyms.append((loc, name))
print "\r" + str(j) + "/" + str(linecount) print "\r" + str(j) + "/" + str(linecount)
kallsyms.sort() kallsyms.sort()
...@@ -40,9 +40,9 @@ def get_kallsyms_table(): ...@@ -40,9 +40,9 @@ def get_kallsyms_table():
def get_sym(sloc): def get_sym(sloc):
loc = int(sloc) loc = int(sloc)
for i in kallsyms[::-1]: for symloc, name in kallsyms[::-1]:
if loc >= i['loc']: if loc >= symloc:
return (i['name'], loc - i['loc']) return (name, loc - symloc)
return (None, 0) return (None, 0)
def print_drop_table(): def print_drop_table():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment