Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9127330rwl; Wed, 11 Jan 2023 01:38:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXtMUziHsnefn/0cr7tYvxpaBc8yNShhxx3csQ9vBb+lZz1qy8z/1scFxBxYnHr8B1A1tVTD X-Received: by 2002:a05:6a20:3b9c:b0:ac:94a1:8afb with SMTP id b28-20020a056a203b9c00b000ac94a18afbmr64953051pzh.13.1673429914416; Wed, 11 Jan 2023 01:38:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673429914; cv=none; d=google.com; s=arc-20160816; b=jQxI+53MutQqWzlgjqMWDmPAjvvLW+rXOeDFmeZQWq4+wZQsFwI8/VPPzAScBR65PO 2/YHijYTMyReifDZ/LGforcrIKlbAc0ONMKmbmGcslRIourNPEfSODI6MXGVhJBBJ5Iy CJaau60BzSTup9cJeRA0K++N5edmEzsk2bVw4M+kqOC0WimxISUPouuTdgsRGdjNUbn3 laJzJoxOUY3l7RCdUvrjFENfOwZo7H6sF+t+RC4IrexuZcVAdI9VWL1QVrPutdvrKHtA U+lyjPI+238otNIbxvC523z2HxbamvL4zEv3iyjETpqf2/gwyVdCmuFnm3RM3Nhp0Iaz 6twA== 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=onH5sfG39fwD+Mmi6xMMtzzcmp2FhS3nYAe+d+/ViRY=; b=crPs+U4/UiKGqSgzkJXqGZnSwRVLFwv5ht2ZNDSaOb57iet1t2cmn1uyx7/6OGWPRJ rQaaCIAl4/V+hfys+zMebkpbwMcoVYl7fQGwolWZqC9ZdlL4fhjNUeGc+Fa1xcxL0Wo1 LgTi5wLARFX2rXxHyB8l2VcgNyXkYSs2n1Dgu5SM0iWL0q815Rzoar0aWYqgqmLB6nid u0mTMvvEMJdigqP6yG92vJsbLCm3MchMMiQvlq+2X4C5CsNpkyc++CW6Mco4ry3dKwG2 Ydubq2Lz9jLO8StaFtv73JdRwweul0Wn0YXo6//y0TyakFrq7pMeJRvJpCIRkAg6PNoB x4gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=aUnn0sLO; dkim=neutral (no key) header.i=@suse.cz header.b=gYtlr7sZ; 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 h71-20020a63834a000000b0047c9e9084c8si1605184pge.855.2023.01.11.01.38.27; Wed, 11 Jan 2023 01:38:34 -0800 (PST) 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=aUnn0sLO; dkim=neutral (no key) header.i=@suse.cz header.b=gYtlr7sZ; 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 S237663AbjAKJLK (ORCPT + 55 others); Wed, 11 Jan 2023 04:11:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238579AbjAKJKY (ORCPT ); Wed, 11 Jan 2023 04:10:24 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BEF1E0FE for ; Wed, 11 Jan 2023 01:07:06 -0800 (PST) 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 932BC76928; Wed, 11 Jan 2023 09:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1673428023; 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=onH5sfG39fwD+Mmi6xMMtzzcmp2FhS3nYAe+d+/ViRY=; b=aUnn0sLO/n8HWm87X3PIlmfeV/YwedWOESM3wdw4KoCGHlf6sWvHz0tdBYtF/YgF1kR8ER bw0/C7v3+uJiqBMp05P527KMWMA4L20UtV9QAZlbD0YBEX6PXyo5qCNrrxwaijCUmhykgY lPeHYs+BoZb6LozwcYn1PSA2fyKGCiQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1673428023; 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=onH5sfG39fwD+Mmi6xMMtzzcmp2FhS3nYAe+d+/ViRY=; b=gYtlr7sZ9aNVIb7O9yxuu6ww+1ObYjXkR3VcwjHlMIbcvt5aSV0e9VOPjA62EiewXBPkFx HiFh6YDKXQkBcKBg== 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 6A30713591; Wed, 11 Jan 2023 09:07:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kaA8GTd8vmN4WQAAMHmgww (envelope-from ); Wed, 11 Jan 2023 09:07:03 +0000 Message-ID: <8042dcd4-41e6-a18d-3899-8f6d2696068a@suse.cz> Date: Wed, 11 Jan 2023 10:07:03 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] mm/slab.c: Delete the if judgment and return the result directly Remove the if judgment and return the result directly to reduce assembly statements. Content-Language: en-US To: lvqian@nfschina.com, cl@linux.co, penberg@kernel.org, rientjes@google.com, kim@lge.com, akpm@linux-foundation.org, roman.gushchin@linux.dev, 42.hyeyoo@gmail.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20230111083102.111535-1-lvqian@nfschina.com> From: Vlastimil Babka In-Reply-To: <20230111083102.111535-1-lvqian@nfschina.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_SOFTFAIL 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 1/11/23 09:31, lvqian@nfschina.com wrote: > From: lvqian The subject line is long, e.g. the second sentence should be part of body, not subject. Note the usual wording is "if statement" not "judgement" > Remove the if judgment and return the result directly to reduce assembly statements. I'm pretty sure there will be no effect on generated code/assembly, so it should be purely about the C code readability. That's somewhat subjective, but I think it's acceptable in this case. > diff --git a/mm/slab.c b/mm/slab.c > index 7a269db050ee..713265fe2dea 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -1415,11 +1415,8 @@ static void kmem_rcu_free(struct rcu_head *head) > #if DEBUG > static bool is_debug_pagealloc_cache(struct kmem_cache *cachep) > { > - if (debug_pagealloc_enabled_static() && OFF_SLAB(cachep) && > - (cachep->size % PAGE_SIZE) == 0) > - return true; > - > - return false; > + return debug_pagealloc_enabled_static() && OFF_SLAB(cachep) && > + ((cachep->size % PAGE_SIZE) == 0); > } > > #ifdef CONFIG_DEBUG_PAGEALLOC