mm/percpu.c: print error message too if atomic alloc failed
authorBaoquan He <bhe@redhat.com>
Fri, 28 Jul 2023 03:02:55 +0000 (11:02 +0800)
committerDennis Zhou <dennis@kernel.org>
Fri, 25 Aug 2023 15:04:59 +0000 (08:04 -0700)
The variable 'err' is assgigned to an error message if atomic alloc
failed, while it has no chance to be printed if is_atomic is true.

Here change to print error message too if atomic alloc failed, while
avoid to call dump_stack() if that case.

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Dennis Zhou <dennis@kernel.org>
mm/percpu.c

index ab4ba2ac91c724747538d525bf4361fdfe3b23b4..a7665de8485fd9594c523c68ad579b1303e1c4ba 100644 (file)
@@ -1890,13 +1890,15 @@ fail_unlock:
 fail:
        trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align);
 
-       if (!is_atomic && do_warn && warn_limit) {
+       if (do_warn && warn_limit) {
                pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",
                        size, align, is_atomic, err);
-               dump_stack();
+               if (!is_atomic)
+                       dump_stack();
                if (!--warn_limit)
                        pr_info("limit reached, disable warning\n");
        }
+
        if (is_atomic) {
                /* see the flag handling in pcpu_balance_workfn() */
                pcpu_atomic_alloc_failed = true;