From patchwork Fri May 29 20:00:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Orti Alcaine X-Patchwork-Id: 478042 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 05C06140F96 for ; Sat, 30 May 2015 06:00:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=YVx28ynx; dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 748D128BEDE; Fri, 29 May 2015 21:59:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id AEC04281685 for ; Fri, 29 May 2015 21:59:07 +0200 (CEST) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wg0-f42.google.com (mail-wg0-f42.google.com [74.125.82.42]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Fri, 29 May 2015 21:59:06 +0200 (CEST) Received: by wgbgq6 with SMTP id gq6so71382037wgb.3 for ; Fri, 29 May 2015 13:00:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3U64hSmUY2HVIKPYXn17AzudVnn1BrUcLX+G2PEIF0U=; b=YVx28ynxxvrB4x5j/Wwj+6Sjn9matvX91W6xk4S7T1NF11w6VrO1bmaJBMfwxtEWDK eFL4CTQEhVgvt1xTy0mWv8AKDYDpWKCfz4y4k/nU0DQomZPh+39NG9Z/I+DIYDulhAmp 6OtxquFjTbNJDbrOQe7Ldc5+pMtMWZ7GVAwg6wDbIAPQEMQ9iJEma2qykUTRa0m2qYeC 0Wj9xCNnK4ceNkE+9A5gff/sVVFySLhF+IHlgP3mH4tiUozjYtnWVBagqkY6vJIJ1sW9 /SCN1nAv1YY/AI8571sNRm8yMJA75r/s4W+XiumpeqUGhZcvV38c/PQ9FYM8LJrO1Iqp w+FA== X-Received: by 10.180.107.138 with SMTP id hc10mr9691300wib.2.1432929636581; Fri, 29 May 2015 13:00:36 -0700 (PDT) Received: from xenon.lan (62.101.174.132.dyn.user.ono.com. [62.101.174.132]) by mx.google.com with ESMTPSA id g14sm9743574wjs.47.2015.05.29.13.00.35 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 May 2015 13:00:35 -0700 (PDT) From: Juan Orti Alcaine To: openwrt-devel@lists.openwrt.org Date: Fri, 29 May 2015 22:00:32 +0200 Message-Id: <1432929632-19956-1-git-send-email-j.orti.alcaine@gmail.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1432505332-18899-1-git-send-email-j.orti.alcaine@gmail.com> References: <1432505332-18899-1-git-send-email-j.orti.alcaine@gmail.com> Subject: [OpenWrt-Devel] [PATCH v2] zram-swap: set a high priority for the swap X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" The zram swap must be activated with a higher priority than disk-based swap, so it is used before any other. This patch activates the zram-based swap with a priority of 100. --- v2: Fallback to no priority when swapon doesn't support it. Signed-off-by: Juan Orti Alcaine --- 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 23de915..44f75dd 100644 --- a/package/system/zram-swap/files/zram.init +++ b/package/system/zram-swap/files/zram.init @@ -100,7 +100,7 @@ start() zram_reset "$zram_dev" "enforcing defaults" echo $(( $zram_size * 1024 * 1024 )) >"/sys/block/$( basename $zram_dev )/disksize" mkswap "$zram_dev" - swapon "$zram_dev" + swapon -p 100 "$zram_dev" || swapon "$zram_dev" } done }