diff options
| author | Chen Wandun <[email protected]> | 2021-09-02 14:56:52 -0700 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2021-09-03 09:58:14 -0700 |
| commit | 5e22928abe671ea1541f19afb80523442938d342 (patch) | |
| tree | df069aa66121681aff125627899b8dea51457020 /tools/perf/scripts/python/exported-sql-viewer.py | |
| parent | 9b593cb20283e68e5e65b09ca10038935297f05b (diff) | |
mm/mremap: fix memory account on do_munmap() failure
mremap will account the delta between new_len and old_len in
vma_to_resize, and then call move_vma when expanding an existing memory
mapping. In function move_vma, there are two scenarios when calling
do_munmap:
1. move_page_tables from old_addr to new_addr success
2. move_page_tables from old_addr to new_addr fail
In first scenario, it should account old_len if do_munmap fail, because
the delta has already been accounted.
In second scenario, new_addr/new_len will assign to old_addr/old_len if
move_page_table fail, so do_munmap is try to unmap new_addr actually, if
do_munmap fail, it should account the new_len, because error code will be
return from move_vma, and delta will be unaccounted. What'more, because
of new_len == old_len, so account old_len also is OK.
In summary, account old_len will be correct if do_munmap fail.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: 51df7bcb6151 ("mm/mremap: account memory on do_munmap() failure")
Signed-off-by: Chen Wandun <[email protected]>
Acked-by: Dmitry Safonov <[email protected]>
Cc: Kefeng Wang <[email protected]>
Cc: Wei Yongjun <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/exported-sql-viewer.py')
0 files changed, 0 insertions, 0 deletions