Skip to content

cache_ext: Possible optimizations #2

Description

@yanniszark

Opening an issue to document future cache_ext optimizations for self-reference and also in case we need to explore them sooner:

  • Make kswapd work with cgroups. Initially this can be as simple as waking up kswapd when the cgroup memory gets low, since it already has logic for reclaiming from cgroups that exceed their soft limit. This removes reclaim from the critical path.
  • On eviction, grab folios and do the rest of the work without locking. Will probably need some kind of per-folio lock / bit. No reason to do this without the previous bullet, as it will only benefit us if eviction is not on the critical path.
  • On insert, batch folios in per-cpu arrays and batch-insert them instead of locking every time.
  • Remove the need for valid_folios_registry by instead taking a reference of the folio. Folios are refcounted for garbage collection so this just taps into existing infra. This won't make much difference until we also implement the next one though.
  • Keep folios of cache_ext-enabled cgroups in cache_ext lists, instead of having them still in the kernel's lists. This enables us to use the precious space of the list_head to implement the folio -> list_node mapping and completely remove the need for a hashtable.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions