Release 4.11 fs/drop_caches.c
/*
* Implement the manual drop-all-pagecache function
*/
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/writeback.h>
#include <linux/sysctl.h>
#include <linux/gfp.h>
#include "internal.h"
/* A global variable is a bit ugly, but it keeps the code simple */
int sysctl_drop_caches;
static void drop_pagecache_sb(struct super_block *sb, void *unused)
{
struct inode *inode, *toput_inode = NULL;
spin_lock(&sb->s_inode_list_lock);
list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
spin_lock(&inode->i_lock);
if ((inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW)) ||
(inode->i_mapping->nrpages == 0)) {
spin_unlock(&inode->i_lock);
continue;
}
__iget(inode);
spin_unlock(&inode->i_lock);
spin_unlock(&sb->s_inode_list_lock);
invalidate_mapping_pages(inode->i_mapping, 0, -1);
iput(toput_inode);
toput_inode = inode;
spin_lock(&sb->s_inode_list_lock);
}
spin_unlock(&sb->s_inode_list_lock);
iput(toput_inode);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 58 | 38.41% | 2 | 22.22% |
Dave Chinner | 43 | 28.48% | 2 | 22.22% |
Jan Kara | 43 | 28.48% | 2 | 22.22% |
Al Viro | 4 | 2.65% | 1 | 11.11% |
Nicholas Piggin | 2 | 1.32% | 1 | 11.11% |
Mike Waychison | 1 | 0.66% | 1 | 11.11% |
Total | 151 | 100.00% | 9 | 100.00% |
int drop_caches_sysctl_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *length, loff_t *ppos)
{
int ret;
ret = proc_dointvec_minmax(table, write, buffer, length, ppos);
if (ret)
return ret;
if (write) {
static int stfu;
if (sysctl_drop_caches & 1) {
iterate_supers(drop_pagecache_sb, NULL);
count_vm_event(DROP_PAGECACHE);
}
if (sysctl_drop_caches & 2) {
drop_slab();
count_vm_event(DROP_SLAB);
}
if (!stfu) {
pr_info("%s (%d): drop_caches: %d\n",
current->comm, task_pid_nr(current),
sysctl_drop_caches);
}
stfu |= sysctl_drop_caches & 4;
}
return 0;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 63 | 48.84% | 1 | 20.00% |
Dave Hansen | 47 | 36.43% | 1 | 20.00% |
Petr Holasek | 12 | 9.30% | 1 | 20.00% |
Al Viro | 6 | 4.65% | 1 | 20.00% |
Joe Perches | 1 | 0.78% | 1 | 20.00% |
Total | 129 | 100.00% | 5 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Morton | 144 | 47.06% | 2 | 15.38% |
Dave Hansen | 47 | 15.36% | 1 | 7.69% |
Dave Chinner | 46 | 15.03% | 3 | 23.08% |
Jan Kara | 43 | 14.05% | 2 | 15.38% |
Petr Holasek | 12 | 3.92% | 1 | 7.69% |
Al Viro | 10 | 3.27% | 1 | 7.69% |
Nicholas Piggin | 2 | 0.65% | 1 | 7.69% |
Mike Waychison | 1 | 0.33% | 1 | 7.69% |
Joe Perches | 1 | 0.33% | 1 | 7.69% |
Total | 306 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.