]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - lib/rhashtable.c
x86: provide an init_mem_mapping hypervisor hook
[karo-tx-linux.git] / lib / rhashtable.c
index d9e7274a04cd98d14456b1bba9ad2e241eae8895..707ca5d677c676a599442604d918c215d7709138 100644 (file)
@@ -211,11 +211,10 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
        int i;
 
        size = sizeof(*tbl) + nbuckets * sizeof(tbl->buckets[0]);
-       if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER) ||
-           gfp != GFP_KERNEL)
+       if (gfp != GFP_KERNEL)
                tbl = kzalloc(size, gfp | __GFP_NOWARN | __GFP_NORETRY);
-       if (tbl == NULL && gfp == GFP_KERNEL)
-               tbl = vzalloc(size);
+       else
+               tbl = kvzalloc(size, gfp);
 
        size = nbuckets;
 
@@ -235,7 +234,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
 
        INIT_LIST_HEAD(&tbl->walkers);
 
-       get_random_bytes(&tbl->hash_rnd, sizeof(tbl->hash_rnd));
+       tbl->hash_rnd = get_random_u32();
 
        for (i = 0; i < nbuckets; i++)
                INIT_RHT_NULLS_HEAD(tbl->buckets[i], ht, i);