projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d4b2e0d
)
lru_cache: use atomic operations when accessing lc->flags, always
author
Lars Ellenberg
<lars.ellenberg@linbit.com>
Tue, 22 Nov 2022 13:42:58 +0000
(14:42 +0100)
committer
Jens Axboe
<axboe@kernel.dk>
Wed, 23 Nov 2022 02:38:39 +0000
(19:38 -0700)
Or, depending on the way locking is implemented at the call sites,
some updates could be lost (has not been observed).
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Link:
https://lore.kernel.org/r/20221122134301.69258-2-christoph.boehmwalder@linbit.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
lib/lru_cache.c
patch
|
blob
|
history
diff --git
a/lib/lru_cache.c
b/lib/lru_cache.c
index
dc35464
..
fec8993
100644
(file)
--- a/
lib/lru_cache.c
+++ b/
lib/lru_cache.c
@@
-364,7
+364,7
@@
static struct lc_element *__lc_get(struct lru_cache *lc, unsigned int enr, unsig
struct lc_element *e;
PARANOIA_ENTRY();
- if (
lc->flags & LC_STARVING
) {
+ if (
test_bit(__LC_STARVING, &lc->flags)
) {
++lc->starving;
RETURN(NULL);
}
@@
-417,7
+417,7
@@
static struct lc_element *__lc_get(struct lru_cache *lc, unsigned int enr, unsig
* the LRU element, we have to wait ...
*/
if (!lc_unused_element_available(lc)) {
-
__
set_bit(__LC_STARVING, &lc->flags);
+ set_bit(__LC_STARVING, &lc->flags);
RETURN(NULL);
}