aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/arc.c
diff options
context:
space:
mode:
authorGiuseppe Di Natale <[email protected]>2017-09-16 11:00:19 -0700
committerBrian Behlendorf <[email protected]>2017-09-16 11:00:19 -0700
commit787acae0b5cd139ea0f9fa60558cca28d4673b23 (patch)
tree08561030aefd7cab9e4bf07abdcf23be83078ef5 /module/zfs/arc.c
parent90cdf2833d163dd4db31aded1e6940cc9edb67f6 (diff)
Linux 3.14 compat: IO acct, global_page_state, etc
generic_start_io_acct/generic_end_io_acct in the master branch of the linux kernel requires that the request_queue be provided. Move the logic from freemem in the spl to arc_free_memory in arc.c. Do this so we can take advantage of global_page_state interface checks in zfs. Upstream kernel replaced struct block_device with struct gendisk in struct bio. Determine if the function bio_set_dev exists during configure and have zfs use that if it exists. bio_set_dev https://github.com/torvalds/linux/commit/74d4699 global_node_page_state https://github.com/torvalds/linux/commit/75ef718 io acct https://github.com/torvalds/linux/commit/d62e26b Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Giuseppe Di Natale <[email protected]> Closes #6635
Diffstat (limited to 'module/zfs/arc.c')
-rw-r--r--module/zfs/arc.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/module/zfs/arc.c b/module/zfs/arc.c
index 75f0af9d5..57bf6b83c 100644
--- a/module/zfs/arc.c
+++ b/module/zfs/arc.c
@@ -4665,6 +4665,24 @@ arc_all_memory(void)
#endif
}
+#ifdef _KERNEL
+static uint64_t
+arc_free_memory(void)
+{
+#ifdef ZFS_GLOBAL_NODE_PAGE_STATE
+ return (nr_free_pages() +
+ global_node_page_state(NR_INACTIVE_FILE) +
+ global_node_page_state(NR_INACTIVE_ANON) +
+ global_node_page_state(NR_SLAB_RECLAIMABLE));
+#else
+ return (nr_free_pages() +
+ global_page_state(NR_INACTIVE_FILE) +
+ global_page_state(NR_INACTIVE_ANON) +
+ global_page_state(NR_SLAB_RECLAIMABLE));
+#endif
+}
+#endif
+
typedef enum free_memory_reason_t {
FMR_UNKNOWN,
FMR_NEEDFREE,
@@ -4701,7 +4719,7 @@ arc_available_memory(void)
int64_t lowest = INT64_MAX;
free_memory_reason_t r = FMR_UNKNOWN;
#ifdef _KERNEL
- uint64_t available_memory = ptob(freemem);
+ uint64_t available_memory = ptob(arc_free_memory());
int64_t n;
#ifdef __linux__
pgcnt_t needfree = btop(arc_need_free);
@@ -6904,7 +6922,7 @@ static int
arc_memory_throttle(uint64_t reserve, uint64_t txg)
{
#ifdef _KERNEL
- uint64_t available_memory = ptob(freemem);
+ uint64_t available_memory = ptob(arc_free_memory());
static uint64_t page_load = 0;
static uint64_t last_txg = 0;
#ifdef __linux__