From mboxrd@z Thu Jan 1 00:00:00 1970 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 D81EFC4332F for ; Mon, 7 Nov 2022 22:35:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E299F6B0071; Mon, 7 Nov 2022 17:35:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DD9686B0073; Mon, 7 Nov 2022 17:35:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC82A6B0074; Mon, 7 Nov 2022 17:35:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BBB0C6B0071 for ; Mon, 7 Nov 2022 17:35:58 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8F4691C6833 for ; Mon, 7 Nov 2022 22:35:58 +0000 (UTC) X-FDA: 80108105196.17.0257CA7 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf12.hostedemail.com (Postfix) with ESMTP id 36B8040007 for ; Mon, 7 Nov 2022 22:35:58 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id r61-20020a17090a43c300b00212f4e9cccdso16152352pjg.5 for ; Mon, 07 Nov 2022 14:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:from:to:cc:subject:date:message-id :reply-to; bh=ScCG4xySl+iVdb3fADGlRx/eKjLXF30jrWX/i1bgXJs=; b=nzuTWt2r7F2EccPeNgiYTPeTar5wjblrT687MlvLcPBgETTl0nIs6hxBIgdEXBUYhZ C/r5k2chl2CVI4e17lFHcVRz9t71RXev8R3G9Zvfm1UQ6T3NM++yesn8dxapWtAKdOUT Y9jwlaASUyHiIY1UTpQCVrANRSsqOTYP3NXjy1ZcpbulDTQjo/cf6VBg6kW7ab7+FgsX iicuRJ537mhvLVCEtBe8k0LBCUs5eridjyUbpQSl2+edKRWipSOINEL+5pMMf7badaQi JQLfZnTdvyOc2O3IaizLul5iJB4KhxMN9LViOLqens1yQ9rWq+Ls5a5scTXqiICqjhcJ Y4aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ScCG4xySl+iVdb3fADGlRx/eKjLXF30jrWX/i1bgXJs=; b=LdROCqKGnnznMjcEHEaKV5jNnbcEL0xrdpd0o0o5hV2nO0qO3dlwLKysHYLH9+2XYe yOzyzxcelICcVv3VNgQbRUB/W/wKqTJneuHZEAJcTirFZIrIvtzX8kEeCISOQmc4IbVm oxStqm56fzovcoVZgiKOVUbZrvpk1ofglcWsYzk7+lbaS5EWPA73k9tXN2Dkh5oq7lpG 0eDJMMOKPleEQTv0zgQ+MHrzsed/TF3McRd4V39RcdyWU1JGwyRXwCuRw1RiBQNccIXB J5WY5lIjN6JnpfhXVhAoemH0BxLwiOfTxLVKcSSvpaa1UJxusWGmOZrIPVYfZYmgP33c GIBw== X-Gm-Message-State: ANoB5pm6QoCJHjoLwtGSXWviIRpqaixPqMKtsX5m7SsmeC8OhsKP+9Is qBloiYOs93B2xiROzYDxGjM= X-Google-Smtp-Source: AA0mqf5fPwg+u5G0WX6I3elzKWc92F38WOU80BIX7vGpfIsnEwxT1BjfPHEMZKZp948SucURtPpzPw== X-Received: by 2002:a17:903:230f:b0:188:649b:a0c9 with SMTP id d15-20020a170903230f00b00188649ba0c9mr678532plh.150.1667860556986; Mon, 07 Nov 2022 14:35:56 -0800 (PST) Received: from google.com ([2620:15c:211:201:594a:f636:e461:590b]) by smtp.gmail.com with ESMTPSA id q10-20020aa7982a000000b005618189b0ffsm5003579pfl.104.2022.11.07.14.35.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 14:35:56 -0800 (PST) Date: Mon, 7 Nov 2022 14:35:54 -0800 From: Minchan Kim To: Nhat Pham Cc: senozhatsky@chromium.org, hannes@cmpxchg.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, ngupta@vflare.org, akpm@linux-foundation.org, sjenning@redhat.com, ddstreet@ieee.org, vitaly.wool@konsulko.com Subject: Re: [PATCH 2/5] zsmalloc: Consolidate zs_pool's migrate_lock and size_class's locks Message-ID: References: <20221107213114.916231-1-nphamcs@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221107213114.916231-1-nphamcs@gmail.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667860558; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ScCG4xySl+iVdb3fADGlRx/eKjLXF30jrWX/i1bgXJs=; b=kt0wosnGBXTSlLLYdQAdTZ2qPcO5Txkl+6dVuYrnzK0Gya54MwL3cY5m7BIgy9VYKEzsni gSQZpHjeulHx9quyjLKJtrOODLTKyL3muI50y8DquTeKWwS6GqSoBIAt2aSZY+31JJqLTK OMgDS8pdwboo56X3zT+5Inyk5DAT1LQ= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nzuTWt2r; spf=pass (imf12.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667860558; a=rsa-sha256; cv=none; b=D4yJTwjGWsK+d+x3WOLnjrdZIlAb4oyg2VzLL8VVdojmGnIRM5k+o55EgIjpW8QZnELe+F +ymZ+xBp7OsLiRtRVOKVUpIrSKaNbxCsTxEJ2mHE80ym4bgq1MM3E4HnRZXjmcfyQucZdx EisHlnlBh/5AWDgs7BFAr8HdM1o5JV0= Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nzuTWt2r; spf=pass (imf12.hostedemail.com: domain of minchan.kim@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 36B8040007 X-Stat-Signature: dsmfcxxocec8or7bghscj9gg7tn65qen X-HE-Tag: 1667860558-907102 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000175, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Nov 07, 2022 at 01:31:14PM -0800, Nhat Pham wrote: > We have benchmarked the lock consolidation to see the performance effect of > this change on zram. First, we ran a synthetic FS workload on a server machine > with 36 cores (same machine for all runs), using this benchmark script: > > https://github.com/josefbacik/fs_mark > > using 32 threads, and cranking the pressure up to > 80% FS usage. > > Here is the result (unit is file/second): > > With lock consolidation (btrfs): > Average: 13520.2, Median: 13531.0, Stddev: 137.5961482019028 > > Without lock consolidation (btrfs): > Average: 13487.2, Median: 13575.0, Stddev: 309.08283679298665 > > With lock consolidation (ext4): > Average: 16824.4, Median: 16839.0, Stddev: 89.97388510006668 > > Without lock consolidation (ext4) > Average: 16958.0, Median: 16986.0, Stddev: 194.7370021336469 > > As you can see, we observe a 0.3% regression for btrfs, and a 0.9% regression > for ext4. This is a small, barely measurable difference in my opinion. > > For a more realistic scenario, we also tries building the kernel on zram. > Here is the time it takes (in seconds): > > With lock consolidation (btrfs): > real > Average: 319.6, Median: 320.0, Stddev: 0.8944271909999159 > user > Average: 6894.2, Median: 6895.0, Stddev: 25.528415540334656 > sys > Average: 521.4, Median: 522.0, Stddev: 1.51657508881031 > > Without lock consolidation (btrfs): > real > Average: 319.8, Median: 320.0, Stddev: 0.8366600265340756 > user > Average: 6896.6, Median: 6899.0, Stddev: 16.04057355583023 > sys > Average: 520.6, Median: 521.0, Stddev: 1.140175425099138 > > With lock consolidation (ext4): > real > Average: 320.0, Median: 319.0, Stddev: 1.4142135623730951 > user > Average: 6896.8, Median: 6878.0, Stddev: 28.621670111997307 > sys > Average: 521.2, Median: 521.0, Stddev: 1.7888543819998317 > > Without lock consolidation (ext4) > real > Average: 319.6, Median: 319.0, Stddev: 0.8944271909999159 > user > Average: 6886.2, Median: 6887.0, Stddev: 16.93221781102523 > sys > Average: 520.4, Median: 520.0, Stddev: 1.140175425099138 > > The difference is entirely within the noise of a typical run on zram. This > hardly justifies the complexity of maintaining both the pool lock and the class > lock. In fact, for writeback, we would need to introduce yet another lock to I am glad to make the zsmalloc lock scheme simpler without meaning regression since it introduced a lot mess. Please include the test result in description. Thanks for the testing, Nhat.