1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

Kernel: Make KBuffer lazily populated

KBuffers are now zero-filled on demand instead of up front. This means
that you can create a huge KBuffer and it will only take up VM, not
physical pages (until you access them.)
This commit is contained in:
Andreas Kling 2019-08-06 14:12:52 +02:00
parent a0bb592b4f
commit c973a51a23
3 changed files with 5 additions and 4 deletions

View file

@ -19,7 +19,7 @@ class KBufferImpl : public RefCounted<KBufferImpl> {
public:
static NonnullRefPtr<KBufferImpl> create_with_size(size_t size)
{
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), "KBuffer");
auto region = MM.allocate_kernel_region(PAGE_ROUND_UP(size), "KBuffer", false, false);
ASSERT(region);
return adopt(*new KBufferImpl(*region, size));
}