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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55323C4332F for ; Mon, 5 Dec 2022 02:24:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8371C8E0002; Sun, 4 Dec 2022 21:24:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E7998E0001; Sun, 4 Dec 2022 21:24:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 687D18E0002; Sun, 4 Dec 2022 21:24:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 563358E0001 for ; Sun, 4 Dec 2022 21:24:27 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 26CEDC018C for ; Mon, 5 Dec 2022 02:24:27 +0000 (UTC) X-FDA: 80206658574.21.B771F80 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf07.hostedemail.com (Postfix) with ESMTP id C391F4000D for ; Mon, 5 Dec 2022 02:24:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=W7XqjE7G; spf=pass (imf07.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1670207066; a=rsa-sha256; cv=none; b=SgmDvgRUAfZcoAK8wJVMvetkeLCdT6clCNmw3PKH1B7c7QigKl9bGl8bKsA7JUNHkblVjc b96sO2Xy3VFYElV8gfSlBAfkutrbtKk8H1HHOpkDcJ+mfpGVnkVzH+PzhrDi4X62FDSk+s gQhNeswAQu2Klf6JkpiDA6dZYosvP3I= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=W7XqjE7G; spf=pass (imf07.hostedemail.com: domain of bhe@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bhe@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1670207066; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=fIaB1bH370BEUQX73UCqoL58l3sUZhXEOj98H8aVE+Y=; b=hSgYMDzeys7ZobriADzhDeqPU+C5stAePUWKTUu1XWXx/02Vp8ldltcUGn9HxfbA0XPQq4 j+PNvtzU6WXrFypbV2XYkcMqLTX3hDsF83w6gEvGMctVImapYdwj4stl5QiRUAOVDKq7yf 8CmGZkVA8jy10uB7le/fUFyRwUCMLHA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670207066; 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=fIaB1bH370BEUQX73UCqoL58l3sUZhXEOj98H8aVE+Y=; b=W7XqjE7Gr7ffwKKyCCQkPvsy82FW3CVI9iuuwvfEYhTJtBuf95xt06meXoZj2csZDhU22b ywQtvqghdUcPAsi7PzJ4GmMFKA01CCKgEwDFVZqoKr/1dXRraT4AciR5h6MNHHgRCyeG4d UuPiylDwtOmBcvONS0cgmteJPX0Aqcw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-489-xWZIlQsxOoGY0rCuJwFsRQ-1; Sun, 04 Dec 2022 21:24:25 -0500 X-MC-Unique: xWZIlQsxOoGY0rCuJwFsRQ-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8B56E85A59D; Mon, 5 Dec 2022 02:24:24 +0000 (UTC) Received: from localhost (ovpn-12-86.pek2.redhat.com [10.72.12.86]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B502A1759E; Mon, 5 Dec 2022 02:24:23 +0000 (UTC) Date: Mon, 5 Dec 2022 10:24:20 +0800 From: Baoquan He To: Dennis Zhou Cc: Wupeng Ma , akpm@linux-foundation.org, tj@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: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spamd-Result: default: False [-4.54 / 9.00]; BAYES_HAM(-5.14)[98.07%]; SUBJECT_HAS_UNDERSCORES(1.00)[]; DMARC_POLICY_ALLOW(-0.50)[redhat.com,none]; MID_RHS_NOT_FQDN(0.50)[]; R_SPF_ALLOW(-0.20)[+ip4:170.10.129.0/24]; R_DKIM_ALLOW(-0.20)[redhat.com:s=mimecast20190719]; RCVD_NO_TLS_LAST(0.10)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[7]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; FROM_HAS_DN(0.00)[]; DKIM_TRACE(0.00)[redhat.com:+]; TO_DN_SOME(0.00)[]; ARC_SIGNED(0.00)[hostedemail.com:s=arc-20220608:i=1]; TC_DOMAIN_MIX_CASE(0.00)[] X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C391F4000D X-Stat-Signature: cp889j875ysmb8jknk5ojoeg8j9tditg X-HE-Tag: 1670207066-260409 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 12/04/22 at 04:30pm, Dennis Zhou wrote: > Hi Baoquan and Wupeng, > > On Sun, Dec 04, 2022 at 08:11:23PM +0800, Baoquan He wrote: > > 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"). > > > > You're right Baoquan haha. I agree with Christoph as well we should > surface atomic. > > Though I don't think below is quite right either. We should likely have > a separate warn_limit for atomic and I need to think about dump_stack() > if there are any requirements there. Yeah, sounds reasonable. I didn't think it over. > > > > 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(); > > >