VMAList splits smaps lines on whitespace and only keeps the mapping name when there are exactly six fields. Names containing whitespace, including paths with a (deleted) suffix, are therefore lost. Limit splitting to the five fixed fields and preserve the remaining name. Fixes: 2444172cfde4 ("tools/mm: add thpmaps script to dump THP usage info") Assisted-by: LLM Signed-off-by: Weilin Tong --- tools/mm/thpmaps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mm/thpmaps b/tools/mm/thpmaps index 30a8e915d677..a1a9bc30514f 100644 --- a/tools/mm/thpmaps +++ b/tools/mm/thpmaps @@ -198,7 +198,7 @@ class VMAList: self.vmas = [] with open(f'/proc/{pid}/smaps', 'r') as file: for line in file: - elements = line.split() + elements = line.rstrip('\n').split(maxsplit=5) if '-' in elements[0]: start, end = map(lambda x: int(x, 16), elements[0].split('-')) major, minor = map(lambda x: int(x, 16), elements[3].split(':')) -- 2.43.7