Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp730406imu; Mon, 5 Nov 2018 07:59:23 -0800 (PST) X-Google-Smtp-Source: AJdET5cO2Pi5ykhe293tWUngdGQuXtdKz3NspzkduKE9s4om6YTgkA52g8Jtwhh0Ftwfs4izBqrY X-Received: by 2002:a65:47ca:: with SMTP id f10mr3423737pgs.166.1541433563318; Mon, 05 Nov 2018 07:59:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541433563; cv=none; d=google.com; s=arc-20160816; b=lF9SVdC+e0sXB49dDo4iYLQP4WwPjsMSRNPIiKwKOYfm4qpwFSNOYgtR2imAQdOjID KMunykXFe1pOJqxJqlek5J1H+G6uNzfS0CXeW0MHhE7Bo2eptDJ3EKnzdU3eVuDN8SZ8 8vpxcnN7dTehc/7JmHp/0ood1RRVczOqSjuxNYmyRh4aEu4ILPu7inOyVyDJR0e2lTMA JrzkCYj80UJu72mzl2+2eNKCiu/nLa1dOakNvohXLSO5XrMb/vQgRfcnPA2gwH7LEwY6 AGoqKW5R8WeXryGLRaNIZKml3Jm+ut7T0UC2CQ/wBCylip7iatKaeOyKyPwDM6Jf3v38 rAyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=qj0g/ElrxUHs7C7xNuDXIWiNL1w6vHUhngXWfG8cRwo=; b=auE5+rBRU7TFzqN7d0ec7nN9dpT+aruMQAhLEofY0YH2E9oHABN89elqEGc2oQdZ+T yYfK5dNMwF9ZR47B5HGTi8RYZQU1Ch3bCgIpek+WLgJPZz6GG4L6wWzLIZTdOudmrMbT JO45PnpboZZH7XkEztJsjvs3A4aE3wffelyNrC04JVk+I0/JqHtDaxZnmz2ZgHcQ+BjG BCe38cSR04ZItSbMPBq8PWMAoIBeHtb04pwBnQdP6i/fggUTZgNhvaFmOlxeeq+UB3JY 6uNyugWaHYenLchILyJyx5TXZ4aJLAuBAJnLK9wBbdfXqdALCDkKPnptKPraaEE8tmWX 1NVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 2si7707955pgy.35.2018.11.05.07.59.07; Mon, 05 Nov 2018 07:59:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730087AbeKFBSj (ORCPT + 99 others); Mon, 5 Nov 2018 20:18:39 -0500 Received: from tartarus.angband.pl ([54.37.238.230]:35930 "EHLO tartarus.angband.pl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729980AbeKFBSj (ORCPT ); Mon, 5 Nov 2018 20:18:39 -0500 Received: from kilobyte by tartarus.angband.pl with local (Exim 4.89) (envelope-from ) id 1gJhGZ-0001zh-CP; Mon, 05 Nov 2018 16:58:15 +0100 Date: Mon, 5 Nov 2018 16:58:15 +0100 From: Adam Borowski To: Pintu Agarwal Cc: linux-mm@kvack.org, open list , kernelnewbies@kernelnewbies.org Subject: Re: Creating compressed backing_store as swapfile Message-ID: <20181105155815.i654i5ctmfpqhggj@angband.pl> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Junkbait: aaron@angband.pl, zzyx@angband.pl User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kilobyte@angband.pl X-SA-Exim-Scanned: No (on tartarus.angband.pl); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 05, 2018 at 08:31:46PM +0530, Pintu Agarwal wrote: > Hi, > > I have one requirement: > I wanted to have a swapfile (64MB to 256MB) on my system. > But I wanted the data to be compressed and stored on the disk in my swapfile. > [Similar to zram, but compressed data should be moved to disk, instead of RAM]. > > Note: I wanted to optimize RAM space, so performance is not important > right now for our requirement. > > So, what are the options available, to perform this in 4.x kernel version. > My Kernel: 4.9.x > Board: any - (arm64 mostly). > > As I know, following are the choices: > 1) ZRAM: But it compresses and store data in RAM itself > 2) frontswap + zswap : Didn't explore much on this, not sure if this > is helpful for our case. > 3) Manually creating swapfile: but how to compress it ? > 4) Any other options ? Loop device on any filesystem that can compress (such as btrfs)? The performance would suck, though -- besides the indirection of loop, btrfs compresses in blocks of 128KB while swap wants 4KB writes. Other similar option is qemu-nbd -- it can use compressed disk images and expose them to a (local) nbd client. Meow! -- ⢀⣴⠾⠻⢶⣦⠀ Have you heard of the Amber Road? For thousands of years, the ⣾⠁⢰⠒⠀⣿⡁ Romans and co valued amber, hauled through the Europe over the ⢿⡄⠘⠷⠚⠋⠀ mountains and along the Vistula, from Gdańsk. To where it came ⠈⠳⣄⠀⠀⠀⠀ together with silk (judging by today's amber stalls).