lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri,  8 Mar 2019 15:14:11 +1100
From:   "Tobin C. Harding" <tobin@...nel.org>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     "Tobin C. Harding" <tobin@...nel.org>,
        Christopher Lameter <cl@...ux.com>,
        Pekka Enberg <penberg@...helsinki.fi>,
        Matthew Wilcox <willy@...radead.org>,
        Tycho Andersen <tycho@...ho.ws>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: [RFC 00/15] mm: Implement Slab Movable Objects (SMO)

Hi,

Here is a patch set implementing movable objects within the SLUB
allocator.  This is work based on Christopher's patch set:

 https://lore.kernel.org/patchwork/project/lkml/list/?series=377335

The original code logic is from that set and implemented by Christopher.
Clean up, refactoring, documentation, and additional features by myself.
Blame for any bugs remaining falls solely with myself.  Patches using
Christopher's code use the Co-developed-by tag.

After movable objects are implemented a number of useful features become
possible.  Some of these are implemented in this series, including:

 - Cache defragmentation.	   

    Currently the SLUB allocator is susceptible to internal
    fragmentation.  This occurs when a large number of cached objects
    are allocated and then freed in an arbitrary order.  As the cache
    fragments the number of pages used by the partial slabs list
    increases.  This wastes memory.

    Patch set implements the machinery to facilitate conditional cache
    defragmentation (via kmem_cache_defrag()) and unconditional
    defragmentation (via kmem_cache_shrink()).  Various sysfs knobs are
    provided to interact with and configure this.

    Patch set implements movable objects and cache defragmentation for
    the XArray.

 - Moving objects to and from a specific NUMA node.

 - Balancing objects across all NUMA nodes.

We add a test module to facilitate playing around with movable objects
and a python test suite that uses the module.

Everything except the NUMA stuff was tested on bare metal, the NUMA
stuff was tested with Qemu NUMA emulation.

Possible further work:

1. Implementing movable objects for the inode and dentry caches.

2. Tying into the page migration and page defragmentation logic so that
   so far unmovable pages that are in the way of creating a contiguous
   block of memory will become movable.  This would mean checking for
   slab pages in the migration logic and calling slab to see if it can
   move the page by migrating all objects.


Patch 1-4 - Implement Slab Movable Objects.
Patch 5-9 - Implement slab cache defragmentation.
Patch 10 - Adds the test module.
Patch 11 - Adds the test suite.
Patch 12-13 - Adds object migration to the XArray (and test code).
Patch 14 - Adds moving objects to and from a specified NUMA node.
Patch 15 - Adds object balancing across all NUMA nodes.

Patch 12 introduces an build warning, I tried a bunch of things and I
couldn't work out what it should be.

  linux/lib/xarray.c:1961:16: warning: comparison between pointer and
  zero character constant [-Wpointer-compare] 
    if (!xa || xa == XA_FREE_MARK)
                ^~
  linux/lib/xarray.c:1961:13: note: did you mean to dereference the pointer?
    if (!xa || xa == XA_FREE_MARK)

Perhaps you will put me out of my misery Willy and just tell me what its
supposed to be.

Patch 14 and 15 are particularly early stage (I hacked those :) 

thanks,
Tobin.


Tobin C. Harding (15):
  slub: Create sysfs field /sys/slab/<cache>/ops
  slub: Add isolate() and migrate() methods
  tools/vm/slabinfo: Add support for -C and -F options
  slub: Enable Slab Movable Objects (SMO)
  slub: Sort slab cache list
  tools/vm/slabinfo: Add remote node defrag ratio output
  slub: Add defrag_used_ratio field and sysfs support
  tools/vm/slabinfo: Add defrag_used_ratio output
  slub: Enable slab defragmentation using SMO
  tools/testing/slab: Add object migration test module
  tools/testing/slab: Add object migration test suite
  xarray: Implement migration function for objects
  tools/testing/slab: Add XArray movable objects tests
  slub: Enable move _all_ objects to node
  slub: Enable balancing slab objects across nodes

 Documentation/ABI/testing/sysfs-kernel-slab |  14 +
 include/linux/slab.h                        |  70 ++
 include/linux/slub_def.h                    |  10 +
 lib/radix-tree.c                            |  13 +
 lib/xarray.c                                |  44 ++
 mm/Kconfig                                  |   7 +
 mm/slab_common.c                            |   6 +-
 mm/slub.c                                   | 800 ++++++++++++++++++--
 tools/testing/slab/Makefile                 |  10 +
 tools/testing/slab/slub_defrag.c            | 567 ++++++++++++++
 tools/testing/slab/slub_defrag.py           | 451 +++++++++++
 tools/testing/slab/slub_defrag_xarray.c     | 211 ++++++
 tools/vm/slabinfo.c                         |  51 +-
 13 files changed, 2172 insertions(+), 82 deletions(-)
 create mode 100644 tools/testing/slab/Makefile
 create mode 100644 tools/testing/slab/slub_defrag.c
 create mode 100755 tools/testing/slab/slub_defrag.py
 create mode 100644 tools/testing/slab/slub_defrag_xarray.c

-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ