Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3332831imu; Sun, 11 Nov 2018 12:34:29 -0800 (PST) X-Google-Smtp-Source: AJdET5eeoAOcGRibgo9CnDp9MvK7adHCFmHmtKRAR7MzxYlxsJQpzy6fqdcXS6Ou2YSJy1TQ3Loi X-Received: by 2002:a17:902:9f98:: with SMTP id g24-v6mr5422554plq.102.1541968469793; Sun, 11 Nov 2018 12:34:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541968469; cv=none; d=google.com; s=arc-20160816; b=GSuUB1xtxWkeJbtTBIYpzDVUyJ82Tx43j/z5BPPTai+nTve/jSZdE02MEm4zku2zNB Ot0XLl3SLliAZXPFBynPYkU+7MwRpedzNH2Z0WR6T3Ssij7Rqdh/OKs2U6CU/GqOQunB DzqlQvs2JVSlPLbTTLOfAStZpkqhrF8LxnHUPTGRyYBjbjQweXzJ9Vh+fbepjqapX9DZ 7NZA0C/0eHf1zrsNrv3hDPKFAqNK1D4pLlCPtBVOVfDx+pRlOKNj/sD3vpgAqUmRRWaL byRnKLAb7p/tev3qF9QyDFUrfnaPrEpvMLOsTPLy3YAm3q5NxPOPO7++eJvLY+oIEjaU 4wfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=LxHbDgVJoMYnTBJrLl6GGpi8uZpAH4u9/csjl8z/T5w=; b=Bj42Luzsap8FUgsjhGl0WrEVUi8ibIcj8W3iDG6s874IK9bYUR4CVdDSHId8c3kfFl WYGtEw0ICOaSGRSWUaH4ffPA16KQg8ITNjWv6ReWnAeyPz8cTC+vM//AsirJv2MdE87X cAK7UuO+c8RiKVqoz7ekgKCn2Reerpv3QwqmypI2re4T5OtZySBdIi/UvEU7B86hUyWO vE8EJpxfqivEYH0qoxAIJgKztPGkoMi+4IxCLq9b+f5t03VJc3v9RWPAnyuSFNx0QQHj IHhW7pPdyxj3oRAoZnR+x4eXVn7oWeO6oTkHvPNCVSWDoUJ7KhuFuC6r90juzjNUiPl7 Dorg== 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 y35-v6si14051755pgl.14.2018.11.11.12.34.14; Sun, 11 Nov 2018 12:34:29 -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 S1730315AbeKLFsQ (ORCPT + 99 others); Mon, 12 Nov 2018 00:48:16 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:50036 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729507AbeKLFsO (ORCPT ); Mon, 12 Nov 2018 00:48:14 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvsZ-0000lJ-7q; Sun, 11 Nov 2018 19:58:43 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsW-0001iP-4c; Sun, 11 Nov 2018 19:58:40 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Vineet Gupta" , "Alexey Brodkin" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 243/366] ARC: Fix CONFIG_SWAP In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Alexey Brodkin commit 6e3761145a9ba3ce267c330b6bff51cf6a057b06 upstream. swap was broken on ARC due to silly copy-paste issue. We encode offset from swapcache page in __swp_entry() as (off << 13) but were not decoding back in __swp_offset() as (off >> 13) - it was still (off << 13). This finally fixes swap usage on ARC. | # mkswap /dev/sda2 | | # swapon -a -e /dev/sda2 | Adding 500728k swap on /dev/sda2. Priority:-2 extents:1 across:500728k | | # free | total used free shared buffers cached | Mem: 765104 13456 751648 4736 8 4736 | -/+ buffers/cache: 8712 756392 | Swap: 500728 0 500728 Signed-off-by: Alexey Brodkin Signed-off-by: Vineet Gupta Signed-off-by: Ben Hutchings --- arch/arc/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arc/include/asm/pgtable.h +++ b/arch/arc/include/asm/pgtable.h @@ -361,7 +361,7 @@ void update_mmu_cache(struct vm_area_str /* Decode a PTE containing swap "identifier "into constituents */ #define __swp_type(pte_lookalike) (((pte_lookalike).val) & 0x1f) -#define __swp_offset(pte_lookalike) ((pte_lookalike).val << 13) +#define __swp_offset(pte_lookalike) ((pte_lookalike).val >> 13) /* NOPs, to keep generic kernel happy */ #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })