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: 23948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1716987wrr; Mon, 21 Nov 2022 09:13:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4OWGjdiJ0eOWHmdHMDSON1sM2Lo/myEHQ6UHrt12KpKhy+y20Vrz3tIF3qfiZR/rbXs89N X-Received: by 2002:a17:90b:2705:b0:218:78ae:bdaa with SMTP id px5-20020a17090b270500b0021878aebdaamr20482000pjb.162.1669050793685; Mon, 21 Nov 2022 09:13:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669050793; cv=none; d=google.com; s=arc-20160816; b=H/Wb4v+VshBwp784Ztt28bktwFkqb+rPlrqG2Cf6IZbh7+WBRDJcBq9ZjzM107qxWw Sf+USgXB2oXrVEOnqlont8IkDFNYqGgzNlX7QT0g7+d2/a9g3PBsG7thJ1J3M4+agOfm EyeSJf5b6kwcT9pUeOlXPEXSmNXSvu1eldMF4GD+EK4QgeIGUpkZr2AaAbH89txEm4hz 4fa6nrcrb57cVTM1q2omoEr5NXo7dl+txxVGPOk/g1s7OKZSqglH5XcAAyptrc3Pr9rs jfWv0oxCm3/RrhnV2Um05XK7F1skXWqdQDcwqQWbpah5s5W9vkpARUx96pKW7CehbEQ8 aohw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=i+6JBhvUCUmmY2fewWAJiOqYwob3QGMrPLk+o7jKpOo=; b=vGNJHt3TsKFbha2f7RomZ0VWOkn7eQW24iGl/xsm/FsP8Sc4NxheNy3uA7Cij+pLqV PHXbL4iGHrPg+lmobrl7C0FuJKmWVBDBWYYzEmD2g6CEbgKeGUHkjj4IkqkFhjpE09Pl Pg2bJ7i0iAT1bHckta603nY6dw+wDMXCmFP/d6bnHhB8XFZj2cDxNgEOwgtsuu6iYOSE 6xRN6gMjDRwqJM+AGcAmdVe4fXbJ23vqV44/18y8fOpYfl96PGNguSy/zCmE5Y4l0qP7 bNYHBqIqS6fr/eca1TrTYjwW4+5M3SBDWVKdxfgBeNVUt3sabvx6gm+xsUwJNwJ3PlsB laMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=rmucTGRh; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a056a00248d00b0054764d871b5si13015933pfv.230.2022.11.21.09.12.58; Mon, 21 Nov 2022 09:13:13 -0800 (PST) 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=rmucTGRh; 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 S231193AbiKURMf (ORCPT + 99 others); Mon, 21 Nov 2022 12:12:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbiKURMQ (ORCPT ); Mon, 21 Nov 2022 12:12:16 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8469ECEFF1 for ; Mon, 21 Nov 2022 09:12:12 -0800 (PST) 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 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750126605269028385?= X-GMAIL-MSGID: =?utf-8?q?1750126605269028385?= 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; /*