From patchwork Wed Mar 31 13:09:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1460531 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=nWsHGLGv; 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=g6mYa4wo; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4F9RZW2PcLz9sW4 for ; Thu, 1 Apr 2021 00:13:07 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=1a57QNFv2KBgZSkigna5wny1/rKNpDtwOx13UvOqrb8=; b=nWsHGLGvjMw1tbo72MEuyKw+X 1jXdM3l/EMFfvojw8wXxJaNOvXE/+QySoKP20OSJ4vByAvd+OUoqMyHL+HeZzXNg9mWPJfjc0ytJc QsOqaqDl8dyetlMY89y20jfNNG5SnUL8MOQBcgRYkiI6qVl39PVyppPMIkD/xZGPOVlpqiuj15CJZ jJzxdG8uDavB8cpunpU1rppqPjxyJ28o3dFl5Yn5nyuCf5+gucW+Fbfy5GJ9oAiWQgMXjx/XYOr9q hrmKffcdqGXEf3E1N6RhOwp9G3XPdyZ4Ut2pXLQRuVJ721vSKGhRuxdWzfxfFJq/jjwUddgnuFy+R HckrXx7Hw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRac5-006cNi-RG; Wed, 31 Mar 2021 13:10:26 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRabw-006cLN-8f for openwrt-devel@lists.openwrt.org; Wed, 31 Mar 2021 13:10:19 +0000 Received: by mail-io1-xd34.google.com with SMTP id n198so20101821iod.0 for ; Wed, 31 Mar 2021 06:10:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=ixGzb7370Sp6t3IRsJPZhGMjFi8ZNxfYBK9rueto6to=; b=g6mYa4woRFz5X3sTXjpkMXFxxL5PZzBV/X+sRU5myTJKDAKbzzxgeSjYcwjC6kAIpN XMVV+5wi1IJhkevVEg8H+lfnnZagt4wsN7Ew1dywM1p8cSGwLOCbmfOw+iKaXruNAKGL X12b1/ecSbfFygaEt1BbtvIZcgolw+lBl1mH2ENS6KUQy7yEZlvPFUdUFD8e6tD3JspC hJASbpUrC6WCwrPaSaLnBvRaksCcz1vIQ5VXZch7yjNkv7lyue2XDqLnSyISrLQSmmKo 0F6ZElcBGJ1CjPpii0sEthqPY2PIRuy94GWBBXs+LoxLhZhh+nZG9JLc1QL9FY0G841N cbZw== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=ixGzb7370Sp6t3IRsJPZhGMjFi8ZNxfYBK9rueto6to=; b=Hi3JX+FKpKl8MlaEAd5/Y4drsoX54K2OM42lFNLzzvUNECpU4n37de6QlyQQLdTnhX TJEcPcdpruCFfgijKfkyNwo8D4vj0KWNLxAVsrfBOcyUOavdIKMi9PEQ1Ac1n6TO2sk9 d6N4pWPHW6eCBFzR8TC0cGT+YvwQ6F1Ndh30Pn7CPYAW7F50j7xkjatT6cJidONm+Fca sInHaf0FMtllyRqSq+rb8L2mx47GuMGPAUjqh/S7Mi1qHU6/T0vSCdOEv9vUauXGHJnX sso4z25MRbgZR+gQL1g0fkuDdx8LNfIp6I0wHdpXvcdr1XftMTviHps5SP0FUi19tjAA ge+w== X-Gm-Message-State: AOAM530tUkvZNpMlstRxr686JN31H/vLslA5jhUYCDZSGfDXrGu5/kmD bYJ2YyfrRUO5jcIwM5QWsZ1yvh88dsIM X-Google-Smtp-Source: ABdhPJwje7TTm1gjyM4UDfvqrxF3IuKiJn+OucrBf7IncUVrPYJYOyjXdVekYcE/pB2QJXHGHaforg== X-Received: by 2002:a5e:d907:: with SMTP id n7mr2316601iop.177.1617196214547; Wed, 31 Mar 2021 06:10:14 -0700 (PDT) Received: from mallard.lan (a95-94-147-174.cpe.netcabo.pt. [95.94.147.174]) by smtp.gmail.com with ESMTPSA id 13sm1121016ioz.40.2021.03.31.06.10.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 06:10:14 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH 1/2] zram-swap: clean up the makefile Date: Wed, 31 Mar 2021 14:09:58 +0100 Message-Id: <20210331130959.653229-2-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210331130959.653229-1-rsalvaterra@gmail.com> References: <20210331130959.653229-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210331_141017_255657_B06FCA13 X-CRM114-Status: UNSURE ( 9.06 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Break dependencies into separate lines, to improve the readability. Trim trailing whitespace. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:d34 listed in] [list.dnswl.org] 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.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jo@mein.io, mail@david-bauer.net, Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Break dependencies into separate lines, to improve the readability. Trim trailing whitespace. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/Makefile | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/package/system/zram-swap/Makefile b/package/system/zram-swap/Makefile index 18c6afee96..96cdcdc5ee 100644 --- a/package/system/zram-swap/Makefile +++ b/package/system/zram-swap/Makefile @@ -17,14 +17,20 @@ include $(INCLUDE_DIR)/package.mk define Package/zram-swap SECTION:=utils CATEGORY:=Base system - DEPENDS:=+kmod-zram +@BUSYBOX_CONFIG_MKSWAP +@BUSYBOX_CONFIG_SWAPON +@BUSYBOX_CONFIG_FEATURE_SWAPON_DISCARD +@BUSYBOX_CONFIG_FEATURE_SWAPON_PRI +@BUSYBOX_CONFIG_SWAPOFF + DEPENDS:= \ + +kmod-zram \ + +@BUSYBOX_CONFIG_MKSWAP \ + +@BUSYBOX_CONFIG_SWAPON \ + +@BUSYBOX_CONFIG_FEATURE_SWAPON_DISCARD \ + +@BUSYBOX_CONFIG_FEATURE_SWAPON_PRI \ + +@BUSYBOX_CONFIG_SWAPOFF TITLE:=ZRAM swap scripts PKGARCH:=all endef define Package/zram-swap/description - A script to activate swaping on a compressed zram partition. This - could be used to increase the available memory, by using compressed + A script to activate swaping on a compressed zram partition. This + could be used to increase the available memory, by using compressed memory. endef From patchwork Wed Mar 31 13:09:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rui Salvaterra X-Patchwork-Id: 1460530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1:d65d:64ff:fe57:4e05; helo=desiato.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=desiato.20200630 header.b=ox7Pw0Rn; 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=mO+EdN5L; dkim-atps=neutral Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) (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 4F9RZW1Dmjz9sW0 for ; Thu, 1 Apr 2021 00:13:07 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: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:List-Owner; bh=XPfFwApqoOyOYjRIQRlXkkjdkuB9KjVZTTgVQe5FgPc=; b=ox7Pw0Rn8iQgxi4QhkzHRy1LZ L0z3E8gi43k2RdASsTY3EqhQwFp+olCkF7Iznav+DTeAFeiZltdnEYaqCXE5wAQzhPWRD58XiCXJ5 WM5aVkxtX3/fA9QtkxLY5TsfE092wkgl+4u60oHB89fwX7WCA1D6fySxDIVPU7EM1CzzQeCoTrGoJ aVA0NA9KQJ74NGZyYxdJf4bcdrJffYioxIrGIy1LL3cffmSxlbuIhLh/RRUx6303RpyAPIGWJ93HI epbms65WJbGQqIKwsi/FC/m1nZUgihmPQn23gnncdHppFIEBFa8qDw8kKfEZw8hARveTJQncuwt1v 5q2jvbTOw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lRace-006cU3-Rh; Wed, 31 Mar 2021 13:11:01 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lRaby-006cLh-1g for openwrt-devel@lists.openwrt.org; Wed, 31 Mar 2021 13:10:21 +0000 Received: by mail-io1-xd2c.google.com with SMTP id z3so20018919ioc.8 for ; Wed, 31 Mar 2021 06:10:17 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=HDckVIcXXjzZWfXI1v9m60CaukGMvC4yg9ot/eREwCg=; b=mO+EdN5L1VHRB+iEan/eUrIDqd5Og1vHEKiy7P1Z6aSaqEKnuVlj/0B7PoUWYcu0V1 o0PXmkKAbyNCAm3B6YQYcAslvk7juyE2TFyb1VZyj+5J+7N0rtMIJ7OXtUyZmgL9kCVA jb9SLuDGoj14MVOTBcT0qYZOhLDMKTuNwDj+e8cFv33WxpTsX2c/TOQTisC0wnO5hTYp zDYLjuTsmgbTgJnsBFVtm6ducyfsyWnVDH3WMsgtHfGmijC+Ov6eZ0PXwxbWTnpZkBMR k3GLRjDlUiD2FVQzLCkj+rm3Md8Mmm5pddqYXSFxo8J66+hAwo+Ow309BjDrS9xjxdaH 3hoA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HDckVIcXXjzZWfXI1v9m60CaukGMvC4yg9ot/eREwCg=; b=q/oB1SLZj8MQCmxLuDtnSpxk4pKuPxyZ33K4zSknM5rNfhERQEiPaG0YcoEy7uqPkL xQM+O1hITvfXiLdnlLKCTl38GNGivcLBXD0h4wRAGvbZVHeDcG5YUICOc2qA2JGj/XEN A9Khq93g7azjXNKeiwi5Kq9VaxTXOBdPYCfyzmrTHBffzKdRoL2idbVOQwtHa0g39IPk xtrYKAWJkyAKa/oD8iIxFQNTidCm9bFNY8boVSl0sqrNfV5XebNsf2wU6PjQLw6Tl5bD ZqzIeCVdIizDuPkzIgLEmYamqfRiW/Owsed8sucpypQI2pMdaT5OXOhv8sca5iGRnZ2X gNFw== X-Gm-Message-State: AOAM533d3sG+tGgAoWi12YVn3dfMUJ3fsIQAFm3aXQCOF8Jx39w3pzUw DuFXQQE5nVjFd203iNhyawfAGkkIvRqM X-Google-Smtp-Source: ABdhPJymIUpqdOe9BC5d9wM8GucIBg8BicoNaNrxANQNd4cx1Xzo17zTbctRO+4QdJb9uuTN+uGymA== X-Received: by 2002:a05:6602:1689:: with SMTP id s9mr2167399iow.171.1617196216305; Wed, 31 Mar 2021 06:10:16 -0700 (PDT) Received: from mallard.lan (a95-94-147-174.cpe.netcabo.pt. [95.94.147.174]) by smtp.gmail.com with ESMTPSA id 13sm1121016ioz.40.2021.03.31.06.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Mar 2021 06:10:15 -0700 (PDT) From: Rui Salvaterra To: openwrt-devel@lists.openwrt.org Subject: [PATCH 2/2] zram-swap: bail out early if the kernel doesn't support swap Date: Wed, 31 Mar 2021 14:09:59 +0100 Message-Id: <20210331130959.653229-3-rsalvaterra@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210331130959.653229-1-rsalvaterra@gmail.com> References: <20210331130959.653229-1-rsalvaterra@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210331_141018_587213_1B516D5F X-CRM114-Status: GOOD ( 10.53 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "desiato.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Since KERNEL_SWAP is only enabled by default for !SMALL_FLASH targets, we need to check if the current kernel supports swap before trying to configure zram-swap, as opkg can't check for kernel depende [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:d2c listed in] [list.dnswl.org] 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.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -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_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jo@mein.io, mail@david-bauer.net, Rui Salvaterra Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Since KERNEL_SWAP is only enabled by default for !SMALL_FLASH targets, we need to check if the current kernel supports swap before trying to configure zram-swap, as opkg can't check for kernel dependencies. Signed-off-by: Rui Salvaterra --- package/system/zram-swap/files/zram.init | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/system/zram-swap/files/zram.init b/package/system/zram-swap/files/zram.init index 685648aae5..d97e85efa5 100755 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -150,6 +150,11 @@ zram_compact() start() { + [ -e /proc/swaps ] || { + logger -s -t zram_start -p daemon.crit "kernel doesn't support swap" + return 1 + } + if [ $( grep -cs zram /proc/swaps ) -ne 0 ]; then logger -s -t zram_start -p daemon.notice "[OK] zram swap is already mounted" return 1