From patchwork Fri Jul 28 03:02:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baoquan He X-Patchwork-Id: 127304 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp174950vqg; Thu, 27 Jul 2023 20:53:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDriaZNHHwq0CG+NYzg7XI/h3Qtyzv45lUKXgrGEAZi7TG3Cn0Us9XpE3wLZc8ugnw2dne X-Received: by 2002:a05:6a00:14d2:b0:66c:2d4e:4772 with SMTP id w18-20020a056a0014d200b0066c2d4e4772mr635544pfu.13.1690516392278; Thu, 27 Jul 2023 20:53:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690516392; cv=none; d=google.com; s=arc-20160816; b=soHbG5h1AGZWhoWOciDhuqBwCZ7fKFQEEXO1EWzyBPHiDkooRis6gq4I15DLX3nHC7 bQ1V40OxjbCGjqbV2Q0GtMRZWV80bahzoZy4AzawG4G7ycremHA2zeio0sn9QZtakFxZ Q/Jhj/yxXARkwNXhtNdfu/BSJSIxYzWLxT2qc1MFlsaYIeqNYMp2gP9cFHoUyZc2I4P6 C+ZlsOy8PmRliXfGinIImNfABnM8Ker0VIiKRw6jdZK/ywYqhkXVNMWCgXMzaP4nBB0f /BhHgHpCKlvA2phC2yRMkj4HuHNS7z5i6SuxOQS0yOwteJrRXGDh6uufUVc2v1vmxWS/ JMzw== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a63134c000000b00563adcaab61si2278530pgt.865.2023.07.27.20.52.58; Thu, 27 Jul 2023 20:53:12 -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 S232862AbjG1DEX (ORCPT + 99 others); Thu, 27 Jul 2023 23:04:23 -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 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772634916463290419 X-GMAIL-MSGID: 1772634916463290419 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;