From patchwork Fri Sep 8 14:53:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13377567 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 1B733EE8011 for ; Fri, 8 Sep 2023 14:53:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4A1EC6B00D2; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 477386B00CE; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C8A56B00CF; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 16D316B00CC for ; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id E0EDAA103B for ; Fri, 8 Sep 2023 14:53:22 +0000 (UTC) X-FDA: 81213723444.29.1A56C4D Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf23.hostedemail.com (Postfix) with ESMTP id 0026214001E for ; Fri, 8 Sep 2023 14:53:20 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=KUyJUvRQ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="fZHG/B1Y"; spf=pass (imf23.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694184801; a=rsa-sha256; cv=none; b=hyrgXVKMerDNqz4OCX0y3WIyR96UsyNMg0U6c1hMsLtML8pRmPqTo2DEwjqAUL8VRfkxfX JncAggVYIWHrmnQKylftM1q1OeEKw3kxEMLmMOsO+dbUtb2NZGu8l8q5SBk9MMsMiQymhT Fdkdy6hfFAntVXSPG+UNbwMC+Wy+R80= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=KUyJUvRQ; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="fZHG/B1Y"; spf=pass (imf23.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694184801; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=9/ffVZ2jgkNFPV8v9GjIklo4R9arDXW9nEkTxNB0K6c=; b=bmbqKpt6bKus3ChEa/XkA5koOd5GVQzq84icDNM5asD83NYnzFvqBrAlwpSdsPQ0BOUy1S S2MGSYAcW+4/nG9OOObNd2crflafrzQB1U6lrbUX3YqSpbXftdFPP/8izSCavYlmzq8Alt tGgYyxpXozwDgOxu4Vzqb6hC3tkAoeU= 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 065781FEFE; Fri, 8 Sep 2023 14:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1694184799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9/ffVZ2jgkNFPV8v9GjIklo4R9arDXW9nEkTxNB0K6c=; b=KUyJUvRQS4gA2ke4GVINk61D6KwZrbVETPHCWg2keeQHFwJDBjRWoICJcRSmEkd1dxkjj5 TweCBVVTjorbVIzvDPI61iMA74jg4u+dwy5WGvFONU/ZC9FZihSGpc9w87jcACXu3wiaDg SwKeICwK+C9hN+SMhocIUAFapCddKZ0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1694184799; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9/ffVZ2jgkNFPV8v9GjIklo4R9arDXW9nEkTxNB0K6c=; b=fZHG/B1YFdRe43J1fIyQGYzL7Ak+D5TYIdHhViuuB1fMP+TMnern1sOdtMTiv+4XRfZu7K CUoHOR832W1ZyoDQ== 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 D27E713357; Fri, 8 Sep 2023 14:53:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SDC+Ml41+2QaBQAAMHmgww (envelope-from ); Fri, 08 Sep 2023 14:53:18 +0000 From: Vlastimil Babka To: David Rientjes , Christoph Lameter , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Jay Patel Cc: Roman Gushchin , Pekka Enberg , Joonsoo Kim , linux-mm@kvack.org, patches@lists.linux.dev, linux-kernel@vger.kernel.org, Vlastimil Babka Subject: [PATCH 1/4] mm/slub: simplify the last resort slab order calculation Date: Fri, 8 Sep 2023 16:53:04 +0200 Message-ID: <20230908145302.30320-7-vbabka@suse.cz> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230908145302.30320-6-vbabka@suse.cz> References: <20230908145302.30320-6-vbabka@suse.cz> MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 0026214001E X-Stat-Signature: i3ipgfeob4mkt4hd57t439brnru3oytr X-Rspam-User: X-HE-Tag: 1694184800-877943 X-HE-Meta: U2FsdGVkX18NgWXNRyzgoFtf+2uzSGgf56Djxvty0nyFAJWiRFW9a4kFZtiq0Yr4Mrr1IQ3LefJbEE9sLYgIAbkJy8AGeyQO7nN8cPaSmszmWQXVMSSwydahzj+/2nKnsMuCD1gsVJlSU6/iwAdPqg4KazVHdnSMlvkPN0f7IKgZSFoWg9lL3cFJUUXBF1Vv3NB7nsOdZp5ynJsS+jFe3EujCpCKjufADExEz9xMfkknz6l6oGnuosAbXqt8TiOABrAbMkGtjGwMt1o+z+uYxcj1rUcOeapTMHwwqy6MSfDNJWUFVAVtnJlIuzVhhfdI8zmc/At/RuA50fOhAZ2mrRzm2t1kXF2xEdJ/UhTqvF/zaSVYliUBPgjGiHHC8jjNL8l9YLkMy+VNcI3TL8/VPWCwqmFMY0iH0/vsOzA465OtTeO5ONgSpUj/Cpr0iIzhq6u0i+zkc/0UQe8Oj2KVbp98s3h/gZX3nRI0zbUiay3mYhFwV2ZmTtFxukemf0BAh692jKun9UIcoHM6gV1TgZ5zTUmpitZ4YSMlmZnrDsNvNZCsVfqBDz2eN73c5o8dUy/cD23Bp8DKUKHlSnC9Ij2phSv+ZkfDjELkEpLkgz6RRXRhZF3IGxFNgRuPLQXtxbrHgFS8WWfDAXNlMJyBmxtIwbSONjoFVk2+5Ow3T9G2arfk6ZREMxcawVLRVuJtMEtqkInfz3wJEh7KS1y6rkb9drMnEteejtAkASiYL2oM34qmFt5JN7Hr2M/5kgsOBLPlpon9V5uc5xWp/bMN5O+NGCzCsXcQXpBqa/TegfhCUcrJlYNb1h5URYHX9OI2il0Z6f9OKyVljZaVyodrq9lBLr1WBSespDuoD3ETV3zTrrKXvEGRjJRDCGQ9ZoZYT6apZ18lUoup252Y7AhlEErqhyEDop+6zwRzka2g80/Abn0Fd5RA9Xh1nNIv7uh8qdIe9XCnALUdxK29Lqe rGK3bI5X FTSFSdP5UaVEsNV9WdYAXBi0FPNkw7IEKahcObMhKel7/XOUxzta9ZP4ssxmb/pzknDTO9MwZf6qBjkhJIma8wxiFOVpidWPVXzlLoHHGQXipa74SqYKgknGHLKD2RHv8g2VHgY0GOvGr2iRPMWu0PkLwmObFzC7nKimBk/TniJdZEpx/rw2BHGcc85AbCBcA/fhN9j2WBza2NJV7UUTb0BLC/KysjJmAH2rID1ot92IAxWn29opHSHx4lR2g76aOCw56 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: If calculate_order() can't fit even a single large object within slub_max_order, it will try using the smallest necessary order that may exceed slub_max_order but not MAX_ORDER. Currently this is done with a call to calc_slab_order() which is unecessary. We can simply use get_order(size). No functional change. Signed-off-by: Vlastimil Babka --- mm/slub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index f7940048138c..c6e694cb17b9 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -4193,7 +4193,7 @@ static inline int calculate_order(unsigned int size) /* * Doh this slab cannot be placed using slub_max_order. */ - order = calc_slab_order(size, 1, MAX_ORDER, 1); + order = get_order(size); if (order <= MAX_ORDER) return order; return -ENOSYS;