Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp689243rwb; Thu, 27 Jul 2023 20:47:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLILXZqpNDCMM4L3ReAZzDS1c/ibnMYLruGd76+Qb2AmkY59tyV9T+CjrMbDO2ylJC79vn X-Received: by 2002:a50:fc16:0:b0:522:5570:69be with SMTP id i22-20020a50fc16000000b00522557069bemr836662edr.19.1690516034997; Thu, 27 Jul 2023 20:47:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690516034; cv=none; d=google.com; s=arc-20160816; b=blxTRURhL+GfJ1zO5MfJwAGFp5p3VBiA7lSCEekdH+BQFsMFG8v4OAk/8mi+ZIYRe1 m8tyBAs0a45M90tyfYdSvVyy3TPxI4EMoKJEZ5ooVabGsUnVmeMtko8eWYCsj+6B1cly 4617rReSpal6ZVojD82vEibWCpSxUPzhdCXU8mglXoqtuZVE8lNiQSoWFf7GHHuEc0WA 3bRM30TW5L4Up88YjcjPagIYvQ/lP4k5atWrfHtyqNPYGwPTNWi/P58to59WpDIaCWgQ zk85q6B7/CTymiFo17olmmKHs1nm1tfp877IXxYDOfroRy2l6nnND5cqDvfck81+Zl9t Xvvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=w7A8DUBQAAPdvxITFYdrC5cFY9Ke6WrqD74ZBOps/Ko=; fh=S5C58ZG9uMUqzGJB+EUhh8nuN6bxXvQEsWHn3hlSpOw=; b=tJ+1XvEbLSRaKAt8B5JZgGWKQ8jXBWTl1dMHtp7NbfgXme5ZBq4Bq2036K0N/e9g6b mgQAthdNecXq1eg4nbwdG4mfHUHgl4qdZXPe1bjSajDLvoaLJbc99KPplbEau/MA3XHB cBGMsilYcx7gOiqa1w9+B81IRKi7HcLU3kZuQyGtRWKhpeKBzf05O9kIySUjgNQ2TD6s ZBHQNz5XjEZJ2d6uzaCRjqO9Zp8AKJI0ZuV+a0ZzlsdJSXQOXObw322bujDu7hKmo/qG gSm4JbHauc91BCQL5f7Wofjwe0dR6fsR32o7dLlLV0RLY34C8hIFejkGw2413B8FKW01 +kpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dQIdjmNa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020aa7d845000000b0051e28ec9d30si1768878eds.665.2023.07.27.20.46.50; Thu, 27 Jul 2023 20:47:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dQIdjmNa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232667AbjG1DEW (ORCPT + 99 others); Thu, 27 Jul 2023 23:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbjG1DEO (ORCPT ); Thu, 27 Jul 2023 23:04:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1950D2688 for ; Thu, 27 Jul 2023 20:03:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690513387; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=w7A8DUBQAAPdvxITFYdrC5cFY9Ke6WrqD74ZBOps/Ko=; b=dQIdjmNaXQBjynIT4NDdnRFcwUOMQjbQQ3O82u+XSHyeqT+u2vsBDLkdsmjXEExxCkFroD +FTcEafT2oK2H4Vr952hhFxD06MdLbcW09tHDrep+M+DMo0/MGB5fma+yZzY9g7xOo9gbk GdELumHIswqYqKu296szoTPUEIXfu7I= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-Y4PCtH-HO6qgImkgM0He2w-1; Thu, 27 Jul 2023 23:03:03 -0400 X-MC-Unique: Y4PCtH-HO6qgImkgM0He2w-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08B2C1C0725A; Fri, 28 Jul 2023 03:03:03 +0000 (UTC) Received: from MiWiFi-R3L-srv.redhat.com (unknown [10.72.112.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E07440C2063; Fri, 28 Jul 2023 03:03:00 +0000 (UTC) From: Baoquan He To: linux-kernel@vger.kernel.org, dennis@kernel.org Cc: linux-mm@kvack.org, Baoquan He Subject: [PATCH v2] mm/percpu.c: print error message too if atomic alloc failed Date: Fri, 28 Jul 2023 11:02:55 +0800 Message-Id: <20230728030255.8458-1-bhe@redhat.com> MIME-Version: 1.0 Content-type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- v1->v2: Fix the code bug in v1 pointed out by Dennis. mm/percpu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/percpu.c b/mm/percpu.c index 83fc47206680..bdca8ec33d49 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1890,13 +1890,15 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, 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; -- 2.34.1