Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp226225iog; Wed, 15 Jun 2022 00:38:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJlhNfjBy+lnoyrvAm6XwGhsWqcWmcF/imQdoK/ARYkcR7BFDTbTyejotd1+8lN/mp3Bgl X-Received: by 2002:a17:907:6e90:b0:711:cb3c:8c1a with SMTP id sh16-20020a1709076e9000b00711cb3c8c1amr7934711ejc.516.1655278714408; Wed, 15 Jun 2022 00:38:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655278714; cv=none; d=google.com; s=arc-20160816; b=fEss6GXGdtMlygVW5cTlAEE3q0/hrR4tbZ2MSYn8+3XeaE9GFEOdVVYzBNDodv2iS+ 4/zuX2HGqYS5T+gweeFpspet/9NL5s47JuP5uGuIVcQgKIj3LOVqnr5XkBLDUYOiZVXC WTmF4f4AKaGOq176PBgD4eJaWpf4qpUuypLBmEIbL8IjaR5lPn2dgighhbsPYij6YePb ZMVWOmWakce8IKIPQyPT7WHZWQCSL1y33aGDHVmrUDtRCJqWdDIBXxmzBkJIvyT/WPGC LSKUGjWy7f75Ak8QwD97xQFtjM35HEBazEw9jmPaJxB8e4T7g7jiZc6IZko7SIJ9L+oJ ijJw== 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=k3JeAaNVMF2xcanrQW/ZU6P2wx6xjXOxRPoxu/fL7xo=; b=tQc6IAJT6oVgQ5LfWrkMJ/tQDXCGkQCEdOWNMx39qQwS6+ve/YMwJE9+05pTeBY0Zy yyL93puznrNM6WvBm9tjXUptXTpr/YXb9Jep7Sld2CIFZJyuFdkzCiSJlu1KYHbDT2Zw cVUyQujZQdfAut2oipuaDQ35WMoTOu5AXFn2p7h3Vk6bBgaZn0mBREAkqVfNCAbFt6yn gc0a2Zzj23H7LDlG2XxC1ml5LLROzG4iGAm4KMPDcijIQGFLJ2fb4OCgVtq0mliJ7s9h fHCHhFc2T8REa4zQpp4YByl+lXXsL4rZb74hwUDsP9PBZKZMD9Q/HFwVqClf7I7NsgAw dH6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=CWENStBe; dkim=neutral (no key) header.i=@suse.cz; 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 v14-20020a056402348e00b00427ade6cd90si16102605edc.260.2022.06.15.00.38.07; Wed, 15 Jun 2022 00:38:34 -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=CWENStBe; dkim=neutral (no key) header.i=@suse.cz; 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 S244082AbiFOH0R (ORCPT + 99 others); Wed, 15 Jun 2022 03:26:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231258AbiFOH0Q (ORCPT ); Wed, 15 Jun 2022 03:26:16 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78CDA4738C for ; Wed, 15 Jun 2022 00:26:15 -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 2A6651F899; Wed, 15 Jun 2022 07:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1655277974; 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=k3JeAaNVMF2xcanrQW/ZU6P2wx6xjXOxRPoxu/fL7xo=; b=CWENStBe3S+ypC1pbgUlWdhbv5lC2N5znwoBetrptGqdKk7kSpc+w8CdeyLvR7YHb11yoM Zd6mIxtcoPkiDRbgXiXkDFD1n8UvbefsP0nRUr1G6Qd0MhpHeg7vytyU8mC/7FRr2oC9Un qgW5XRpqXMhL4+ssYJCTPPHrQXcMHVU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1655277974; 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=k3JeAaNVMF2xcanrQW/ZU6P2wx6xjXOxRPoxu/fL7xo=; b=qWPFWW7LTMeR+CrzetQcyDIjcVJ+5V4M6S69lSahvkWBEpBTHup1JvscXvpLzG4xhcDT13 bavSiyvbQdHEa+Cg== 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 043FE139F3; Wed, 15 Jun 2022 07:26:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id S0AkAJaJqWICBQAAMHmgww (envelope-from ); Wed, 15 Jun 2022 07:26:14 +0000 Message-ID: <3c899066-d85d-3bd7-5b13-d5228b7aeb93@suse.cz> Date: Wed, 15 Jun 2022 09:26:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH] mm/slub: Simplify __kmem_cache_alias() Content-Language: en-US To: sxwjean@me.com, cl@linux.com, penberg@kernel.org, rientjes@google.com, iamjoonsoo.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, Xiongwei Song References: <20220531005550.10613-1-sxwjean@me.com> From: Vlastimil Babka In-Reply-To: <20220531005550.10613-1-sxwjean@me.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.6 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_PASS,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 On 5/31/22 02:55, sxwjean@me.com wrote: > From: Xiongwei Song > > There is no need to do anything if sysfs_slab_alias() return nonzero > value after getting a mergeable cache. > > Signed-off-by: Xiongwei Song Thanks, added to slab/for-5.20/cleanup > --- > mm/slub.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index d8d5abf49f5f..9444277d669a 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -4861,6 +4861,9 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align, > > s = find_mergeable(size, align, flags, name, ctor); > if (s) { > + if (sysfs_slab_alias(s, name)) > + return NULL; > + > s->refcount++; > > /* > @@ -4869,11 +4872,6 @@ __kmem_cache_alias(const char *name, unsigned int size, unsigned int align, > */ > s->object_size = max(s->object_size, size); > s->inuse = max(s->inuse, ALIGN(size, sizeof(void *))); > - > - if (sysfs_slab_alias(s, name)) { > - s->refcount--; > - s = NULL; > - } > } > > return s;