[PATCH 4.4 005/107] ARC: Fix CONFIG_SWAP

2018-07-23 Thread Greg Kroah-Hartman
4.4-stable 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 sharedbuffers cached
| Mem:765104  13456 751648   4736  8   4736
| -/+ buffers/cache:   8712 756392
| Swap:   500728  0 500728

Cc: sta...@vger.kernel.org
Signed-off-by: Alexey Brodkin 
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 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
@@ -372,7 +372,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) })




[PATCH 4.4 005/107] ARC: Fix CONFIG_SWAP

2018-07-23 Thread Greg Kroah-Hartman
4.4-stable 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 sharedbuffers cached
| Mem:765104  13456 751648   4736  8   4736
| -/+ buffers/cache:   8712 756392
| Swap:   500728  0 500728

Cc: sta...@vger.kernel.org
Signed-off-by: Alexey Brodkin 
Signed-off-by: Vineet Gupta 
Signed-off-by: Greg Kroah-Hartman 

---
 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
@@ -372,7 +372,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) })