From patchwork Fri Sep 8 14:53:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 13377569 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 C649DEE8014 for ; Fri, 8 Sep 2023 14:53:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AA22A6B00CC; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 894CF6B00D1; 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 49F336B00D0; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 32D156B00CC for ; Fri, 8 Sep 2023 10:53:23 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E279A804A1 for ; Fri, 8 Sep 2023 14:53:22 +0000 (UTC) X-FDA: 81213723444.30.E8C114B Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf25.hostedemail.com (Postfix) with ESMTP id 19E5FA0011 for ; Fri, 8 Sep 2023 14:53:20 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Ofhto8mB; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=pJOd4bGt; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694184801; a=rsa-sha256; cv=none; b=k3ULcic1HoCKo/Uq2q5c8iaRGDB+rBT1DqStxZ3KCsna6pBA67c96teet6nBHPO8VUID0r 1tsH3odiubfRxltuGCOQXwYdxDXqGrHkdB77HUWrAt/IImXdFFXx6UVWA2lerZ8bntIlrA MZKPc/02PmqLeNrlrXRc8JsDUA7Elhg= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=Ofhto8mB; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=pJOd4bGt; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.28 as permitted sender) smtp.mailfrom=vbabka@suse.cz 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:references:dkim-signature; bh=jWUuKHA14Ro80eW+EcXMts9c3gnZ7g0AX+XfQ4t1ggo=; b=vE4VKB+H0qlw3FbZ2CBiExK3/Gj5XPTyr14P79c79aEgJvoKzjz0Ul8vUknALjq5Rl/qXp CBz6ltZzCuF7AyqQleaBAnnOBorV90M7sKtlx3jOZsW/iWessCGB7tmlXtZJoANJJTyIhZ hensRn4fk4/QBqTE4O5KjrCAocaRkf4= 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 D1FB121D24; Fri, 8 Sep 2023 14:53:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1694184798; 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; bh=jWUuKHA14Ro80eW+EcXMts9c3gnZ7g0AX+XfQ4t1ggo=; b=Ofhto8mBB6G/WsRstp537Zic9CQSDdhN6TRK0U/zjUBosx5Jm4nYvx+3Q4XibW+tIzdBEU TG/TQ3RELRcc16jMAmPLpYXNvybxpwzf6JfRCw1FAMUSAMDvb2tShc5MbywQ6QVBIIC2MZ /WnoLDMNHcf6bG5Cic50TeNdme2d6rg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1694184798; 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; bh=jWUuKHA14Ro80eW+EcXMts9c3gnZ7g0AX+XfQ4t1ggo=; b=pJOd4bGthsdKOztl2YrI8Zl1MZINaACKK+ir2PQ5tmQZNxaSEOtVZ6Iqh5Sn+ieEScDVO2 l/ejWD0T1dAuZZAg== 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 9E385131FD; 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 1/TnJV41+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 0/4] SLUB: calculate_order() cleanups Date: Fri, 8 Sep 2023 16:53:03 +0200 Message-ID: <20230908145302.30320-6-vbabka@suse.cz> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 19E5FA0011 X-Stat-Signature: z3r5cerfugfsztoi51tkmqoygz89hdxa X-HE-Tag: 1694184800-986342 X-HE-Meta: U2FsdGVkX18d4mFyc+OyDP38zOBRL4MJ6zPtoRfH93MrDNf4FSeGXYgcf7hfExKXHedJqDPwcQivcYHmPZIg4MPGNkwKKAZ82RlWjKaNQ486ymm/aJTIodk8o1PiExGvUY2BLTrcJ7aFtNYN7YjFTSXykvrNvFUrXvFe2994QpvCUt7krscbmDGxDxJ9AUIJOAzBSo0mjFFOvvmi5wZpROMvv3iheLUnQ3c0ietBo6Z2p1pCRmimm2oUQf8tBFxdr+zksPVcqd+Qg95Pim/5c3rssXSYVqCOveP2SoMzBRDjgawp54a9EBKb3ZApcUMgdy996MyYmQo39q3uODDcUwZT0KtZRzRdHHP2bcP3HbNhOZUyqvosqYLQgBOffYzTUJyW74KDffPmGyC/Qxmanl24HTBJGnd0IBaStSC2zGrPi9qdxfFbb+jsU9/uQsDccnkdWQjispT3hz3A/WEH/q20tCM2nDXMMBcWKpXaNf+x6+KBXGmzDqQuCisPiOx0/4mkFomKszziHr1c/0NXm0QO+zoRqlqx7hab/t0AUFf3Kgc8e8SLLseAGVnCQ5Rw93xrw9NL8U+mk5rmkHA3AGT/6ETVz+vi6faxiJOf9d42qMXelUmVhRohQBBL4keJUdvqhFZ0dveExktaNQxlxeFTE34sR/wwlt3LIKozNSB/E5EmekJdVD7jE4cvG0Iy4wcSvwJ8/BFi3S8StAF5t3j9na5UdRCy4+kq94wxrgjh+JtiYa+iZZQ75FPzCWME3qnvgImp5azob2va3fLBONL/LZUKjxITzhjAolntze5A+QSHQJli4Bs4poVmz6DcJvm+VvJa2dtuLNm1F8h4eeU3d+NitYVLiKsm8sHOXh6+p5EMSK0JyypH5pZa+WrA5h2b0ZRtz8Ni1c2NraulpKnP8IvFKuuzjWcI0W44lTfqKalAvl4c/aWbsP+wN77vlgYzMl9ooigNXZKUpPE KD31WtF/ BnQbBjAaq7sKkIIvKSy3Mp4G+HlyX9akPqj61uRZQzfbnoPEYLNglcJf7W7gS4Ajc+2jUPlJD60hFX2WJ1AKwm+AlTnupWFlJdVkCj8SPZHz3CD5V0d8Nb3vdPIM5df6YJkGyibZkAtHLSACDciWlJnvuXF0ctbFHwEKJo2e6sPXr/7DL6vc94X3pvb9IIqMBEeAAuH3AD8NxREbhMDhQy/D82JJCoR5WmMWXFIj6uUjD1fHUpub+bF2WuBOx+6Sy63z3cAKzsnhmhBqZ/KieQ2Cb7Hbj+RgW3ZpqCPftuOv3LHcl9PXZ3r+mPlC3GPcMVFwchVct1Gk2FdYJVVTxt3tvVl6NZzoiwoBh 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: Since reviewing recent patches made me finally dig into these functions in details for the first time, I've also noticed some opportunities for cleanups that should make them simpler and also deliver more consistent results for some corner case object sizes (probably not seen in practice). Thus patch 3 can increase slab orders somewhere, but only in the way that was already intended. Otherwise it's almost no functional changes. Vlastimil Babka (4): mm/slub: simplify the last resort slab order calculation mm/slub: remove min_objects loop from calculate_order() mm/slub: attempt to find layouts up to 1/2 waste in calculate_order() mm/slub: refactor calculate_order() and calc_slab_order() mm/slub.c | 63 ++++++++++++++++++++++++------------------------------- 1 file changed, 27 insertions(+), 36 deletions(-)