Skip to content
  • Phil Sutter's avatar
    lib: test_rhashtable: fix for large entry counts · e859afe1
    Phil Sutter authored
    During concurrent access testing, threadfunc() concatenated thread ID
    and object index to create a unique key like so:
    
    | tdata->objs[i].value = (tdata->id << 16) | i;
    
    This breaks if a user passes an entries parameter of 64k or higher,
    since 'i' might use more than 16 bits then. Effectively, this will lead
    to duplicate keys in the table.
    
    Fix the problem by introducing a struct holding object and thread ID and
    using that as key instead of a single integer type field.
    
    Fixes: f4a3e90b
    
     ("rhashtable-test: extend to test concurrency")
    Reported by: Manuel Messner <mm@skelett.io>
    Signed-off-by: default avatarPhil Sutter <phil@nwl.cc>
    Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e859afe1