From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7909C4332F for ; Sun, 4 Dec 2022 12:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbiLDMMl (ORCPT ); Sun, 4 Dec 2022 07:12:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229753AbiLDMMh (ORCPT ); Sun, 4 Dec 2022 07:12:37 -0500 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 926AF17ABA for ; Sun, 4 Dec 2022 04:11:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670155894; 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: in-reply-to:in-reply-to:references:references; bh=1JxOufhWg2/q5pW/704na++qHz+lwSgqzP8cOwq2c60=; b=fDR4FQpwWwC9cbu6tG7AKw4SqKzP341qBxFy7XBiyefoC9Dfs+9KFiaqKn7Q20wjyVeUgP sUCoNQKMp64vno1lwjq0/hZNjES7KjPYCBEP8ns2cMEmhBGSNRdzvC1YCAT4geilC2NAiA o8Fe3AZKu2efEx3KGaorrKtlhswGALQ= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [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-75-5Kn7jIqNMaOlqQDvhbxhBg-1; Sun, 04 Dec 2022 07:11:29 -0500 X-MC-Unique: 5Kn7jIqNMaOlqQDvhbxhBg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 90F9F3C0D181; Sun, 4 Dec 2022 12:11:28 +0000 (UTC) Received: from localhost (ovpn-12-63.pek2.redhat.com [10.72.12.63]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 96A6E2166B29; Sun, 4 Dec 2022 12:11:27 +0000 (UTC) Date: Sun, 4 Dec 2022 20:11:23 +0800 From: Baoquan He To: Wupeng Ma Cc: akpm@linux-foundation.org, tj@kernel.org, dennis@kernel.org, cl@linux.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH -next 1/1] percpu: cleanup invalid assignment to err in pcpu_alloc Message-ID: References: <20221204031430.662169-1-mawupeng1@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221204031430.662169-1-mawupeng1@huawei.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/04/22 at 11:14am, Wupeng Ma wrote: > From: Ma Wupeng > > Assignment to err if is_atomic is true will never be used since warn > message can only be shown if is_atomic is false after label fail. So drop > it. > > Signed-off-by: Ma Wupeng > --- > mm/percpu.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/mm/percpu.c b/mm/percpu.c > index acd78da0493b..df86d79325b2 100644 > --- a/mm/percpu.c > +++ b/mm/percpu.c > @@ -1817,10 +1817,8 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved, > > spin_unlock_irqrestore(&pcpu_lock, flags); > > - if (is_atomic) { > - err = "atomic alloc failed, no space left"; > + if (is_atomic) > goto fail; > - } This is good catch. But I think Dennis may not like this way because he added the message intentionally in commit 11df02bf9bc1 ("percpu: resolve err may not be initialized in pcpu_alloc"). Can we change the conditional checking in fail part as below? diff --git a/mm/percpu.c b/mm/percpu.c index 27697b2429c2..0ac55500fad9 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1897,7 +1897,7 @@ 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();