From patchwork Tue Jun 23 11:29:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1315113 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=aWro4nY3; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=YseObuA8; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49rkh05bz3z9sRN for ; Tue, 23 Jun 2020 21:34:08 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=FrzqnuAPJSi3hDRmSbm86U1rfhyEsghp0YeqxuYFBy4=; b=aWro4nY39NQxQkIxpS4+BM1w6j WB2GODK4Y6XG1cjcNXoHuoI6cldQIXhYXAl003TBbeWOFr4MYrL9EmUfbIn1NcVjn4a4eULEDPruK FSZkFI+9/Dr4WyPehJwwXQMoGYXtDTLqQqaBwVXbC30Xn4y8bjpTWRVsTSqeqKi4C4x4gtG3gYZYr c/9q2HhIsqt8yIlB5sGv3XFzhdEPZVM89s/sPVYj6D8w8WcHsuftwdifGyVv+fTbyh9srGBq3LMqc 7vcmJzoCjdJnq5alVKx0nz3lqbfQvUPj29aO/0RRy26XGSPN4RxvcxVsvJ20wgSpgScmWZOiPkmkW fbKc2iOQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnh85-0004Bx-Jw; Tue, 23 Jun 2020 11:30:17 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnh81-00049V-Qz for openwrt-devel@lists.openwrt.org; Tue, 23 Jun 2020 11:30:15 +0000 Received: by mail-wm1-x342.google.com with SMTP id y20so2832504wmi.2 for ; Tue, 23 Jun 2020 04:30:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rRwrTVT8GP18DEvR30H61bTectNB3lHAgpNKpViFKBY=; b=YseObuA8yPuTxljtfK/ddX0zVfdlWKwVnPDvwUHojEGNKmYYUP+t3EsoO4euuxgw6C S0oc1qZaMkqPvP6sHPe8+dIVAgH77O3HDH0NiWzx9sDZVY3JxdvcD2FiTBAvoEOOy59U R6VQlYaxCqvfxvwBrgkKC9rhwuOiz2YN8QqcsMDDT/9Tu3BBgaDXlhFuGNOS9GwMITim cVJ830sQ7QayHtNTl8lp/6OHBg+bNh10mgi/5ZQMTIkh4+Ls9Dc3pxFpqz9l30hgSZCV uxa5G1WCEpz4gRiQ8Asj71+HSBgZs3zDEiemuZmSh876o2aJEHAY81G2DeNPdckZinqS vecA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rRwrTVT8GP18DEvR30H61bTectNB3lHAgpNKpViFKBY=; b=RG/WFMZxYH8csaYmNjAmEQK8Uvp8en6fdTiXSnjb6O++pFEEKxn3FceoXrAxjW1efq GEpzg14oWtBYywyno3FEl3zzj8maarNkr3jweJmtVM9rFowpFCC0IcnnMipBt3YsYN7v UZ6NEu5I+nfpuXvhIoWSWghCAC9LNkuuJyJvfp4Kd+9+N+Bww8rEkuc4zXmdizfhrGyk gkXUhZlbxClzuQJ4M22P24u0t4U7RPpyDdEntft9hp4cgsYa/vB1pZZGizo6inMz3zvy TRNzOtj9zhePNrehMPAUqYviCCbKGGNhursbiWDX5m9kY5VwdlLzFpdFMeff/huhubEP 3cFw== X-Gm-Message-State: AOAM532wRvA9QOqcX98IpiZx+H5yHBCYx7dvrCpNGv0U/IoNYpCYucR2 3+fKD2TZLPLcuy0p0hjC06zfCljhkQnn X-Google-Smtp-Source: ABdhPJwClfYXzw/Kz359py6QTAEELv2e6e0hbHhdxCoB8VHR1o9Sd0LpE4utA5SbS48yfKjaBDWnOg== X-Received: by 2002:a7b:c92e:: with SMTP id h14mr6221683wml.36.1592911809009; Tue, 23 Jun 2020 04:30:09 -0700 (PDT) Received: from presler.lan (a85-139-207-38.cpe.netcabo.pt. [85.139.207.38]) by smtp.gmail.com with ESMTPSA id a2sm8149869wrn.68.2020.06.23.04.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jun 2020 04:30:08 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH] zram-swap: enable swap discard Date: Tue, 23 Jun 2020 12:29:54 +0100 Message-Id: <20200623112953.3454-1-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:342 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rsalvaterra[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rui Salvaterra , gpm@hotplug.ru, john@phrozen.org Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Zram block devices have supported trim/discard for over six years, let's enable it. This allows the zram device to actually free up allocated memory when it's marked as unused in the filesystem metadata, as explained in more detail in the original commit message [1]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/drivers/block/zram/zram_drv.c?h=linux-4.14.y&id=f4659d8e620d08bd1a84a8aec5d2f5294a242764 Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index 49140ad406..d33e779850 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -182,7 +182,7 @@ start() zram_comp_streams "$zram_dev" echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename "$zram_dev" )/disksize" mkswap "$zram_dev" - swapon $zram_priority "$zram_dev" + swapon -d $zram_priority "$zram_dev" } stop()