From patchwork Fri Mar 3 07:31:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 13158386 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 D32FAC678D4 for ; Fri, 3 Mar 2023 07:31:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 297456B0072; Fri, 3 Mar 2023 02:31:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 246AA6B0073; Fri, 3 Mar 2023 02:31:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10D8C6B0074; Fri, 3 Mar 2023 02:31:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 00E466B0072 for ; Fri, 3 Mar 2023 02:31:39 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 601AD14117E for ; Fri, 3 Mar 2023 07:31:39 +0000 (UTC) X-FDA: 80526767118.19.A2605AC Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf20.hostedemail.com (Postfix) with ESMTP id 99B091C0006 for ; Fri, 3 Mar 2023 07:31:37 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="UOw/0iAj"; spf=pass (imf20.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.179 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=1677828697; a=rsa-sha256; cv=none; b=AZTQis5KIB/shRhjrWTj8oXvI8tLgnCoBoio/rx4ccn77BQ2E2CVwOSoOBCOmr9m48h1Cy IPq7xAsiW6b4XsZUThRntDltXkt7Y/JAWKqYbApzQMtsl7LzSBkOoYDQIMXdU+zVAt7pem aapdPb0Rj2iI+pGQNv9k8M4oPteCfM0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b="UOw/0iAj"; spf=pass (imf20.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.215.179 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=1677828697; 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=YzELe6tbzHF+U+jaQa/Is388A8sqVUSz/+d91Se8xhs=; b=5SaQBlmmR/lxuMbMWwWmE7C96dO90jdwOJH11Fir1ss7Em1qs3Ouv5zOMkgQY4QJpe+aLp K2LwiXlECxHv1zj+d3kThKh/mttnZcbp+GJA9TGlziZ2icz2HMrUofwsuf/NkwerXFheYP hdq1VjBmSVpezMALOIjSCutz+7fsSUk= Received: by mail-pg1-f179.google.com with SMTP id 130so949664pgg.3 for ; Thu, 02 Mar 2023 23:31:37 -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=YzELe6tbzHF+U+jaQa/Is388A8sqVUSz/+d91Se8xhs=; b=UOw/0iAjT/bHbvi3k8Rt1ao6u6z2+J1u4g9mXoK2hbpJNugvvb4GZT6PH2xsZR/5Ip iZMsaHmX/SHkZ914ZVExtLFo2wsSyHys8gdT0bRf+/GMJr4WHUm4YrJKl6qGMl0S4cR2 SdiyeV72ptPVummoHcxP1OiNCjGXZ+yv9OOrA= 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=YzELe6tbzHF+U+jaQa/Is388A8sqVUSz/+d91Se8xhs=; b=pTqKN3tu1b0BJVPMXrawPBMho0Zucel2GN6eJLCWvmm9pkGC0BInhIT1aZYW1V7FU2 icG3nt8zQmmi4UyGhPIeAgDrS/bJGERZmAXyyJU2tDT0bv2dTAA2m0WDEkVP2nXq8C+l 6JYwBAp+VH/TuMz/23fkMc+d/O1LW6aFFXdK70Um9gL9TiPOOB5zPoyz5YJr+Gdiadn0 hnzRXaOo33F+3d5kHv77p8BapAEzCeaHtKHSH2297ten0GukAEG+6AhTR2LxO3DsVHx5 lWc5HEB+u6tYYY2PF0ZuRCx7mtEUYuEby8PEZCDHWYtLa7JOe4jvw3KBBDv/ygCRm1t9 UiiA== X-Gm-Message-State: AO0yUKVzHYZizE4ECfgggFYTP8Uhszjfd0MpqZn12AXbgDAsqicA1uXY L/q8ZI5cr0kC5Qan2hAQenreSQ== X-Google-Smtp-Source: AK7set+HuY7xqseDrwLyzR/faOcmNeG81ro2icCnnTG12AeL2JWXQ/4SF2pBiE27fCEn5xxh3YTQwA== X-Received: by 2002:a62:1781:0:b0:5a9:c43a:5810 with SMTP id 123-20020a621781000000b005a9c43a5810mr1097796pfx.25.1677828696221; Thu, 02 Mar 2023 23:31:36 -0800 (PST) Received: from tigerii.tok.corp.google.com ([2401:fa00:8f:203:badf:7e3e:d3f9:4956]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm933439pfn.15.2023.03.02.23.31.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 23:31:35 -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: [PATCHv3 0/4] zsmalloc: fine-grained fullness and new compaction algorithm Date: Fri, 3 Mar 2023 16:31:26 +0900 Message-Id: <20230303073130.1950714-1-senozhatsky@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Queue-Id: 99B091C0006 X-Rspamd-Server: rspam01 X-Stat-Signature: gsdctp6tgwzi71srb1tr9yo3carheyg9 X-HE-Tag: 1677828697-361914 X-HE-Meta: U2FsdGVkX1/09bDeHeIcZv+p0RuJvulMxkoQP1tQbBqujVRVeOWkBG+39PZ+YS1mm8MBbRkKOEOSDdR8xN/eNHDEbU4+B7F0oc00u9L/mq+ui7qpN42IOG9kDRv6G016ATP5pHpczP5M38QU0rT9hukwCI4SZ4KKytn5SKlShi3e4YK/NEA3I0xjo1fSyLYlftxfJzbVgvmQT/HwBXp3Lu8FL79GTniwnTfsbMfoiG4Ytre0etytDtZlFAfPvW15R8FXqzY6cUH04Saj4Pkccua5sNCq+nXb/3XrwbUQvW/mUJYz9BZ4iACi+ACHp/youoy2z5NPB9yBCtID/7aLhZASzMaVEaFY2lFFHOSjd24kCyff5b+MnyGxK/1z9REaYryyXCeKGcJtd5GN00KLNeinJPWYBZOj7lWjTYZa+Qa2JDhhlKOo98RPh+xhGagInNoMUiFZa+UHZgaCpOOz9v3jx7Fb3lpvdMqyUz3+4xYnb15PaKyWI7L2pU8SxoBnOk0wKFbWCpKpazZZ5sIKXjs3umLURRpF4CP1n5LL0jEyf+LYidybwOBjNdo6rTRSdziOC4YrhXhN4TIOXndBmutw7/ABx4Njs/NY8OXj+NGezLQb9ryqwZa6/wq1zC4NdnsXSq3QsD2VocLRDxso3a6HhY7VSe9YZABqpcTsfyeDQ+AzdD5espK6lCeE6fFNiKAXdOflH4lHURfhPz7fDezz3Jlmpglek1kdZ3DqHRBAEeCBGacFzZs4fhGTv62kwAhOEBBJnA5YYIxkEo7UcIwT95QuGslXq5KR9TkbEezxFqe1UTm9/LTJ+i5MaJ5MKRUysApI1UQuWjYW3VCbMu7mlMJvbpWnTC7Kc5h8GCMtCri7HTjDZewPm39rnCLDSQ+wrTZkDl+smUEgIYSciyXboEDRs0AVe8kP7t4hVB8qNuv2S3obOV0Tt11ZMzl/X4jbeU02gG7hmEcfOvV og2vfHMG FGFR+/+CqdKdSpu8Hndp3ZsgqY3B5TBvSwD5GBHWOq6Ro0DJsCjRIr5k/SlsxWaJq9tPtcR0+5MzBd+qvT1UglS5tCcCagyVnwYYpTVefYNvDUqMsY3ssoO3mX00eh50RYgjO0JQJtbggjjNxghPp5jXbAIDVIYjTfedmhadHRas8Oix9LXUP+vtHtASoZE4CRdbSRv/iI9dom7JedNRgATvhhfHVFtLd3QpqKCrgPjZ3NA4D2Vd8pDl14EGmdXjULTgb1J+tbFAX4SsApSWIEBr4NVsaB1ds/l2uXDqRBtWvcJQPEV5uwoSpFnl4Oi7ITnTCMsU1HVO8Tpm12bgJyhkAxuAsSsVWZJE1ZqBw8qQvLdTPTb6oc8tab78+AFvqgZlB X-Bogosity: Ham, tests=bogofilter, spamicity=0.000016, 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. 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 | 362 ++++++++++++++++++++++++-------------------------- 1 file changed, 175 insertions(+), 187 deletions(-)