• H
    rhashtable: Add nested tables · da20420f
    Herbert Xu 提交于
    This patch adds code that handles GFP_ATOMIC kmalloc failure on
    insertion.  As we cannot use vmalloc, we solve it by making our
    hash table nested.  That is, we allocate single pages at each level
    and reach our desired table size by nesting them.
    
    When a nested table is created, only a single page is allocated
    at the top-level.  Lower levels are allocated on demand during
    insertion.  Therefore for each insertion to succeed, only two
    (non-consecutive) pages are needed.
    
    After a nested table is created, a rehash will be scheduled in
    order to switch to a vmalloced table as soon as possible.  Also,
    the rehash code will never rehash into a nested table.  If we
    detect a nested table during a rehash, the rehash will be aborted
    and a new rehash will be scheduled.
    Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    da20420f
rhashtable.h 37.3 KB