• James Morris's avatar
    [PATCH] SELinux scalability: convert AVC to RCU · 6575328c
    James Morris authored
    The following patch improves the scalability of SELinux by replacing the
    global avc_lock with an RCU based scheme by Kaigai Kohei.  The size of the
    cache is made tunable, to allow administrators to tune systems for different
    workloads, while statistics are exported via selinuxfs to allow AVC
    performance to be monitored at a low level.
    
    AVC nodes are also allocated now via a slab cache, and AVC references have
    been removed from the code.
    
    This code has been extensively tested and benchmarked (see benchmark results
    below).  Baseline performance is not improved, although it is clear that
    dramatic scalability improvements are achieved.
    
    Baseline performance and networking scalability are areas where work is
    ongoing (in particular, we need to add caching of some network security
    objects so that we don't fallback to policy database lookups on each
    permission call).
    
    Benchmark results:
    
    ===============================================================================================
    
    System: 4 node 16-way IA64 NUMA
    
    - 'Stream' is based on http://www.cs.virginia.edu/stream/ , HPC memory bandwidth test,
      higher result is better.
    - Hackbench: scheduler scalability benchmark by Rusty, lower is better.
    
    Standard kernel:
      2.6.9-1.648_EL  SELINUX=0 : Stream 6159.987MB/s HackBench 53.144
      2.6.9-1.648_EL  SELINUX=1 : Stream 5872.529MB/s HackBench 1043.132
    
    Kernel with RCU/AVC patches:
      2.6.9-1.689_avcrcu.root SELINUX=0 : Stream 8829.647MB/s HackBench 53.976
      2.6.9-1.689_avcrcu.root SELINUX=1 : Stream 8817.117MB/s HackBench 50.975
    
    ===============================================================================================
    
    System: 8-way PIII 900Mhz Xeon with 9GB RAM
    Fileystem: ext2 for all testing.
    
    Notes:
        AVC was reset before tests, so avc was flushed.
        System was run in enforcing mode.
    
    Key:
        std-nolsm:      standard kernel with LSM disabled
        std-lsmcap:     standard kernel with LSM enabled, capabilities LSM
        std-sel-strict: standard kernel with SELinux enabled, capabilities secondary LSM
        rcu-sel-strict: as above with RCU & AVC stats patches
    6575328c
selinuxfs.c 21 KB