diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-05-21 01:05:04 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-02-01 04:43:15 -0500 |
commit | 398477d41134ebe7551c917fcc2f56b7c3fdcec4 (patch) | |
tree | 562539f5f7c153f0e4d676a954d68d9d7fdfef24 | |
parent | 3927adefa7b1bd78aea405f2854348efdd7ec784 (diff) |
rhashtable: Better error message on allocation failure
Memory allocation failures print backtraces by default, but when we're
running out of a rhashtable worker the backtrace is useless - it doesn't
tell us which hashtable the allocation failure was for.
This adds a dedicated warning that prints out functions from the
rhashtable params, which will be a bit more useful.
Cc: Thomas Graf <tgraf@suug.ch>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | lib/rhashtable.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 6ae2ba8e06a2..b9c21fb6359b 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -190,8 +190,13 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht, nbuckets = 0; } - if (tbl == NULL) + if (tbl == NULL) { + pr_warn("rhashtable bucket table allocation failure for %ps\n", + (void *) ht->p.hashfn ?: + (void *) ht->p.obj_hashfn ?: + (void *) ht->p.obj_cmpfn); return NULL; + } lockdep_init_map(&tbl->dep_map, "rhashtable_bucket", &__key, 0); |