From patchwork Mon Nov 21 17:11:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13051390 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 D8543C4167E for ; Mon, 21 Nov 2022 17:12:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 863566B0075; Mon, 21 Nov 2022 12:12:13 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 702516B007B; Mon, 21 Nov 2022 12:12:13 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E3B36B0074; Mon, 21 Nov 2022 12:12:13 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 378DE6B0078 for ; Mon, 21 Nov 2022 12:12:13 -0500 (EST) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 11AD0A0C64 for ; Mon, 21 Nov 2022 17:12:13 +0000 (UTC) X-FDA: 80158092546.26.D6430F4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf03.hostedemail.com (Postfix) with ESMTP id A2E3720012 for ; Mon, 21 Nov 2022 17:12:12 +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-out2.suse.de (Postfix) with ESMTPS id 767781F8B4; Mon, 21 Nov 2022 17:12:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669050731; 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=i+6JBhvUCUmmY2fewWAJiOqYwob3QGMrPLk+o7jKpOo=; b=rmucTGRhwveRnInQNpada4a4fkOqU6D6rRn9oP5ElxleOq8yEvmYnOEhYDr+K8soSSBUR0 ApX/SEVkPEnvlVduLIpiCf7597UbxLGv4wiDmeFhQjxo4TF1RTKYCpMz8fxzzzN0xVFggC iEMgt8tuVapzUSxmvwogI3SUBUS2Sek= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669050731; 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=i+6JBhvUCUmmY2fewWAJiOqYwob3QGMrPLk+o7jKpOo=; b=ibeF/tUAVWs4fDUiEPICV/h0CIyDkXvu2Fwj3crXGYkf3alc6y3+9IzvFzC5Ov1PpvV44s hW9J4iGgwJb4cFDw== 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 4AD5013B03; Mon, 21 Nov 2022 17:12:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OFWnEWuxe2MQeQAAMHmgww (envelope-from ); Mon, 21 Nov 2022 17:12:11 +0000 From: Vlastimil Babka To: Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , Andrew Morton , Linus Torvalds , Matthew Wilcox , patches@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka Subject: [PATCH 05/12] mm, slub: lower the default slub_max_order with CONFIG_SLUB_TINY Date: Mon, 21 Nov 2022 18:11:55 +0100 Message-Id: <20221121171202.22080-6-vbabka@suse.cz> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221121171202.22080-1-vbabka@suse.cz> References: <20221121171202.22080-1-vbabka@suse.cz> MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669050732; a=rsa-sha256; cv=none; b=cofML5EblFMrAMffdFfMesaIGt3i8XpHWEWuQAgXtFcqaLjDjwkNdqSC+B/NFOUQS+/i3R t/gWPzGhLNKg1PpXs485wkyHfgL45oMZ3CtMlOMzAneJLmEed5/0MHi1HoVcxoa1NdzdaW 9u5eFIeLT0121CSbQrZ+l3FjxwNw+IY= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=rmucTGRh; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="ibeF/tUA"; spf=pass (imf03.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=1669050732; 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=i+6JBhvUCUmmY2fewWAJiOqYwob3QGMrPLk+o7jKpOo=; b=Qars0tCyB669W1acMmJg9ahRW81StuJSRCMMGOR1MRR73Nult2/T6R6okGTwkjXex0THBo asbn/4VV3fzb7GoUimvLLue+tvv70SJfT80sTnFJ7EK5gBRU4lXn9+j9vVTiZPWd6XCQJG W0/KqSMyRDqgZs2U2Bspiz0F0iGE5Bc= X-Rspam-User: X-Rspamd-Queue-Id: A2E3720012 Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=rmucTGRh; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="ibeF/tUA"; spf=pass (imf03.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-Stat-Signature: q8shbhctj8zxf8ktqehe9inqde9dw18p X-Rspamd-Server: rspam10 X-HE-Tag: 1669050732-606417 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: With CONFIG_SLUB_TINY we want to minimize memory overhead. By lowering the default slub_max_order we can make slab allocations use smaller pages. However depending on object sizes, order-0 might not be the best due to increased fragmentation. When testing on a 8MB RAM k210 system by Damien Le Moal [1], slub_max_order=1 had the best results, so use that as the default for CONFIG_SLUB_TINY. [1] https://lore.kernel.org/all/6a1883c4-4c3f-545a-90e8-2cd805bcf4ae@opensource.wdc.com/ Signed-off-by: Vlastimil Babka Acked-by: Roman Gushchin Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/slub.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/slub.c b/mm/slub.c index 917b79278bad..bf726dd00f7d 100644 --- a/mm/slub.c +++ b/mm/slub.c @@ -3888,7 +3888,8 @@ EXPORT_SYMBOL(kmem_cache_alloc_bulk); * take the list_lock. */ static unsigned int slub_min_order; -static unsigned int slub_max_order = PAGE_ALLOC_COSTLY_ORDER; +static unsigned int slub_max_order = + IS_ENABLED(CONFIG_SLUB_TINY) ? 1 : PAGE_ALLOC_COSTLY_ORDER; static unsigned int slub_min_objects; /*