mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-01 17:56:50 +07:00
8c209ce721
nfs_migrate_page() does not wait for FS-Cache to finish with a page, probably leading to the following bad-page-state: BUG: Bad page state in process python-bin pfn:17d39b page:ffffea00053649e8 flags:004000000000100c count:0 mapcount:0 mapping:(null) index:38686 (Tainted: G B ---------------- ) Pid: 31053, comm: python-bin Tainted: G B ---------------- 2.6.32-71.24.1.el6.x86_64 #1 Call Trace: [<ffffffff8111bfe7>] bad_page+0x107/0x160 [<ffffffff8111ee69>] free_hot_cold_page+0x1c9/0x220 [<ffffffff8111ef19>] __pagevec_free+0x59/0xb0 [<ffffffff8104b988>] ? flush_tlb_others_ipi+0x128/0x130 [<ffffffff8112230c>] release_pages+0x21c/0x250 [<ffffffff8115b92a>] ? remove_migration_pte+0x28a/0x2b0 [<ffffffff8115f3f8>] ? mem_cgroup_get_reclaim_stat_from_page+0x18/0x70 [<ffffffff81122687>] ____pagevec_lru_add+0x167/0x180 [<ffffffff811226f8>] __lru_cache_add+0x58/0x70 [<ffffffff81122731>] lru_cache_add_lru+0x21/0x40 [<ffffffff81123f49>] putback_lru_page+0x69/0x100 [<ffffffff8115c0bd>] migrate_pages+0x13d/0x5d0 [<ffffffff81122687>] ? ____pagevec_lru_add+0x167/0x180 [<ffffffff81152ab0>] ? compaction_alloc+0x0/0x370 [<ffffffff8115255c>] compact_zone+0x4cc/0x600 [<ffffffff8111cfac>] ? get_page_from_freelist+0x15c/0x820 [<ffffffff810672f4>] ? check_preempt_wakeup+0x1c4/0x3c0 [<ffffffff8115290e>] compact_zone_order+0x7e/0xb0 [<ffffffff81152a49>] try_to_compact_pages+0x109/0x170 [<ffffffff8111e94d>] __alloc_pages_nodemask+0x5ed/0x850 [<ffffffff814c9136>] ? thread_return+0x4e/0x778 [<ffffffff81150d43>] alloc_pages_vma+0x93/0x150 [<ffffffff81167ea5>] do_huge_pmd_anonymous_page+0x135/0x340 [<ffffffff814cb6f6>] ? rwsem_down_read_failed+0x26/0x30 [<ffffffff81136755>] handle_mm_fault+0x245/0x2b0 [<ffffffff814ce383>] do_page_fault+0x123/0x3a0 [<ffffffff814cbdf5>] page_fault+0x25/0x30 nfs_migrate_page() calls nfs_fscache_release_page() which doesn't actually wait - even if __GFP_WAIT is set. The reason that doesn't wait is that fscache_maybe_release_page() might deadlock the allocator as the work threads writing to the cache may all end up sleeping on memory allocation. However, I wonder if that is actually a problem. There are a number of things I can do to deal with this: (1) Make nfs_migrate_page() wait. (2) Make fscache_maybe_release_page() honour the __GFP_WAIT flag. (3) Set a timeout around the wait. (4) Make nfs_migrate_page() return an error if the page is still busy. For the moment, I'll select (2) and (4). Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Jeff Layton <jlayton@redhat.com>
292 lines
10 KiB
C
292 lines
10 KiB
C
/* FS-Cache statistics
|
|
*
|
|
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* as published by the Free Software Foundation; either version
|
|
* 2 of the License, or (at your option) any later version.
|
|
*/
|
|
|
|
#define FSCACHE_DEBUG_LEVEL THREAD
|
|
#include <linux/module.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#include "internal.h"
|
|
|
|
/*
|
|
* operation counters
|
|
*/
|
|
atomic_t fscache_n_op_pend;
|
|
atomic_t fscache_n_op_run;
|
|
atomic_t fscache_n_op_enqueue;
|
|
atomic_t fscache_n_op_requeue;
|
|
atomic_t fscache_n_op_deferred_release;
|
|
atomic_t fscache_n_op_release;
|
|
atomic_t fscache_n_op_gc;
|
|
atomic_t fscache_n_op_cancelled;
|
|
atomic_t fscache_n_op_rejected;
|
|
|
|
atomic_t fscache_n_attr_changed;
|
|
atomic_t fscache_n_attr_changed_ok;
|
|
atomic_t fscache_n_attr_changed_nobufs;
|
|
atomic_t fscache_n_attr_changed_nomem;
|
|
atomic_t fscache_n_attr_changed_calls;
|
|
|
|
atomic_t fscache_n_allocs;
|
|
atomic_t fscache_n_allocs_ok;
|
|
atomic_t fscache_n_allocs_wait;
|
|
atomic_t fscache_n_allocs_nobufs;
|
|
atomic_t fscache_n_allocs_intr;
|
|
atomic_t fscache_n_allocs_object_dead;
|
|
atomic_t fscache_n_alloc_ops;
|
|
atomic_t fscache_n_alloc_op_waits;
|
|
|
|
atomic_t fscache_n_retrievals;
|
|
atomic_t fscache_n_retrievals_ok;
|
|
atomic_t fscache_n_retrievals_wait;
|
|
atomic_t fscache_n_retrievals_nodata;
|
|
atomic_t fscache_n_retrievals_nobufs;
|
|
atomic_t fscache_n_retrievals_intr;
|
|
atomic_t fscache_n_retrievals_nomem;
|
|
atomic_t fscache_n_retrievals_object_dead;
|
|
atomic_t fscache_n_retrieval_ops;
|
|
atomic_t fscache_n_retrieval_op_waits;
|
|
|
|
atomic_t fscache_n_stores;
|
|
atomic_t fscache_n_stores_ok;
|
|
atomic_t fscache_n_stores_again;
|
|
atomic_t fscache_n_stores_nobufs;
|
|
atomic_t fscache_n_stores_oom;
|
|
atomic_t fscache_n_store_ops;
|
|
atomic_t fscache_n_store_calls;
|
|
atomic_t fscache_n_store_pages;
|
|
atomic_t fscache_n_store_radix_deletes;
|
|
atomic_t fscache_n_store_pages_over_limit;
|
|
|
|
atomic_t fscache_n_store_vmscan_not_storing;
|
|
atomic_t fscache_n_store_vmscan_gone;
|
|
atomic_t fscache_n_store_vmscan_busy;
|
|
atomic_t fscache_n_store_vmscan_cancelled;
|
|
atomic_t fscache_n_store_vmscan_wait;
|
|
|
|
atomic_t fscache_n_marks;
|
|
atomic_t fscache_n_uncaches;
|
|
|
|
atomic_t fscache_n_acquires;
|
|
atomic_t fscache_n_acquires_null;
|
|
atomic_t fscache_n_acquires_no_cache;
|
|
atomic_t fscache_n_acquires_ok;
|
|
atomic_t fscache_n_acquires_nobufs;
|
|
atomic_t fscache_n_acquires_oom;
|
|
|
|
atomic_t fscache_n_invalidates;
|
|
atomic_t fscache_n_invalidates_run;
|
|
|
|
atomic_t fscache_n_updates;
|
|
atomic_t fscache_n_updates_null;
|
|
atomic_t fscache_n_updates_run;
|
|
|
|
atomic_t fscache_n_relinquishes;
|
|
atomic_t fscache_n_relinquishes_null;
|
|
atomic_t fscache_n_relinquishes_waitcrt;
|
|
atomic_t fscache_n_relinquishes_retire;
|
|
|
|
atomic_t fscache_n_cookie_index;
|
|
atomic_t fscache_n_cookie_data;
|
|
atomic_t fscache_n_cookie_special;
|
|
|
|
atomic_t fscache_n_object_alloc;
|
|
atomic_t fscache_n_object_no_alloc;
|
|
atomic_t fscache_n_object_lookups;
|
|
atomic_t fscache_n_object_lookups_negative;
|
|
atomic_t fscache_n_object_lookups_positive;
|
|
atomic_t fscache_n_object_lookups_timed_out;
|
|
atomic_t fscache_n_object_created;
|
|
atomic_t fscache_n_object_avail;
|
|
atomic_t fscache_n_object_dead;
|
|
|
|
atomic_t fscache_n_checkaux_none;
|
|
atomic_t fscache_n_checkaux_okay;
|
|
atomic_t fscache_n_checkaux_update;
|
|
atomic_t fscache_n_checkaux_obsolete;
|
|
|
|
atomic_t fscache_n_cop_alloc_object;
|
|
atomic_t fscache_n_cop_lookup_object;
|
|
atomic_t fscache_n_cop_lookup_complete;
|
|
atomic_t fscache_n_cop_grab_object;
|
|
atomic_t fscache_n_cop_invalidate_object;
|
|
atomic_t fscache_n_cop_update_object;
|
|
atomic_t fscache_n_cop_drop_object;
|
|
atomic_t fscache_n_cop_put_object;
|
|
atomic_t fscache_n_cop_sync_cache;
|
|
atomic_t fscache_n_cop_attr_changed;
|
|
atomic_t fscache_n_cop_read_or_alloc_page;
|
|
atomic_t fscache_n_cop_read_or_alloc_pages;
|
|
atomic_t fscache_n_cop_allocate_page;
|
|
atomic_t fscache_n_cop_allocate_pages;
|
|
atomic_t fscache_n_cop_write_page;
|
|
atomic_t fscache_n_cop_uncache_page;
|
|
atomic_t fscache_n_cop_dissociate_pages;
|
|
|
|
/*
|
|
* display the general statistics
|
|
*/
|
|
static int fscache_stats_show(struct seq_file *m, void *v)
|
|
{
|
|
seq_puts(m, "FS-Cache statistics\n");
|
|
|
|
seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
|
|
atomic_read(&fscache_n_cookie_index),
|
|
atomic_read(&fscache_n_cookie_data),
|
|
atomic_read(&fscache_n_cookie_special));
|
|
|
|
seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
|
|
atomic_read(&fscache_n_object_alloc),
|
|
atomic_read(&fscache_n_object_no_alloc),
|
|
atomic_read(&fscache_n_object_avail),
|
|
atomic_read(&fscache_n_object_dead));
|
|
seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
|
|
atomic_read(&fscache_n_checkaux_none),
|
|
atomic_read(&fscache_n_checkaux_okay),
|
|
atomic_read(&fscache_n_checkaux_update),
|
|
atomic_read(&fscache_n_checkaux_obsolete));
|
|
|
|
seq_printf(m, "Pages : mrk=%u unc=%u\n",
|
|
atomic_read(&fscache_n_marks),
|
|
atomic_read(&fscache_n_uncaches));
|
|
|
|
seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
|
|
" oom=%u\n",
|
|
atomic_read(&fscache_n_acquires),
|
|
atomic_read(&fscache_n_acquires_null),
|
|
atomic_read(&fscache_n_acquires_no_cache),
|
|
atomic_read(&fscache_n_acquires_ok),
|
|
atomic_read(&fscache_n_acquires_nobufs),
|
|
atomic_read(&fscache_n_acquires_oom));
|
|
|
|
seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u tmo=%u\n",
|
|
atomic_read(&fscache_n_object_lookups),
|
|
atomic_read(&fscache_n_object_lookups_negative),
|
|
atomic_read(&fscache_n_object_lookups_positive),
|
|
atomic_read(&fscache_n_object_created),
|
|
atomic_read(&fscache_n_object_lookups_timed_out));
|
|
|
|
seq_printf(m, "Invals : n=%u run=%u\n",
|
|
atomic_read(&fscache_n_invalidates),
|
|
atomic_read(&fscache_n_invalidates_run));
|
|
|
|
seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
|
|
atomic_read(&fscache_n_updates),
|
|
atomic_read(&fscache_n_updates_null),
|
|
atomic_read(&fscache_n_updates_run));
|
|
|
|
seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u rtr=%u\n",
|
|
atomic_read(&fscache_n_relinquishes),
|
|
atomic_read(&fscache_n_relinquishes_null),
|
|
atomic_read(&fscache_n_relinquishes_waitcrt),
|
|
atomic_read(&fscache_n_relinquishes_retire));
|
|
|
|
seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
|
|
atomic_read(&fscache_n_attr_changed),
|
|
atomic_read(&fscache_n_attr_changed_ok),
|
|
atomic_read(&fscache_n_attr_changed_nobufs),
|
|
atomic_read(&fscache_n_attr_changed_nomem),
|
|
atomic_read(&fscache_n_attr_changed_calls));
|
|
|
|
seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
|
|
atomic_read(&fscache_n_allocs),
|
|
atomic_read(&fscache_n_allocs_ok),
|
|
atomic_read(&fscache_n_allocs_wait),
|
|
atomic_read(&fscache_n_allocs_nobufs),
|
|
atomic_read(&fscache_n_allocs_intr));
|
|
seq_printf(m, "Allocs : ops=%u owt=%u abt=%u\n",
|
|
atomic_read(&fscache_n_alloc_ops),
|
|
atomic_read(&fscache_n_alloc_op_waits),
|
|
atomic_read(&fscache_n_allocs_object_dead));
|
|
|
|
seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
|
|
" int=%u oom=%u\n",
|
|
atomic_read(&fscache_n_retrievals),
|
|
atomic_read(&fscache_n_retrievals_ok),
|
|
atomic_read(&fscache_n_retrievals_wait),
|
|
atomic_read(&fscache_n_retrievals_nodata),
|
|
atomic_read(&fscache_n_retrievals_nobufs),
|
|
atomic_read(&fscache_n_retrievals_intr),
|
|
atomic_read(&fscache_n_retrievals_nomem));
|
|
seq_printf(m, "Retrvls: ops=%u owt=%u abt=%u\n",
|
|
atomic_read(&fscache_n_retrieval_ops),
|
|
atomic_read(&fscache_n_retrieval_op_waits),
|
|
atomic_read(&fscache_n_retrievals_object_dead));
|
|
|
|
seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
|
|
atomic_read(&fscache_n_stores),
|
|
atomic_read(&fscache_n_stores_ok),
|
|
atomic_read(&fscache_n_stores_again),
|
|
atomic_read(&fscache_n_stores_nobufs),
|
|
atomic_read(&fscache_n_stores_oom));
|
|
seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u\n",
|
|
atomic_read(&fscache_n_store_ops),
|
|
atomic_read(&fscache_n_store_calls),
|
|
atomic_read(&fscache_n_store_pages),
|
|
atomic_read(&fscache_n_store_radix_deletes),
|
|
atomic_read(&fscache_n_store_pages_over_limit));
|
|
|
|
seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u\n",
|
|
atomic_read(&fscache_n_store_vmscan_not_storing),
|
|
atomic_read(&fscache_n_store_vmscan_gone),
|
|
atomic_read(&fscache_n_store_vmscan_busy),
|
|
atomic_read(&fscache_n_store_vmscan_cancelled),
|
|
atomic_read(&fscache_n_store_vmscan_wait));
|
|
|
|
seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n",
|
|
atomic_read(&fscache_n_op_pend),
|
|
atomic_read(&fscache_n_op_run),
|
|
atomic_read(&fscache_n_op_enqueue),
|
|
atomic_read(&fscache_n_op_cancelled),
|
|
atomic_read(&fscache_n_op_rejected));
|
|
seq_printf(m, "Ops : dfr=%u rel=%u gc=%u\n",
|
|
atomic_read(&fscache_n_op_deferred_release),
|
|
atomic_read(&fscache_n_op_release),
|
|
atomic_read(&fscache_n_op_gc));
|
|
|
|
seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
|
|
atomic_read(&fscache_n_cop_alloc_object),
|
|
atomic_read(&fscache_n_cop_lookup_object),
|
|
atomic_read(&fscache_n_cop_lookup_complete),
|
|
atomic_read(&fscache_n_cop_grab_object));
|
|
seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d\n",
|
|
atomic_read(&fscache_n_cop_invalidate_object),
|
|
atomic_read(&fscache_n_cop_update_object),
|
|
atomic_read(&fscache_n_cop_drop_object),
|
|
atomic_read(&fscache_n_cop_put_object),
|
|
atomic_read(&fscache_n_cop_attr_changed),
|
|
atomic_read(&fscache_n_cop_sync_cache));
|
|
seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
|
|
atomic_read(&fscache_n_cop_read_or_alloc_page),
|
|
atomic_read(&fscache_n_cop_read_or_alloc_pages),
|
|
atomic_read(&fscache_n_cop_allocate_page),
|
|
atomic_read(&fscache_n_cop_allocate_pages),
|
|
atomic_read(&fscache_n_cop_write_page),
|
|
atomic_read(&fscache_n_cop_uncache_page),
|
|
atomic_read(&fscache_n_cop_dissociate_pages));
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* open "/proc/fs/fscache/stats" allowing provision of a statistical summary
|
|
*/
|
|
static int fscache_stats_open(struct inode *inode, struct file *file)
|
|
{
|
|
return single_open(file, fscache_stats_show, NULL);
|
|
}
|
|
|
|
const struct file_operations fscache_stats_fops = {
|
|
.owner = THIS_MODULE,
|
|
.open = fscache_stats_open,
|
|
.read = seq_read,
|
|
.llseek = seq_lseek,
|
|
.release = seq_release,
|
|
};
|