hc
2024-09-20 cf4ce59b3b70238352c7f1729f0f7223214828ad
kernel/mm/frontswap.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Frontswap frontend
34 *
....@@ -7,8 +8,6 @@
78 *
89 * Copyright (C) 2009-2012 Oracle Corp. All rights reserved.
910 * Author: Dan Magenheimer
10
- *
11
- * This work is licensed under the terms of the GNU GPL, version 2.
1211 */
1312
1413 #include <linux/mman.h>
....@@ -62,16 +61,16 @@
6261 static u64 frontswap_invalidates;
6362
6463 static inline void inc_frontswap_loads(void) {
65
- frontswap_loads++;
64
+ data_race(frontswap_loads++);
6665 }
6766 static inline void inc_frontswap_succ_stores(void) {
68
- frontswap_succ_stores++;
67
+ data_race(frontswap_succ_stores++);
6968 }
7069 static inline void inc_frontswap_failed_stores(void) {
71
- frontswap_failed_stores++;
70
+ data_race(frontswap_failed_stores++);
7271 }
7372 static inline void inc_frontswap_invalidates(void) {
74
- frontswap_invalidates++;
73
+ data_race(frontswap_invalidates++);
7574 }
7675 #else
7776 static inline void inc_frontswap_loads(void) { }
....@@ -88,7 +87,7 @@
8887 *
8988 * This would not guards us against the user deciding to call swapoff right as
9089 * 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
9291 * OK. The other scenario where calls to frontswap_store (called via
9392 * swap_writepage) is racing with frontswap_invalidate_area (called via
9493 * swapoff) is again guarded by the swap subsystem.
....@@ -414,8 +413,8 @@
414413 }
415414
416415 /*
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,
419418 * error code when there is an error.
420419 */
421420 static int __frontswap_shrink(unsigned long target_pages,
....@@ -447,7 +446,7 @@
447446 void frontswap_shrink(unsigned long target_pages)
448447 {
449448 unsigned long pages_to_unuse = 0;
450
- int uninitialized_var(type), ret;
449
+ int type, ret;
451450
452451 /*
453452 * we don't want to hold swap_lock while doing a very