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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B73C1E6FE3C for ; Fri, 22 Sep 2023 14:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=4st6ZYg3FVhE3v+50kYm5eJfoIqFQ+XLgRNabtFo3tk=; b=ktT3NNSMAvFCVS oQusVOrJ0b0bWgRofPxmVgp4DL7uTGdicC/iVUxOkKcvTnWQdHhqbOs5BiwCFyIW4+j0x48IiKzw/ ZhbxXvxSPXkmJDZOwTmZXogQ3+etgqaCTSyYvk0tk1qEHDNj+ExirRSdne3eIAItLUYt1V0MFPV2E l9KjBk6I5h3+5VGCJtLjgHH4NOlD4hN40Sn5OuI9MbBzFG7BTSc0bb/1sfui+ettLHBUPB7KxMtY7 9xCft2iZR2+LPD5xQcsRQUiPHB5qvSwwRnHZsc7Y4b+zUZVRjdH3XwFNJPOiw4l+/gh3wxo6LUAy3 jZjmIc6vzzYDoVgNmIxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjhFk-009DIk-0P; Fri, 22 Sep 2023 14:35:32 +0000 Received: from mgamail.intel.com ([192.55.52.43]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjhFg-009DIK-37 for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2023 14:35:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695393328; x=1726929328; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=nBdjcYkSZ8EzFUwfpHhwC6yu0/jZkLM6N9BlmSP/mkw=; b=G+tc//qKrAJv39r8T6tUvNn3y21/7fSc04CNNNJjcas24ALl3IvaVeRj Ool097PJ3iUEH9IrnHBE7QSBRAwJILx7uAVCC91f27Wr4Q5nLjFXEzek9 u7itYp0/Q8XXJmbdepiVymK7N5B8ywCly5RPpowVISYekOdv3SVpkG3w/ ePOHvV+NobFtVAevNDHltCVDeGRrK1KhzlL8o5iW6GJIgN8ATH7HtQnH1 VgYO7ID0VwemifJhSbHoC3ID1axH8sw3c0NpMRGqYLlA6szY19cWEF70l DqzRwSSAAnvTRGfjKtq79fhGDnNAXtpHgBwxEZRU89pGWzp6io/OQHfvA Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="467138062" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="467138062" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 07:35:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10841"; a="921181698" X-IronPort-AV: E=Sophos;i="6.03,167,1694761200"; d="scan'208";a="921181698" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga005.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2023 07:35:23 -0700 Received: from andy by smile.fi.intel.com with local (Exim 4.97-RC0) (envelope-from ) id 1qjhFX-0000000HD0X-3fE8; Fri, 22 Sep 2023 17:35:19 +0300 Date: Fri, 22 Sep 2023 17:35:19 +0300 From: Andy Shevchenko To: Alexander Potapenko , Alexander Lobakin Cc: catalin.marinas@arm.com, will@kernel.org, pcc@google.com, andreyknvl@gmail.com, linux@rasmusvillemoes.dk, yury.norov@gmail.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, eugenis@google.com, syednwaris@gmail.com, william.gray@linaro.org Subject: Re: [PATCH v5 0/5] Implement MTE tag compression for swapped pages Message-ID: References: <20230922080848.1261487-1-glider@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230922080848.1261487-1-glider@google.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230922_073529_142043_08E91A58 X-CRM114-Status: GOOD ( 23.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org +Cc: Olek, who internally is being developed something similar to your first patch here. On Fri, Sep 22, 2023 at 10:08:42AM +0200, Alexander Potapenko wrote: > Currently, when MTE pages are swapped out, the tags are kept in the > memory, occupying PAGE_SIZE/32 bytes per page. This is especially > problematic for devices that use zram-backed in-memory swap, because > tags stored uncompressed in the heap effectively reduce the available > amount of swap memory. > > The RLE-based algorithm suggested by Evgenii Stepanov and implemented in > this patch series is able to efficiently compress fixed-size tag buffers, > resulting in practical compression ratio between 2.5x and 4x. In most > cases it is possible to store the compressed data in 63-bit Xarray values, > resulting in no extra memory allocations. > > Our measurements show that the proposed algorithm provides better > compression than existing kernel compression algorithms (LZ4, LZO, > LZ4HC, ZSTD) can offer. > > To implement compression/decompression, we also extend > with methods to read/write bit values at arbitrary places in the map. > > We refactor arch/arm64/mm/mteswap.c to support both the compressed > (CONFIG_ARM64_MTE_COMP) and non-compressed case. For the former, in > addition to tag compression, we move tag allocation from kmalloc() to > separate kmem caches, providing greater locality and relaxing the > alignment requirements. > > v5: > - fixed comments by Andy Shevchenko, Catalin Marinas, and Yury Norov > - added support for 16K- and 64K pages > - more efficient bitmap_write() implementation > > v4: > - fixed a bunch of comments by Andy Shevchenko and Yury Norov > - added Documentation/arch/arm64/mte-tag-compression.rst > > v3: > - as suggested by Andy Shevchenko, use > bitmap_get_value()/bitmap_set_value() written by Syed Nayyar Waris > - switched to unsigned long to reduce typecasts > - simplified the compression code > > v2: > - as suggested by Yuri Norov, replace the poorly implemented struct > bitq with > > > > Alexander Potapenko (4): > lib/test_bitmap: add tests for bitmap_{read,write}() > arm64: mte: implement CONFIG_ARM64_MTE_COMP > arm64: mte: add a test for MTE tags compression > arm64: mte: add compression support to mteswap.c > > Syed Nayyar Waris (1): > lib/bitmap: add bitmap_{read,write}() > > Documentation/arch/arm64/index.rst | 1 + > .../arch/arm64/mte-tag-compression.rst | 245 +++++++++ > arch/arm64/Kconfig | 21 + > arch/arm64/include/asm/mtecomp.h | 13 + > arch/arm64/mm/Makefile | 7 + > arch/arm64/mm/mtecomp.c | 467 ++++++++++++++++++ > arch/arm64/mm/mtecomp.h | 12 + > arch/arm64/mm/mteswap.c | 20 +- > arch/arm64/mm/mteswap.h | 12 + > arch/arm64/mm/mteswap_comp.c | 60 +++ > arch/arm64/mm/mteswap_nocomp.c | 38 ++ > arch/arm64/mm/test_mtecomp.c | 287 +++++++++++ > include/linux/bitmap.h | 68 +++ > lib/test_bitmap.c | 115 +++++ > 14 files changed, 1355 insertions(+), 11 deletions(-) > create mode 100644 Documentation/arch/arm64/mte-tag-compression.rst > create mode 100644 arch/arm64/include/asm/mtecomp.h > create mode 100644 arch/arm64/mm/mtecomp.c > create mode 100644 arch/arm64/mm/mtecomp.h > create mode 100644 arch/arm64/mm/mteswap.h > create mode 100644 arch/arm64/mm/mteswap_comp.c > create mode 100644 arch/arm64/mm/mteswap_nocomp.c > create mode 100644 arch/arm64/mm/test_mtecomp.c > > -- > 2.42.0.515.g380fc7ccd1-goog > -- With Best Regards, Andy Shevchenko _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel