Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pagecache: use an objcache as page heap #1757

Merged
merged 4 commits into from
Aug 6, 2022
Merged

Commits on Aug 6, 2022

  1. Memory management: add generic memory cleaner interface

    With this change, it is possible to register different "memory
    cleaner" closures, which will be invoked to free up memory when the
    system is low on available physical memory. The virtio balloon
    deflater and the pagecache drain function have been converted to
    use this interface.
    
    Partially addresses #1130.
    francescolavra committed Aug 6, 2022
    Configuration menu
    Copy the full SHA
    a5df851 View commit details
    Browse the repository at this point in the history
  2. objcache foreach_page_footer: refactor to allow removal from list

    This macro is being amended so that it is possible to remove a page
    list element from within the loop that walks the list. This will be
    needed to implement the cache drain functionality.
    francescolavra committed Aug 6, 2022
    Configuration menu
    Copy the full SHA
    fef47c8 View commit details
    Browse the repository at this point in the history
  3. Objcache: add locking option and drain functionality

    This change introduces a new heap sub-type, called caching_heap,
    that exports an additional callback to drain memory that has been
    cached. The objcache heap is now a caching_heap.
    In addition, the objcache heap now implements locking, which allows
    safe use of the drain functionality in concurrently accessed heaps
    without the need for an external lock.
    Memory cleaner instances have been added in various places where an
    objcache is used, so that caching heaps can be drained when the
    system is low on memory.
    
    Partially addresses #1494.
    francescolavra committed Aug 6, 2022
    Configuration menu
    Copy the full SHA
    ffd6df3 View commit details
    Browse the repository at this point in the history
  4. Pagecache: use an objcache as page heap

    In the pagecache code, allocating 4KB pages directly from the
    linear backed heap creates excessive fragmentation, which in
    low-memory conditions may cause other allocations in the kernel
    (which typically use objcaches with a 2MB page size) to fail even
    when pagecache drain requests are fully executed.
    This commit addresses the fragmentation issue by changing the
    pagecache code to use an objcache (with a 2MB page size, and with
    the linear backed heap as parent heap) as page heap; this allows a
    pagecache drain to release memory in large chunks that are then
    available for other allocation requests throughout the kernel.
    In addition, the pagecache completion heap is now drained if a
    drain request could not be fully executed by draining the page
    heap.
    francescolavra committed Aug 6, 2022
    Configuration menu
    Copy the full SHA
    22add9b View commit details
    Browse the repository at this point in the history