From patchwork Sat Mar 4 03:48:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13159778 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 744DEC6FA8E for ; Sat, 4 Mar 2023 03:48:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 560C96B0072; Fri, 3 Mar 2023 22:48:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E82F6B0073; Fri, 3 Mar 2023 22:48:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 361E76B0074; Fri, 3 Mar 2023 22:48:44 -0500 (EST) 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 241C96B0072 for ; Fri, 3 Mar 2023 22:48:44 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D10561C6353 for ; Sat, 4 Mar 2023 03:48:43 +0000 (UTC) X-FDA: 80529834126.22.7B0B1EA Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf03.hostedemail.com (Postfix) with ESMTP id 055B220004 for ; Sat, 4 Mar 2023 03:48:41 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="NPpYK1F/"; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1677901722; 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=2yVYyb0m321tEQ1IEeqZTIPuPQyMbVQqDZxIADBpS5c=; b=h4urRjyoXAHwWpI8u5ywTQFkgVcYgU1qyveemeJkIqUYKg8N8e2b0NsItbfxa/mErQwZrr NS2wh89HMAxxeQ9fy34Q3UNT/MVoKUEN05yW8XGJvegidSU+WSfgjJMAz8f9wlC/zxeX4+ jl/CCIXlQLS4umR5tAOLUoPEoWsKXvA= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="NPpYK1F/"; spf=pass (imf03.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.182 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org; dmarc=pass (policy=none) header.from=chromium.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1677901722; a=rsa-sha256; cv=none; b=EVGyyFqiJCn0zuEDLLV/eKJ7tNJLYf/L8e+VBNtBGANtzwRqZ96vU8x3XrpbzRXcGpVqPn S/AJ9uP8NhAWvPTViFjEQb+0DqlSdqtzVmXb900yMTGer6pwtu8vsM4pG1JYEVaszuSy6P PX8GaVLGK1EK+y6dWqUV+7bL5pq0fJY= Received: by mail-pl1-f182.google.com with SMTP id u5so4771665plq.7 for ; Fri, 03 Mar 2023 19:48:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=2yVYyb0m321tEQ1IEeqZTIPuPQyMbVQqDZxIADBpS5c=; b=NPpYK1F/sUp6Xdh6Uumxwm0qAjQQx4quuYtJoICj9CKB/S4Wdu9gMseKJjFlR6Y1Bi I/SmAomCv9/JZuZlTsk7Ap0VjA2LJ/RZe0fQ5/fgXhy67EwE4ZAdzxhbLUU+6Pt6turS wDRx9Htvf1wogmKPqRZHIylaF/Myu8cJHzq0M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2yVYyb0m321tEQ1IEeqZTIPuPQyMbVQqDZxIADBpS5c=; b=naR5XjOkbp8WqyYpD+sR1b0+dgK1dCwaicZkI0509D5JQNnXdkKAm9dQRFV/2Q83bR Rn/rjtmD89i78nfFiA0sAGE9JUbn3mkcxu4zWYBmaXhzs48TDYHxAeDxidSqFydYHXnR YBSUm8chjCUSS0y/x+7lLUkoEYjgLzIB9oJPnlp9/utkf06Lu6HK3DLsFTVGeLFa9kuf g6Q1fkMhKfWP9PPUfHgVjk0TS/jXNbkUWV0Y1C/ILPZtPdZNNTRF91PfkT5IY3RX8n6j KJKm2o0hsgU54BflgCaLbjQCxCn49clDLaR2cfsY8qlqFcgRHCD+VE5K9/RMSuz/de3v EDug== X-Gm-Message-State: AO0yUKUBxWVLZApOkJXomg814ALHnemgUhwW1qYBqNpdAjFqM4cUb0P8 OizqX1HSMYK6kNRbjRe46quTjA== X-Google-Smtp-Source: AK7set8j7lPxnTXNsxtEvwbE5dWdxQNsueDFzcxLhlOo45FjZ4F+3AU3AnMDyE4VKWr+bIgytXnODQ== X-Received: by 2002:a17:90b:1d04:b0:22c:4dd3:5c4b with SMTP id on4-20020a17090b1d0400b0022c4dd35c4bmr4130172pjb.19.1677901720804; Fri, 03 Mar 2023 19:48:40 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:6ac2:6eee:5465:7ee6]) by smtp.gmail.com with ESMTPSA id d6-20020a170902c18600b00199025284b3sm2249204pld.151.2023.03.03.19.48.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 19:48:40 -0800 (PST) From: Sergey Senozhatsky To: Minchan Kim , Andrew Morton Cc: Yosry Ahmed , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Sergey Senozhatsky Subject: [PATCHv4 0/4] zsmalloc: fine-grained fullness and new compaction algorithm Date: Sat, 4 Mar 2023 12:48:31 +0900 Message-Id: <20230304034835.2082479-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog MIME-Version: 1.0 X-Rspamd-Queue-Id: 055B220004 X-Stat-Signature: 5pzazctq3ub6hibgkusgz94jzr695aqt X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1677901721-361304 X-HE-Meta: U2FsdGVkX19dG/kvQgU3nlbCe4GUDwrpEbxbgXF+RziNNM7MbcnoKNHHVrk6zH8SPtjyetLYtrKxd0mcMvde85MfWlXj72/4oB/BWZ6P4NwdLTnDK9tBF1WHKrPXzjgazmLcIsvI6UjqWlriHJA4BHxAtLVAt846I73vy2jjJVb2u6sn82M0SnVx4RSEZ7ex15KeCgG5yi1CBTxk2gkiIY9MKrRT261kmgwvHewxNUbx4MVTbbZaTzAIz+C+4uGj3J3TfSQD9Dbpk3p/6dyQf7/LUBWqssPhx3p3QI3fkXoreTYzNPWjmN+WJzSb53tDcieMDzrmBbZHSrip2VV8gWAvqFtLhj33RpOUy3r7H6lJiMAUIWsI3rREm5lyVWh4ANMJGYbkK1FA/oHho8k+bS7S8UsI7USm9HaiTxbzxcMjmd0RrZUYI8MxI7Uwi8sHpLmMpFgtDqoYKxLAw/VvpWgjlnoqBxmHx0Zg4aFyZoZVlkAvmx9ipeROxRl/+PQ211kwJA3PIbllf5aggEVImirjUDEX0kBN2U15ski07On5ZYrt2RJ3zQmmaOJvhUpeQ9NDgxicfzwl07E+fMOa+d9o7fvSG3d8aulzJRC7ZNVmIg4ZsNP+VSgy70oPLo4TiQJaea1GW1oSOyYcUPHermRLAfj+MEk2Lu8Ddm03rJbIhEs6dJp54pBz7/hPJm5aj183hHbQgGicqgXvEi2kHCCTnzrffoofRFHsY3yzpclRyXtNVePCzJcGEoYtxlOQJ/yUe+f/Td7DBQuihkyLEPB+raZqoNsFNaCywT/FavK269fUVegdTO1ssmwfW2vN7wsVtaY3TbqujgFu8VVmXc4iO2Z+tZL513Epu8I8BzLdsrjuzWPKP9nDC4plgkq2D6N/UWr8iRQf+OCLFh7jXQiCW8u1+hsfUMpMgdlu2pd5xC4P/eQXqZ8CvL2mm6KjyIzM8DCFBQl9Tl/lwvC GZ4LJP/6 d2QIQ09pIO1KVWNQ2lU/aa7Zoa5Bln9uo2zFOUKuTDAI+XQeqhQDRNaZHJVU+S36gLZ/4J9WfI2OcyENVwwvEtRNlcJZ2NwA2UjeI+cPjXAx6LxXRjE9qEM5JlvltIL9BYGTnbLIhp9aCURjqUu4LhI1ZETyNsyxPMu/fzpBn7T1X+26k0yEyQmjUEEolHMsonozAWUtpPzGAyga5wfHzJJhH8Rs6XJzA8Mco5gE5P2LItbxgQx9H9y1Jux20/qYl8+G926NLhu+OFI5BlAqXzyMvO4kAq8+fEULXC17vyu504csEFtbksxqpihiGkgl2rE3kipJUYpIcmtgThJTCfxix7LMvDk82MAQMTlWMEvmKnJv5NtTxSOYUEkg7tbs81XI+x+qJY7lDDIFJGcWiVBX7W9DyetAqiFl7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000089, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Hi, Existing zsmalloc page fullness grouping leads to suboptimal page selection for both zs_malloc() and zs_compact(). This patchset reworks zsmalloc fullness grouping/classification. Additinally it also implements new compaction algorithm that is expected to use less CPU-cycles (as it potentially does fewer memcpy-s in zs_object_copy()). Test (synthetic) results can be seen in patch 0003. v4: -- fixed classes stats loop bug (Yosry) -- fixed spelling errors (Andrew) -- dropped some unnecessary hunks from the patches v3: -- reworked compaction algorithm implementation (Minchan) -- keep existing stats and fullness enums (Minchan, Yosry) -- dropped the patch with new zsmalloc compaction stats (Minchan) -- report per inuse ratio group classes stats Sergey Senozhatsky (4): zsmalloc: remove insert_zspage() ->inuse optimization zsmalloc: fine-grained inuse ratio based fullness grouping zsmalloc: rework compaction algorithm zsmalloc: show per fullness group class stats mm/zsmalloc.c | 358 ++++++++++++++++++++++++-------------------------- 1 file changed, 173 insertions(+), 185 deletions(-) Acked-by: Minchan Kim