Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4937021iob; Mon, 9 May 2022 05:15:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+84F9IUqSNbmjTTUoJb/H5wTz66r/2nOkVqNBRb1tB0ris0II8vRIQ/LRaqOT1Vg9Pl2I X-Received: by 2002:a17:902:f605:b0:154:aa89:bd13 with SMTP id n5-20020a170902f60500b00154aa89bd13mr16438252plg.112.1652098532613; Mon, 09 May 2022 05:15:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652098532; cv=none; d=google.com; s=arc-20160816; b=xtDtQFoa3AME9C9ctYCbcMFr0TiqQvMymjOJRb0qjYf4XlSYy3RfpEfJ3yKDoTYkvn 2jNuUd5DAWPGZaMeK0nlrWeNYl7mttCvzfF+nwJd9cRtjmQH0C1gGd87B8NRJ/rnbFci rEx1Mz3/zy6x/Lwd8uZO9UsqTHwuHaoD6RFQYgYgap6IABM8NeJZ6f/gA+ya7hXx4Cvz H8YwqgAWq4TXHHZa0kfxfAGiDm3/8RPPKnj3YWXavMMP+T4PnMYvfBlsPW12SkImllkh HoJx8P14nX2/Vto8b/c/mCRcXg7dwp7JhBHl2FrtU58E9ALDaLhUUUCgxfZYW0VIY/lL 7c5A== 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=ROU9Hy4V7hBvs8b+/r+npPjSPJAc6xQLxvLIhkwIRwU=; b=q9spcpElUQ4HF6fP4G9y+8ZWZkbsNcNkZ8xtO+EbSQkOWvBJZjLaj/L67HoyViigD9 t0ffMvBiFvdXgGiPdob3x2WaOGuMtjZtyFEnER8kR5HxqH4VsHhKb8WVKObu97p0pWo7 tuNXP9bFrcTMl73TtMM9TaF40sCqkR3zmlsVruZEcpx0Pj+5J9/BWguMN33I9PrPfwCY faGVizO4psmjkzoEVE+4b3Sy1tf9+hbLkSQJGBX7/llQFvi7fwS4FEAKGsIfnpxHri8h xvViloV8TDdE9LM7GnAaZp1uL0zGEkBmqYpp1Yid6wEWdc4eeStqGtTSh1umAsQOzj/J O0eA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lnHRuTwY; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=NIkEHd4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l5-20020a056a0016c500b004fa3a8e007fsi15423520pfc.310.2022.05.09.05.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 05:15:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=lnHRuTwY; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=NIkEHd4Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEFC4AF1C1; Mon, 9 May 2022 04:44:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232862AbiEILsS (ORCPT + 99 others); Mon, 9 May 2022 07:48:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233264AbiEILr2 (ORCPT ); Mon, 9 May 2022 07:47:28 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E10B1312AA for ; Mon, 9 May 2022 04:43:28 -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-out1.suse.de (Postfix) with ESMTPS id 1EBA221AA9; Mon, 9 May 2022 11:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1652096607; 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=ROU9Hy4V7hBvs8b+/r+npPjSPJAc6xQLxvLIhkwIRwU=; b=lnHRuTwYLHY5UtCrFvZBOjAeXYsXu1iBqvBHmZ31j+27YD1UhJM3/TBPkFwHzRn/JlgSL5 +N5rKoducg45ky6b8wYT2R60K/YirgzPyxBzyUgz0QD5icOPuNf5j/aWbV7o7Gu+Qwlwi2 CJ79pIcDOrjLnl+WIIlJATJ3+WF9cpE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1652096607; 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=ROU9Hy4V7hBvs8b+/r+npPjSPJAc6xQLxvLIhkwIRwU=; b=NIkEHd4ZaowPBVWZwASFNzv4W6WTjyYRXXAmZ6lhIsP0X75cS3PIfEKeTfqVb/cF80RQcI Yn/uvkLLFVmtI9Cg== 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 D71BA13AA5; Mon, 9 May 2022 11:43:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7xq0M17+eGJFLAAAMHmgww (envelope-from ); Mon, 09 May 2022 11:43:26 +0000 Message-ID: <43933b3e-0770-897b-309d-a9a5d4cadb4f@suse.cz> Date: Mon, 9 May 2022 13:43:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [Patch v3] mm/slub: Remove repeated action in calculate_order() Content-Language: en-US To: Wonhyuk Yang Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20220430002555.3881-1-vvghjk1234@gmail.com> <49b0d611-e116-c78d-cf14-6d5f96ae500e@suse.cz> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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/9/22 11:42, Wonhyuk Yang wrote: >> > + if (unlikely(order_objects(slub_min_order, size) > MAX_OBJS_PER_PAGE)) { >> > + order = get_order(size * MAX_OBJS_PER_PAGE) - 1; >> > + goto out; >> > + } >> >> Hm interestingly, both before and after your patch, MAX_OBJS_PER_PAGE might >> be theoretically overflowed not by slub_min_order, but then with higher >> orders. Seems to be prevented only as a side-effect of fragmentation close >> to none, thus higher orders not attempted. Would be maybe less confusing to >> check that explicitly. Even if that's wasteful, but this is not really perf >> critical code. > > Yes, I agree that checking the overflow of object number explicitly is > better even if > it is almost impossible. But it checked repeatedly by calling > calc_slab_order(). It > seems to me that is unnecessary doesn't it? Yeah I'm OK with the goal of your patch.