• A
    compat_ioctl: simplify lookup table · 661f627d
    Arnd Bergmann 提交于
    The compat_ioctl table now only contains entries for
    COMPATIBLE_IOCTL, so we only need to know if a number
    is listed in it or now.
    
    As an optimization, we hash the table entries with a
    reversible transformation to get a more uniform distribution
    over it, sort the table at startup and then guess the
    position in the table when an ioctl number gets called
    to do a linear search from there.
    
    With the current set of ioctl numbers and the chosen
    transformation function, we need an average of four
    steps to find if a number is in the set, all of the
    accesses within one or two cache lines.
    
    This at least as good as the previous hash table
    approach but saves 8.5 kb of kernel memory.
    Signed-off-by: NArnd Bergmann <arnd@arndb.de>
    661f627d
compat_ioctl.c 55.2 KB