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

trim cache parameters for low memory operation #1883

Merged
merged 4 commits into from
Jul 6, 2023
Merged

Commits on Jul 5, 2023

  1. strip runtime tests

    In an effort to minimize VM sizes, this change will cause runtime test
    executables to be stripped, saving unstripped binaries under the ".dbg"
    extension. The LDFLAGS and LIBS variables specified for each program are also
    duplicated for the debug build.
    wjhun committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    5ee944a View commit details
    Browse the repository at this point in the history
  2. trim cache parameters for low memory operation

    This change reduces baseline memory requirements for various memory caches
    under "low memory" conditions. If the function is_low_memory_machine() returns
    true, then the following parameters are trimmed:
    
    - the pagecache will use PAGECACHE_LOWMEM_CONTIGUOUS_PAGESIZE (default 128KB)
      as its objcache pagesize instead of PAGESIZE_2M
    - the mcache high order is lowered to 11 (2KB), thus forcing PAGESIZE or
      larger allocations to be made directly from the backing heap - and thus not
      cached, nor available for situations that implement a malloc/free interface
    - similiarly, allocations for lwIP are limited to a maximum size of 2KB
    wjhun committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    3425807 View commit details
    Browse the repository at this point in the history
  3. virtio_net: use minimal backing page sizes for caches

    Given that there is limited queueing within the network stack, we can
    reasonably predict that only up to virtqueue_entries(vn->rxq) rx buffers will
    need to be cached - and similarly for tx handler completions. This adjusts the
    objcache parent pagesizes to accommodate only these requirements, regardless
    of whether the machine is in a 'low memory' configuration.
    wjhun committed Jul 5, 2023
    Configuration menu
    Copy the full SHA
    1a398e2 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2023

  1. mcache: allow use of arbitrary sizes for malloc-style interface

    This modifies the mcache to allow using a malloc/free-style interface (where
    the allocation size is not specified on a free()) when allocation sizes exceed
    the largest objcache size. Such use would previously result in an error when
    attempting to free such large allocations. To accomplish this, the mcache now
    maintains a mapping of large allocation addresses to their corresponding
    sizes. When a deallocate with an unspecified (-1ull) size occurs, a table
    lookup/removal is made to check if the address corresponds to such a
    "fallback" allocation and, if so, recover the allocation size.
    
    The cost of using this fallback table is an insertion when making a
    fallback (large) allocation and a table lookup/removal when deallocating a
    fallback allocation of a known size, or on any deallocation (free) of an
    unknown size. This should not impact the vast majority of mcache uses, for
    which 1) the allocation size falls within the domain of the contained
    objcaches and 2) the size parameter is valid on deallocation.
    wjhun committed Jul 6, 2023
    Configuration menu
    Copy the full SHA
    cca7818 View commit details
    Browse the repository at this point in the history