diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-05-21 01:05:04 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-11-12 00:36:55 -0500 |
commit | afc383b6c0368029fb2e87d5177288f2dcb1c62b (patch) | |
tree | a2ac03d6aa3ecab00498699a60f9e38eba565ab4 | |
parent | 937035548302fcfd964b94ffb1c1b80070d78ae1 (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.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Thomas Graf <tgraf@suug.ch>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | lib/rhashtable.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rhashtable.c b/lib/rhashtable.c index 6ae2ba8e06a2..d3fce9c8989a 100644 --- a/lib/rhashtable.c +++ b/lib/rhashtable.c @@ -360,9 +360,14 @@ static int rhashtable_rehash_alloc(struct rhashtable *ht, ASSERT_RHT_MUTEX(ht); - new_tbl = bucket_table_alloc(ht, size, GFP_KERNEL); - if (new_tbl == NULL) + new_tbl = bucket_table_alloc(ht, size, GFP_KERNEL|__GFP_NOWARN); + if (new_tbl == NULL) { + WARN("rhashtable bucket table allocation failure for %ps", + (void *) ht->p.hashfn ?: + (void *) ht->p.obj_hashfn ?: + (void *) ht->p.obj_cmpfn); return -ENOMEM; + } err = rhashtable_rehash_attach(ht, old_tbl, new_tbl); if (err) |