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 4384AC433EF for ; Mon, 9 May 2022 11:43:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D14026B0073; Mon, 9 May 2022 07:43:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CC45E6B0071; Mon, 9 May 2022 07:43:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3F956B0075; Mon, 9 May 2022 07:43:29 -0400 (EDT) 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 A31316B0073 for ; Mon, 9 May 2022 07:43:29 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 794E120F9F for ; Mon, 9 May 2022 11:43:29 +0000 (UTC) X-FDA: 79446019338.08.ABE785E Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id AFFE340094 for ; Mon, 9 May 2022 11:43:11 +0000 (UTC) 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-Rspamd-Queue-Id: AFFE340094 X-Stat-Signature: e3xcncxgkp15znyczo7on9q5gumodgo7 Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=lnHRuTwY; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=NIkEHd4Z; dmarc=none; spf=pass (imf17.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1652096591-693540 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 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.