1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
From d1c503f83a2cf85c6fbf7aab24728a5f0787c54c Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:35:06 -0600
Subject: [PATCH 04/11] LINUX 5.8: use lru_cache_add
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With Linux-5.8-rc1 commit 'mm: fold and remove lru_cache_add_anon() and
lru_cache_add_file()' (6058eaec), the lru_cache_add_file function is
removed since it was functionally equivalent to lru_cache_add.
Replace lru_cache_add_file with lru_cache_add.
Introduce a new autoconf test to determine if lru_cache_add is present
For reference, the Linux changes associated with the lru caches:
__pagevec_lru_add introduced before v2.6.12-rc2
lru_cache_add_file introduced in v2.6.28-rc1
__pagevec_lru_add_file replaces __pagevec_lru_add in v2.6.28-rc1
vmscan: split LRU lists into anon & file sets (4f98a2fee)
__pagevec_lru_add removed in v5.7 with a note to use lru_cache_add_file
mm/swap.c: not necessary to export __pagevec_lru_add() (bde07cfc6)
lru_cache_add_file removed in v5.8
mm: fold and remove lru_cache_add_anon() and lru_cache_add_file()
(6058eaec)
lru_cache_add exported
mm: fold and remove lru_cache_add_anon() and lru_cache_add_file()
(6058eaec)
Openafs will use:
lru_cache_add on 5.8 kernels
lru_cache_add_file from 2.6.28 through 5.7 kernels
__pagevec_lru_add/__pagevec_lru_add_file on pre 2.6.28 kernels
Reviewed-on: https://gerrit.openafs.org/14249
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Yadavendra Yadav <yadayada@in.ibm.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 7d85ce221d6ccc19cf76ce7680c74311e4ed2632)
Change-Id: Iba6ef4441687dbf60d227a708e2a032c2c0dc79f
Reviewed-on: https://gerrit.openafs.org/14269
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Laß <lass@mail.uni-paderborn.de>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
---
src/afs/LINUX/osi_vnodeops.c | 8 +++++++-
src/cf/linux-kernel-func.m4 | 7 +++++++
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index 00995b27a..36a4f685e 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -71,7 +71,7 @@ extern struct vcache *afs_globalVp;
/* Handle interfacing with Linux's pagevec/lru facilities */
-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
/*
* Linux's lru_cache_add_file provides a simplified LRU interface without
@@ -90,7 +90,13 @@ afs_lru_cache_init(struct afs_lru_pages *alrupages)
static inline void
afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page)
{
+# if defined(HAVE_LINUX_LRU_CACHE_ADD)
+ lru_cache_add(page);
+# elif defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
lru_cache_add_file(page);
+# else
+# error need a kernel function to add a page to the kernel lru cache
+# endif
}
static inline void
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index 78ff48294..11d071806 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -147,10 +147,17 @@ AC_CHECK_LINUX_FUNC([inode_lock],
[inode_lock(NULL);])
dnl lru_cache_add_file added to Linux 2.6.28.
+dnl removed in Linux 5.8
AC_CHECK_LINUX_FUNC([lru_cache_add_file],
[#include <linux/swap.h>],
[lru_cache_add_file(NULL);])
+dnl lru_cache_add exported in Linux 5.8
+dnl replaces lru_cache_add_file
+AC_CHECK_LINUX_FUNC([lru_cache_add],
+ [#include <linux/swap.h>],
+ [lru_cache_add(NULL);])
+
dnl Linux 5.8 replaced kernel_setsockopt with helper functions
dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
AC_CHECK_LINUX_FUNC([ip_sock_set],
--
2.31.1
|