| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Frontswap frontend |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Copyright (C) 2009-2012 Oracle Corp. All rights reserved. |
|---|
| 9 | 10 | * Author: Dan Magenheimer |
|---|
| 10 | | - * |
|---|
| 11 | | - * This work is licensed under the terms of the GNU GPL, version 2. |
|---|
| 12 | 11 | */ |
|---|
| 13 | 12 | |
|---|
| 14 | 13 | #include <linux/mman.h> |
|---|
| .. | .. |
|---|
| 62 | 61 | static u64 frontswap_invalidates; |
|---|
| 63 | 62 | |
|---|
| 64 | 63 | static inline void inc_frontswap_loads(void) { |
|---|
| 65 | | - frontswap_loads++; |
|---|
| 64 | + data_race(frontswap_loads++); |
|---|
| 66 | 65 | } |
|---|
| 67 | 66 | static inline void inc_frontswap_succ_stores(void) { |
|---|
| 68 | | - frontswap_succ_stores++; |
|---|
| 67 | + data_race(frontswap_succ_stores++); |
|---|
| 69 | 68 | } |
|---|
| 70 | 69 | static inline void inc_frontswap_failed_stores(void) { |
|---|
| 71 | | - frontswap_failed_stores++; |
|---|
| 70 | + data_race(frontswap_failed_stores++); |
|---|
| 72 | 71 | } |
|---|
| 73 | 72 | static inline void inc_frontswap_invalidates(void) { |
|---|
| 74 | | - frontswap_invalidates++; |
|---|
| 73 | + data_race(frontswap_invalidates++); |
|---|
| 75 | 74 | } |
|---|
| 76 | 75 | #else |
|---|
| 77 | 76 | static inline void inc_frontswap_loads(void) { } |
|---|
| .. | .. |
|---|
| 88 | 87 | * |
|---|
| 89 | 88 | * This would not guards us against the user deciding to call swapoff right as |
|---|
| 90 | 89 | * we are calling the backend to initialize (so swapon is in action). |
|---|
| 91 | | - * Fortunatly for us, the swapon_mutex has been taked by the callee so we are |
|---|
| 90 | + * Fortunately for us, the swapon_mutex has been taken by the callee so we are |
|---|
| 92 | 91 | * OK. The other scenario where calls to frontswap_store (called via |
|---|
| 93 | 92 | * swap_writepage) is racing with frontswap_invalidate_area (called via |
|---|
| 94 | 93 | * swapoff) is again guarded by the swap subsystem. |
|---|
| .. | .. |
|---|
| 414 | 413 | } |
|---|
| 415 | 414 | |
|---|
| 416 | 415 | /* |
|---|
| 417 | | - * Used to check if it's necessory and feasible to unuse pages. |
|---|
| 418 | | - * Return 1 when nothing to do, 0 when need to shink pages, |
|---|
| 416 | + * Used to check if it's necessary and feasible to unuse pages. |
|---|
| 417 | + * Return 1 when nothing to do, 0 when need to shrink pages, |
|---|
| 419 | 418 | * error code when there is an error. |
|---|
| 420 | 419 | */ |
|---|
| 421 | 420 | static int __frontswap_shrink(unsigned long target_pages, |
|---|
| .. | .. |
|---|
| 447 | 446 | void frontswap_shrink(unsigned long target_pages) |
|---|
| 448 | 447 | { |
|---|
| 449 | 448 | unsigned long pages_to_unuse = 0; |
|---|
| 450 | | - int uninitialized_var(type), ret; |
|---|
| 449 | + int type, ret; |
|---|
| 451 | 450 | |
|---|
| 452 | 451 | /* |
|---|
| 453 | 452 | * we don't want to hold swap_lock while doing a very |
|---|