diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-21 12:28:01 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-21 20:22:48 +0100 |
commit | c0deafe457450b896a3951d0ce40bd35a72e750e (patch) | |
tree | 49be75899e0bb0cb135b172a109f11c6ebd6a1dc /Kernel/Coredump.cpp | |
parent | e1779b064a8f8967ee11bf3dacff453b426f59fa (diff) | |
download | serenity-c0deafe457450b896a3951d0ce40bd35a72e750e.zip |
Kernel: Avoid repeated memory zeroing while generating coredumps
Reuse the same buffer-full-of-zeroes for every un-paged-in page that we
dump out.
Diffstat (limited to 'Kernel/Coredump.cpp')
-rw-r--r-- | Kernel/Coredump.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Coredump.cpp b/Kernel/Coredump.cpp index 85fda720fd..d2014a72f1 100644 --- a/Kernel/Coredump.cpp +++ b/Kernel/Coredump.cpp @@ -167,6 +167,8 @@ ErrorOr<void> Coredump::write_program_headers(size_t notes_size) ErrorOr<void> Coredump::write_regions() { + u8 zero_buffer[PAGE_SIZE] = {}; + for (auto& region : m_process->address_space().regions()) { VERIFY(!region->is_kernel()); @@ -180,8 +182,6 @@ ErrorOr<void> Coredump::write_regions() for (size_t i = 0; i < region->page_count(); i++) { auto* page = region->physical_page(i); - - uint8_t zero_buffer[PAGE_SIZE] = {}; auto src_buffer = [&]() -> ErrorOr<UserOrKernelBuffer> { if (page) return UserOrKernelBuffer::for_user_buffer(reinterpret_cast<uint8_t*>((region->vaddr().as_ptr() + (i * PAGE_SIZE))), PAGE_SIZE); |