diff options
| author | Warren Xiong <warren.xiong@ugreen.com> | 2026-08-04 20:16:58 +0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-08-24 18:43:01 -0700 |
| commit | 8bc69b8d209f2c08b8a311e63b910b8a718eee79 (patch) | |
| tree | 8c466fcfba59543c5744f3a404f1769b0770b626 /tools/perf/scripts/python | |
| parent | 4e7e499b750f0ba1806a9f60ad091364c3382ad1 (diff) | |
selftests/mm: read memory information without popen
read_memory_info() invokes two shell pipelines to obtain MemFree and
Hugepagesize from /proc/meminfo. It does not check whether popen()
returns NULL before passing the result to fgets(), and it does not call
pclose() when fgets() fails.
Open /proc/meminfo directly and obtain both values in a single pass. This
removes the unchecked NULL path, closes the file on all paths, and avoids
dependencies on external commands.
The compaction test continues to pass after this change.
Link: https://lore.kernel.org/1785845818-3131-1-git-send-email-warren.xiong@ugreen.com
Signed-off-by: Warren Xiong <warren.xiong@ugreen.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Cc: Liam R. Howlett <liam@infradead.org>
Cc: Lorenzo Stoakes <ljs@kernel.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions
