Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6835030rwd; Tue, 6 Jun 2023 02:37:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7rpM/M/hIlVKB7aHat4IAg9OhyM4RJQvmc8zSWE/Z06vqEtjYlnUVJ7jTrx+zkN/rzAHka X-Received: by 2002:ad4:4eea:0:b0:626:ece:5cee with SMTP id dv10-20020ad44eea000000b006260ece5ceemr1685377qvb.22.1686044238041; Tue, 06 Jun 2023 02:37:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686044238; cv=none; d=google.com; s=arc-20160816; b=N28AE5/Em9GReYCdbPm+/aOKeN+Po0rLIst/MaTPq5+6DKA7YMEwdw07NhzMCntx/a Y+GKcKBikK9nQqgBm0HkA2KbsNzuq/vo34xKSWRsS4DTPDPQXovOal2RgX4xHtlkKBjQ BLRB9V/GlHjp7cIwse/PZ9l9KnHEvq8yqThpnBpyoxJbiMCjRkedMfFBy/kg1QzMDEnO pbK3NVO8OruuThBiN9t2ctepUVptWCAtfbIoLBqfYHzOIFBkolipDbgtxj/ohIMg0vug YVSWxh5C/g28dAl+8wKgFH33Q0ovjl+WVDYOJF/6/nYtAB/fkL2Ah/8f4fvil+DD0vuq IuAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=uzifdbB9a65Ly0G3HQ1gDE5VXMzSADFqEAtU4sEv7kM=; b=ehJ4PPHitdYI0BUIuO7Mw4ERghN+YmLrp2SFA1RLeKkMb1t7fYBzz0aeRt5g//3Dxg 17a3akj0+NfjqSmfh/Y1yU+q5kuTZk9GT/Q0xYufRwHVUMdB+hRUvn3XKC63RdHN+tjX Vt5vmQ6QpMggf9uXbVXFxUS0a+lP6gArfo+eEdY9JpKQVG9t2k4Detbim92eiZ/OWlKY KIRwS8aK8SGQsLQsRTwpDtf7uMfMsl2mDxWfbEGzVHbJOWJeqClLgnAXuMbvAlopfVoM aFcwQ4q4rH6itm1sVJUNwZ6yKTgintA+2Z/WHxumV0w9B68YD/zAtzF98JZMciPPHGpT 5joA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=giUmbODm; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a056214212800b0062117ba718esi6292061qvc.560.2023.06.06.02.37.04; Tue, 06 Jun 2023 02:37:18 -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=@suse.cz header.s=susede2_rsa header.b=giUmbODm; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234742AbjFFIsf (ORCPT + 99 others); Tue, 6 Jun 2023 04:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231659AbjFFIsd (ORCPT ); Tue, 6 Jun 2023 04:48:33 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DBB6E8 for ; Tue, 6 Jun 2023 01:48:29 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id D47D81FD63; Tue, 6 Jun 2023 08:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1686041302; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uzifdbB9a65Ly0G3HQ1gDE5VXMzSADFqEAtU4sEv7kM=; b=giUmbODmna+vEGLAKAtlSKl6s+82si34njLk3JkeDYm0UXDA17+8bGXYeb+gO65R4BIE8K Z8L6efq7pmK4nYPtR9Ltm/A3UhdvWBbBHbyK60aj8+QZpahsmXrj87F6iW5k3eq8ad4cVW VLL5x06cRIROEeDURg3HET3VvUO7sTI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1686041302; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=uzifdbB9a65Ly0G3HQ1gDE5VXMzSADFqEAtU4sEv7kM=; b=JEeJiwIKT4nnDDq+tUejJ4DgkdMMwpIS1ufoFlyZYZaRsVyuv+3yQdSMbHd0rjSXt6QKkd qu8Zm8+hPkf7R5Ag== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id B12B613776; Tue, 6 Jun 2023 08:48:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id G92LKtbyfmS7PAAAMHmgww (envelope-from ); Tue, 06 Jun 2023 08:48:22 +0000 Message-ID: Date: Tue, 6 Jun 2023 10:48:22 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH] mm/slab_common: reduce an if statement in create_cache() Content-Language: en-US To: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Zhen Lei Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230606065543.1324-1-thunder.leizhen@huawei.com> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_PASS,T_SCC_BODY_TEXT_LINE,T_SPF_HELO_TEMPERROR,URIBL_BLOCKED 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 On 6/6/23 09:48, Hyeonggon Yoo wrote: > On Tue, Jun 06, 2023 at 02:55:43PM +0800, Zhen Lei wrote: >> Move the 'out:' statement block out of the successful path to avoid >> redundant check on 'err'. The value of 'err' is always zero on success >> and negative on failure. >> >> No functional changes, no performance improvements, just a little more >> readability. >> >> Signed-off-by: Zhen Lei >> --- >> mm/slab_common.c | 6 ++---- >> 1 file changed, 2 insertions(+), 4 deletions(-) >> >> diff --git a/mm/slab_common.c b/mm/slab_common.c >> index 607249785c077e9..f6fe35105774944 100644 >> --- a/mm/slab_common.c >> +++ b/mm/slab_common.c >> @@ -236,14 +236,12 @@ static struct kmem_cache *create_cache(const char *name, >> >> s->refcount = 1; >> list_add(&s->list, &slab_caches); >> -out: >> - if (err) >> - return ERR_PTR(err); >> return s; >> >> out_free_cache: >> kmem_cache_free(kmem_cache, s); >> - goto out; >> +out: >> + return ERR_PTR(err); >> } >> >> /** > > Hi Zhen, > nice cleanup! > > Looks correct to me, > Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Thanks, added to slab/for-6.5/cleanup >> -- >> 2.25.1 >> >